[Cppunit-cvs] cppunit2/include/cpptl config.h,1.22,1.23
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2007-08-15 11:21:02
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv8069/include/cpptl Modified Files: config.h Log Message: Added support for light test fixture (a la CppUnitLite). See lightfixture.h and example/light_fixture. Added support for direct declaration and registration of test in plain C function. See testfunction.h and example/test_function. Index: config.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/config.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** config.h 6 Sep 2006 19:23:26 -0000 1.22 --- config.h 15 Aug 2007 11:20:57 -0000 1.23 *************** *** 296,299 **** --- 296,317 ---- } + template<class TargetType, class SourceType> + TargetType checkedCast( SourceType *pointer, Type<TargetType> ) + { + TargetType casted = dynamic_cast<TargetType>( pointer ); + CPPTL_ASSERT_MESSAGE( casted != 0, "CPPTL_CHECKED_CAST: wrong TargetType." ); + return casted; + } + + #if defined(NDEBUG) || defined(CPPTL_NO_RTTI) + # define CPPTL_CHECKED_CAST( TargetType, pointer ) \ + static_cast<TargetType>( pointer ) + #else + # define CPPTL_CHECKED_CAST( TargetType, pointer ) \ + ::CppTL::checkedCast( pointer, ::CppTL::Type<TargetType>() ) + #endif + + + } // namespace CppTL |