Boost logo

Boost-Commit :

From: mariano.consoni_at_[hidden]
Date: 2007-08-10 15:47:04


Author: mconsoni
Date: 2007-08-10 15:47:00 EDT (Fri, 10 Aug 2007)
New Revision: 38586
URL: http://svn.boost.org/trac/boost/changeset/38586

Log:
- Made it work. We have our first unit test.

Text files modified:
   sandbox/libs/reflection/test/basic_test.cpp | 15 ++++++++++-----
   1 files changed, 10 insertions(+), 5 deletions(-)

Modified: sandbox/libs/reflection/test/basic_test.cpp
==============================================================================
--- sandbox/libs/reflection/test/basic_test.cpp (original)
+++ sandbox/libs/reflection/test/basic_test.cpp 2007-08-10 15:47:00 EDT (Fri, 10 Aug 2007)
@@ -30,8 +30,7 @@
      template parameter declares that we will describe this reflection
      using a string. Any arbitrary type could be used here. */
   boost::extension::reflection<car, std::string> car_reflection("A Car!");
- std::string &s = car_reflection.get_info();
- BOOST_CHECK_EQUAL( i, std::string("A Car!") );
+ BOOST_CHECK_EQUAL( car_reflection.get_info(), "A Car!" );
 
   /* Here we add two methods to the reflection. The library must
      correctly parse and remember the parameters and return type of these
@@ -48,15 +47,21 @@
   car ferrari_f40("Ferrari F40");
 
   // call methods
- car_reflection.call<int, bool>(&porsche_911, 3);
- car_reflection.call<std::string, bool,
+ bool porsche_start = car_reflection.call<int, bool>(&porsche_911, 3);
+ BOOST_CHECK_EQUAL( porsche_start, true );
+
+ bool porsche_turn = car_reflection.call<std::string, bool,
     float, std::string>(&porsche_911, "turn", .5f);
+ BOOST_CHECK_EQUAL( porsche_turn, true );
 
- car_reflection.call<std::string, bool,
+ bool ferrari_turn = car_reflection.call<std::string, bool,
     float, std::string>(&ferrari_f40, "turn", .10f);
+ BOOST_CHECK_EQUAL( ferrari_turn, false );
 
   // prepare the parameter map for a call
   boost::extension::parameter_map pm;
   pm.add<float, std::string>(.15f, "turn_angle");
   pm.add<int, std::string>(50, "aceleration");
+
+ // TODO: call and test result
 }


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