Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65373 - sandbox/odeint/branches/karsten/libs/numeric/odeint/test
From: karsten.ahnert_at_[hidden]
Date: 2010-09-10 09:40:58


Author: karsten
Date: 2010-09-10 09:40:57 EDT (Fri, 10 Sep 2010)
New Revision: 65373
URL: http://svn.boost.org/trac/boost/changeset/65373

Log:
fixing the check_resize test
Text files modified:
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile | 2
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_resize.cpp | 106 ++++++++++++++++-----------------------
   2 files changed, 46 insertions(+), 62 deletions(-)

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile 2010-09-10 09:40:57 EDT (Fri, 10 Sep 2010)
@@ -26,7 +26,7 @@
 
 unit-test basic_test
         : check_stepper_concepts.cpp
-# check_resize.cpp
+ check_resize.cpp
           check_implicit_euler.cpp
         :
         : <link>static

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_resize.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_resize.cpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_resize.cpp 2010-09-10 09:40:57 EDT (Fri, 10 Sep 2010)
@@ -19,98 +19,82 @@
 
 #include <boost/test/unit_test.hpp>
 
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/at.hpp>
+
 #include <boost/numeric/odeint.hpp>
 #include <boost/numeric/odeint/algebra/vector_space_algebra.hpp>
 
 using namespace boost::unit_test;
 using namespace boost::numeric::odeint;
 
+namespace mpl = boost::mpl;
+
 size_t adjust_size_count;
 
 typedef boost::array< double , 1 > test_array_type;
 
-namespace boost {
-namespace numeric {
-namespace odeint {
+namespace boost { namespace numeric { namespace odeint {
 
 
+ template<> struct is_resizeable< test_array_type >
+ {
+ struct type : public boost::true_type { };
+ const static bool value = type::value;
+ };
 
-template<>
-struct is_resizeable< test_array_type >
-{
- struct type : public boost::true_type { };
- const static bool value = type::value;
-};
 
+ template<> void adjust_size( const test_array_type &x1 , test_array_type &x2 )
+ {
+ adjust_size_count++;
+ }
 
-template<>
-void adjust_size( const test_array_type &x1 , test_array_type &x2 )
-{
- adjust_size_count++;
-}
+} } }
 
-}
-}
-}
 
 
+void constant_system( const test_array_type &x , test_array_type &dxdt , double t ) { dxdt[0] = 1.0; }
 
-void constant_system( const test_array_type &x , test_array_type &dxdt , double t )
-{
- dxdt[0] = 1.0;
-}
 
-template< class Stepper >
-void test_resize( Stepper &stepper , size_t multiplicity , size_t resize_calls )
+BOOST_AUTO_TEST_SUITE( check_resize_test )
+
+
+typedef explicit_euler< test_array_type , double , standard_algebra< test_array_type > , standard_operations< double > , adjust_size_manually_tag > euler_manual_type;
+typedef explicit_euler< test_array_type , double , standard_algebra< test_array_type > , standard_operations< double > , adjust_size_initially_tag > euler_initially_type;
+typedef explicit_euler< test_array_type , double , standard_algebra< test_array_type > , standard_operations< double > , adjust_size_always_tag > euler_always_type;
+
+typedef explicit_rk4< test_array_type , double , standard_algebra< test_array_type > , standard_operations< double > , adjust_size_manually_tag > rk4_manual_type;
+typedef explicit_rk4< test_array_type , double , standard_algebra< test_array_type > , standard_operations< double > , adjust_size_initially_tag > rk4_initially_type;
+typedef explicit_rk4< test_array_type , double , standard_algebra< test_array_type > , standard_operations< double > , adjust_size_always_tag > rk4_always_type;
+
+
+typedef mpl::vector<
+ mpl::vector< euler_manual_type , mpl::int_<1> , mpl::int_<0> > ,
+ mpl::vector< euler_initially_type , mpl::int_<1> , mpl::int_<1> > ,
+ mpl::vector< euler_always_type , mpl::int_<1> , mpl::int_<3> > ,
+ mpl::vector< rk4_manual_type , mpl::int_<5> , mpl::int_<0> > ,
+ mpl::vector< rk4_initially_type , mpl::int_<5> , mpl::int_<1> > ,
+ mpl::vector< rk4_always_type , mpl::int_<5> , mpl::int_<3> >
+>::type resize_check_types;
+
+
+BOOST_AUTO_TEST_CASE_TEMPLATE( test_resize , T, resize_check_types )
 {
+ typedef typename mpl::at< T , mpl::int_< 0 > >::type stepper_type;
+ const size_t resize_calls = mpl::at< T , mpl::int_< 1 > >::type::value;
+ const size_t multiplicity = mpl::at< T , mpl::int_< 2 > >::type::value;
         adjust_size_count = 0;
 
+ stepper_type stepper;
         test_array_type x;
         stepper.do_step( constant_system , x , 0.0 , 0.1 );
         stepper.do_step( constant_system , x , 0.0 , 0.1 );
         stepper.do_step( constant_system , x , 0.0 , 0.1 );
 
         BOOST_TEST_MESSAGE( "adjust_size_count : " << adjust_size_count );
-
         BOOST_CHECK_MESSAGE( adjust_size_count == resize_calls * multiplicity , "adjust_size_count : " << adjust_size_count );
 }
 
 
-BOOST_AUTO_TEST_SUITE( check_resize_test )
-
-//test_suite* init_unit_test_suite( int argc, char* argv[] )
-//{
-// test_suite *test = BOOST_TEST_SUITE( "check resize functionality" );
-
- typedef explicit_euler< test_array_type , double , standard_algebra< test_array_type > , standard_operations< double > , adjust_size_manually_tag > euler_manual_type;
- typedef explicit_euler< test_array_type , double , standard_algebra< test_array_type > , standard_operations< double > , adjust_size_initially_tag > euler_initially_type;
- typedef explicit_euler< test_array_type , double , standard_algebra< test_array_type > , standard_operations< double > , adjust_size_always_tag > euler_always_type;
-
- typedef explicit_rk4< test_array_type , double , standard_algebra< test_array_type > , standard_operations< double > , adjust_size_manually_tag > rk4_manual_type;
- typedef explicit_rk4< test_array_type , double , standard_algebra< test_array_type > , standard_operations< double > , adjust_size_initially_tag > rk4_initially_type;
- typedef explicit_rk4< test_array_type , double , standard_algebra< test_array_type > , standard_operations< double > , adjust_size_always_tag > rk4_always_type;
-
-
- euler_manual_type euler_manual;
- euler_initially_type euler_initially;
- euler_always_type euler_always;
-
- rk4_manual_type rk4_manual;
- rk4_initially_type rk4_initially;
- rk4_always_type rk4_always;
-
-// BOOST_AUTO_TEST_CASE( boost::bind( &test_resize< euler_manual_type > , boost::ref( euler_manual ) , 1 , 0 ) );
-
-
-
-// test->add( BOOST_TEST_CASE( boost::bind( &test_resize< euler_manual_type > , boost::ref( euler_manual ) , 1 , 0 ) ) );
-// test->add( BOOST_TEST_CASE( boost::bind( &test_resize< euler_initially_type > , boost::ref( euler_initially ) , 1 , 1 ) ) );
-// test->add( BOOST_TEST_CASE( boost::bind( &test_resize< euler_always_type > , boost::ref( euler_always ) , 1 , 3 ) ) );
-//
-// test->add( BOOST_TEST_CASE( boost::bind( &test_resize< rk4_manual_type > , boost::ref( rk4_manual ) , 5 , 0 ) ) );
-// test->add( BOOST_TEST_CASE( boost::bind( &test_resize< rk4_initially_type > , boost::ref( rk4_initially ) , 5 , 1 ) ) );
-// test->add( BOOST_TEST_CASE( boost::bind( &test_resize< rk4_always_type > , boost::ref( rk4_always ) , 5 , 3 ) ) );
-
-// return test;
-//}
 BOOST_AUTO_TEST_SUITE_END()


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