|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53346 - sandbox/numeric_adaptor/libs/numeric_adaptor/test
From: barend.gehrels_at_[hidden]
Date: 2009-05-28 11:46:02
Author: barendgehrels
Date: 2009-05-28 11:46:02 EDT (Thu, 28 May 2009)
New Revision: 53346
URL: http://svn.boost.org/trac/boost/changeset/53346
Log:
Added Bruno's string conversion solution
Added namespaces
Bugfix in CLN string-assignment (should have precision otherwise too low)
Added sample "heron"
Added "HAVE_xxx" in samples
Text files modified:
sandbox/numeric_adaptor/libs/numeric_adaptor/test/test_conversions.cpp | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
Modified: sandbox/numeric_adaptor/libs/numeric_adaptor/test/test_conversions.cpp
==============================================================================
--- sandbox/numeric_adaptor/libs/numeric_adaptor/test/test_conversions.cpp (original)
+++ sandbox/numeric_adaptor/libs/numeric_adaptor/test/test_conversions.cpp 2009-05-28 11:46:02 EDT (Thu, 28 May 2009)
@@ -10,23 +10,26 @@
#include <boost/test/included/test_exec_monitor.hpp>
#include <boost/numeric_adaptor/numeric_adaptor.hpp>
#include <boost/numeric_adaptor/ieee_policy.hpp>
-#ifndef NO_CLN
-#include <boost/numeric_adaptor/cln_policy.hpp>
+
+#if defined(HAVE_GMP)
+# include <boost/numeric_adaptor/gmp_policy.hpp>
+#endif
+
+#if defined(HAVE_CLN)
+# include <boost/numeric_adaptor/cln_policy.hpp>
#endif
-#include <boost/numeric_adaptor/gmp_policy.hpp>
template <typename Policy>
void test_all()
{
- typedef numeric_adaptor::numeric_adaptor<Policy> num;
+ typedef boost::numeric_adaptor::numeric_adaptor<Policy> num;
num n = 1234.5;
BOOST_CHECK_EQUAL(int(n), 1234);
BOOST_CHECK_EQUAL(float(n), 1234.5);
BOOST_CHECK_EQUAL(double(n), 1234.5);
- BOOST_CHECK_EQUAL(n.template get<std::string>(), "1234.5");
- BOOST_CHECK_EQUAL(numeric_adaptor::get<std::string>(n), "1234.5");
+ BOOST_CHECK_EQUAL(std::string(n), "1234.5");
num n2 = "1234.5";
BOOST_CHECK_EQUAL(double(n2), 1234.5);
@@ -37,7 +40,15 @@
int test_main(int, char*[])
{
- test_all<numeric_adaptor::ieee_policy<double> >();
+ using namespace boost::numeric_adaptor;
+ test_all<ieee_policy<double> >();
+#if defined(HAVE_GMP)
+ test_all<gmp_policy>();
+#endif
+
+#if defined(HAVE_CLN)
+ test_all<cln_policy>();
+#endif
return 0;
};
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk