Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53232 - in sandbox/numeric_adaptor: boost/numeric_adaptor libs/numeric_adaptor/test
From: bruno.lalande_at_[hidden]
Date: 2009-05-24 18:34:36


Author: bruno.lalande
Date: 2009-05-24 18:34:34 EDT (Sun, 24 May 2009)
New Revision: 53232
URL: http://svn.boost.org/trac/boost/changeset/53232

Log:
Nesting everything into a numeric_adaptor namespace.
Added:
   sandbox/numeric_adaptor/libs/numeric_adaptor/test/test_cast.cpp (contents, props changed)
Text files modified:
   sandbox/numeric_adaptor/boost/numeric_adaptor/cln_policy.hpp | 3 ++-
   sandbox/numeric_adaptor/boost/numeric_adaptor/default_policy.hpp | 7 +++++++
   sandbox/numeric_adaptor/boost/numeric_adaptor/gmp_policy.hpp | 6 +++++-
   sandbox/numeric_adaptor/boost/numeric_adaptor/ieee_policy.hpp | 6 ++++++
   sandbox/numeric_adaptor/boost/numeric_adaptor/numeric_adaptor.hpp | 6 ++++++
   sandbox/numeric_adaptor/libs/numeric_adaptor/test/Jamroot | 1 +
   sandbox/numeric_adaptor/libs/numeric_adaptor/test/test_heron.cpp | 14 +++++++-------
   7 files changed, 34 insertions(+), 9 deletions(-)

Modified: sandbox/numeric_adaptor/boost/numeric_adaptor/cln_policy.hpp
==============================================================================
--- sandbox/numeric_adaptor/boost/numeric_adaptor/cln_policy.hpp (original)
+++ sandbox/numeric_adaptor/boost/numeric_adaptor/cln_policy.hpp 2009-05-24 18:34:34 EDT (Sun, 24 May 2009)
@@ -18,6 +18,7 @@
 #include <cln/float.h>
 
 
+namespace numeric_adaptor {
 
 
 /*
@@ -96,7 +97,7 @@
 };
 
 
-
+} // namespace numeric_adaptor
 
 
 #endif

Modified: sandbox/numeric_adaptor/boost/numeric_adaptor/default_policy.hpp
==============================================================================
--- sandbox/numeric_adaptor/boost/numeric_adaptor/default_policy.hpp (original)
+++ sandbox/numeric_adaptor/boost/numeric_adaptor/default_policy.hpp 2009-05-24 18:34:34 EDT (Sun, 24 May 2009)
@@ -12,6 +12,10 @@
 
 #include <sstream>
 
+
+namespace numeric_adaptor {
+
+
 template <typename T>
 struct default_policy
 {
@@ -46,4 +50,7 @@
 };
 
 
+} // namespace numeric_adaptor
+
+
 #endif

Modified: sandbox/numeric_adaptor/boost/numeric_adaptor/gmp_policy.hpp
==============================================================================
--- sandbox/numeric_adaptor/boost/numeric_adaptor/gmp_policy.hpp (original)
+++ sandbox/numeric_adaptor/boost/numeric_adaptor/gmp_policy.hpp 2009-05-24 18:34:34 EDT (Sun, 24 May 2009)
@@ -14,10 +14,11 @@
 #include <string>
 #include <cstring>
 
-
 #include <gmp.h>
 
 
+namespace numeric_adaptor {
+
 
 struct gmp_policy
 {
@@ -144,4 +145,7 @@
 };
 
 
+} // namespace numeric_adaptor
+
+
 #endif

Modified: sandbox/numeric_adaptor/boost/numeric_adaptor/ieee_policy.hpp
==============================================================================
--- sandbox/numeric_adaptor/boost/numeric_adaptor/ieee_policy.hpp (original)
+++ sandbox/numeric_adaptor/boost/numeric_adaptor/ieee_policy.hpp 2009-05-24 18:34:34 EDT (Sun, 24 May 2009)
@@ -23,6 +23,9 @@
 #include <boost/math/special_functions/hypot.hpp>
 
 
+namespace numeric_adaptor {
+
+
 template <typename T>
 struct ieee_policy : public default_policy<T>
 {
@@ -52,4 +55,7 @@
 };
 
 
+} // namespace numeric_adaptor
+
+
 #endif

Modified: sandbox/numeric_adaptor/boost/numeric_adaptor/numeric_adaptor.hpp
==============================================================================
--- sandbox/numeric_adaptor/boost/numeric_adaptor/numeric_adaptor.hpp (original)
+++ sandbox/numeric_adaptor/boost/numeric_adaptor/numeric_adaptor.hpp 2009-05-24 18:34:34 EDT (Sun, 24 May 2009)
@@ -14,6 +14,9 @@
 #include <boost/static_assert.hpp>
 
 
+namespace numeric_adaptor {
+
+
 template <typename Policy, typename ToType, bool IsCasted>
 struct caster
 {
@@ -249,4 +252,7 @@
 };
 
 
+} // namespace numeric_adaptor
+
+
 #endif

Modified: sandbox/numeric_adaptor/libs/numeric_adaptor/test/Jamroot
==============================================================================
--- sandbox/numeric_adaptor/libs/numeric_adaptor/test/Jamroot (original)
+++ sandbox/numeric_adaptor/libs/numeric_adaptor/test/Jamroot 2009-05-24 18:34:34 EDT (Sun, 24 May 2009)
@@ -15,3 +15,4 @@
 import testing ;
 
 run test_heron.cpp : gmp ;
+run test_cast.cpp : gmp ;

Added: sandbox/numeric_adaptor/libs/numeric_adaptor/test/test_cast.cpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_adaptor/libs/numeric_adaptor/test/test_cast.cpp 2009-05-24 18:34:34 EDT (Sun, 24 May 2009)
@@ -0,0 +1,36 @@
+// Numeric Adaptor Library testing suite
+//
+// Copyright Barend Gehrels 2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2009
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#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>
+#endif
+#include <boost/numeric_adaptor/gmp_policy.hpp>
+
+
+template <typename Policy>
+void test_all()
+{
+ typedef 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");
+}
+
+int test_main(int, char*[])
+{
+ test_all<numeric_adaptor::ieee_policy<double> >();
+
+ return 0;
+};

Modified: sandbox/numeric_adaptor/libs/numeric_adaptor/test/test_heron.cpp
==============================================================================
--- sandbox/numeric_adaptor/libs/numeric_adaptor/test/test_heron.cpp (original)
+++ sandbox/numeric_adaptor/libs/numeric_adaptor/test/test_heron.cpp 2009-05-24 18:34:34 EDT (Sun, 24 May 2009)
@@ -18,10 +18,10 @@
 #include <boost/numeric_adaptor/gmp_policy.hpp>
 
 
-template <class Policy>
+template <typename Policy>
 double heron()
 {
- typedef numeric_adaptor<Policy> num;
+ typedef numeric_adaptor::numeric_adaptor<Policy> num;
 
     num a = 31622.77662;
     num b = 0.000023;
@@ -36,13 +36,13 @@
 
     double epsilon = 0.0000001;
 
- BOOST_CHECK_CLOSE(heron<ieee_policy<float> >(), 0.0, epsilon);
- BOOST_CHECK_CLOSE(heron<ieee_policy<double> >(), 0.327490532778257, epsilon);
- BOOST_CHECK_CLOSE(heron<ieee_policy<long double> >(), 0.327490459921098, epsilon);
+ BOOST_CHECK_CLOSE(heron<numeric_adaptor::ieee_policy<float> >(), 0.0, epsilon);
+ BOOST_CHECK_CLOSE(heron<numeric_adaptor::ieee_policy<double> >(), 0.327490532778257, epsilon);
+ BOOST_CHECK_CLOSE(heron<numeric_adaptor::ieee_policy<long double> >(), 0.327490459921098, epsilon);
 #ifndef NO_CLN
- BOOST_CHECK_CLOSE(heron<cln_policy>(), 0.32749045994262366, epsilon);
+ BOOST_CHECK_CLOSE(heron<numeric_adaptor::cln_policy>(), 0.32749045994262366, epsilon);
 #endif
- BOOST_CHECK_CLOSE(heron<gmp_policy>(), 0.327490459942623, epsilon);
+ BOOST_CHECK_CLOSE(heron<numeric_adaptor::gmp_policy>(), 0.327490459942623, epsilon);
 
     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