summaryrefslogtreecommitdiff
path: root/src/cppunit/TestFactoryRegistry.cpp
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2001-05-18 18:32:42 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2001-05-18 18:32:42 +0000
commit82017693c2dcaab03556154d990fe44591fb6f0a (patch)
tree296fe4d4d48a6dbd3545f31ce9b7418c08c997d7 /src/cppunit/TestFactoryRegistry.cpp
parent15bf5fbb250670464df54ef9155cc3b391118523 (diff)
downloadcppunit-82017693c2dcaab03556154d990fe44591fb6f0a.tar.gz
: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.
Diffstat (limited to 'src/cppunit/TestFactoryRegistry.cpp')
-rw-r--r--src/cppunit/TestFactoryRegistry.cpp15
1 files changed, 9 insertions, 6 deletions
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 <sstream>
#include <utility>
#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()