From 82017693c2dcaab03556154d990fe44591fb6f0a Mon Sep 17 00:00:00 2001 From: Baptiste Lepilleur Date: Fri, 18 May 2001 18:32:42 +0000 Subject: :registerFactory(factory) now generate a dummy name based on a serial number instead of using RTTI. * Symbol CU_USE_TYPEINFO must be defined instead of USE_TYPEINFO to compile RTTI. * Added back default constructor to TestSuiteBuilder which use RTTI. It is available only if CU_USE_TYPEINFO is defined. * Moved TypeInfoHelper.h from src/cppunit to include/cppunit/extensions. * Macro CU_TEST_SUITE in HelperMacros.h now use TestSuiteBuilder default constructor if CU_USE_TYPEINFO is defined, otherwise it use the type name given to the CU_TEST_SUITE macro. * TestFactoryRegistry::registerFactory(factory) now generate a dummy name based on a serial number instead of using RTTI. The macro CU_TEST_SUITE_REGISTRATION and class AutoRegisterSuite can now when CU_USE_TYPEINFO is not defined. * Added a new Configuration named "Debug Without CU_USE_TYPEINFO" to msvc6 projects. The flag CU_USE_TYPEINFO is not defined in that configuration. --- src/cppunit/TestFactoryRegistry.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/cppunit/TestFactoryRegistry.cpp') diff --git a/src/cppunit/TestFactoryRegistry.cpp b/src/cppunit/TestFactoryRegistry.cpp index 3db7032..c9b1096 100644 --- a/src/cppunit/TestFactoryRegistry.cpp +++ b/src/cppunit/TestFactoryRegistry.cpp @@ -3,13 +3,14 @@ #pragma warning( disable : 4786 ) // disable warning debug symbol > 255... #endif // _MSC_VER > 1000 +#include #include #include "cppunit/TestSuite.h" #include "cppunit/extensions/TestFactoryRegistry.h" -#ifdef USE_TYPEINFO -#include "TypeInfoHelper.h" -#endif // USE_TYPEINFO +#ifdef CU_USE_TYPEINFO +#include "cppunit/extensions/TypeInfoHelper.h" +#endif // CU_USE_TYPEINFO namespace CppUnit { @@ -66,14 +67,16 @@ TestFactoryRegistry::registerFactory( const std::string &name, } -#ifdef USE_TYPEINFO void TestFactoryRegistry::registerFactory( TestFactory *factory ) { - std::string name = TypeInfoHelper::getClassName( typeid( *factory ) ); + std::ostringstream stream; + static int serialNumber = 1; + stream << "@Dummy@" << serialNumber++; + std::string name( stream.str() ); + registerFactory( name, factory ); } -#endif // USE_TYPEINFO Test * TestFactoryRegistry::makeTest() -- cgit v1.2.1