diff options
| author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2001-05-18 18:32:42 +0000 |
|---|---|---|
| committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2001-05-18 18:32:42 +0000 |
| commit | 82017693c2dcaab03556154d990fe44591fb6f0a (patch) | |
| tree | 296fe4d4d48a6dbd3545f31ce9b7418c08c997d7 /src/cppunit | |
| parent | 15bf5fbb250670464df54ef9155cc3b391118523 (diff) | |
| download | cppunit-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')
| -rw-r--r-- | src/cppunit/TestFactoryRegistry.cpp | 15 | ||||
| -rw-r--r-- | src/cppunit/TypeInfoHelper.cpp | 7 | ||||
| -rw-r--r-- | src/cppunit/TypeInfoHelper.h | 29 | ||||
| -rw-r--r-- | src/cppunit/cppunit.dsp | 61 |
4 files changed, 57 insertions, 55 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() diff --git a/src/cppunit/TypeInfoHelper.cpp b/src/cppunit/TypeInfoHelper.cpp index 615be0a..abea261 100644 --- a/src/cppunit/TypeInfoHelper.cpp +++ b/src/cppunit/TypeInfoHelper.cpp @@ -1,8 +1,7 @@ -#ifdef USE_TYPEINFO +#ifdef CU_USE_TYPEINFO #include <string> - -#include "TypeInfoHelper.h" +#include <cppunit/extensions/TypeInfoHelper.h> namespace CppUnit { @@ -21,4 +20,4 @@ TypeInfoHelper::getClassName( const std::type_info &info ) } // namespace CppUnit -#endif // USE_TYPEINFO +#endif // CU_USE_TYPEINFO diff --git a/src/cppunit/TypeInfoHelper.h b/src/cppunit/TypeInfoHelper.h deleted file mode 100644 index ae97606..0000000 --- a/src/cppunit/TypeInfoHelper.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef CPPUNIT_TYPEINFOHELPER_H -#define CPPUNIT_TYPEINFOHELPER_H - -#ifdef USE_TYPEINFO - -#include <typeinfo> - - -namespace CppUnit { - - /** Helper to use type_info. - */ - class TypeInfoHelper - { - public: - /** Get the class name of the specified type_info. - * \param info Info which the class name is extracted from. - * \return The string returned by type_info::name() without - * the "class" prefix. If the name is not prefixed - * by "class", it is returned as this. - */ - static std::string getClassName( const std::type_info &info ); - }; - -} // namespace CppUnit - -#endif // USE_TYPEINFO - -#endif // CPPUNIT_TYPEINFOHELPER_H diff --git a/src/cppunit/cppunit.dsp b/src/cppunit/cppunit.dsp index c2a23e5..040b006 100644 --- a/src/cppunit/cppunit.dsp +++ b/src/cppunit/cppunit.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Static Library" 0x0104 -CFG=cppunit - Win32 Debug +CFG=cppunit - Win32 Debug Without CU_USE_TYPEINFO !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,12 +13,13 @@ CFG=cppunit - Win32 Debug !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE -!MESSAGE NMAKE /f "cppunit.mak" CFG="cppunit - Win32 Debug" +!MESSAGE NMAKE /f "cppunit.mak" CFG="cppunit - Win32 Debug Without CU_USE_TYPEINFO" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "cppunit - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "cppunit - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE "cppunit - Win32 Debug Without CU_USE_TYPEINFO" (based on "Win32 (x86) Static Library") !MESSAGE # Begin Project @@ -41,7 +42,7 @@ RSC=rc.exe # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GR /GX /O2 /I "..\..\include" /D "_MBCS" /D "_LIB" /D "USE_TYPEINFO" /D "NDEBUG" /D "WIN32" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GR /GX /O2 /I "..\..\include" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "CU_USE_TYPEINFO" /D "WIN32" /YX /FD /c # ADD BASE RSC /l 0x40c /d "NDEBUG" # ADD RSC /l 0x40c /d "NDEBUG" BSC32=bscmake.exe @@ -64,7 +65,7 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "..\..\include" /D "_MBCS" /D "_LIB" /D "USE_TYPEINFO" /D "_DEBUG" /D "WIN32" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "..\..\include" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "CU_USE_TYPEINFO" /D "WIN32" /YX /FD /GZ /c # ADD BASE RSC /l 0x40c /d "_DEBUG" # ADD RSC /l 0x40c /d "_DEBUG" BSC32=bscmake.exe @@ -74,21 +75,41 @@ LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"..\..\lib\cppunitd.lib" +!ELSEIF "$(CFG)" == "cppunit - Win32 Debug Without CU_USE_TYPEINFO" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "cppunit___Win32_Debug_Without_CU_USE_TYPEINFO" +# PROP BASE Intermediate_Dir "cppunit___Win32_Debug_Without_CU_USE_TYPEINFO" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "DebugNoTypeInfo" +# PROP Intermediate_Dir "DebugNoTypeInfo" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "..\..\include" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "CU_USE_TYPEINFO" /D "WIN32" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "..\..\include" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "WIN32" /YX /FD /GZ /c +# ADD BASE RSC /l 0x40c /d "_DEBUG" +# ADD RSC /l 0x40c /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo /out:"..\..\lib\cppunitd.lib" +# ADD LIB32 /nologo /out:"..\..\lib\cppunitnotypeinfod.lib" + !ENDIF # Begin Target # Name "cppunit - Win32 Release" # Name "cppunit - Win32 Debug" +# Name "cppunit - Win32 Debug Without CU_USE_TYPEINFO" # Begin Group "extensions" # PROP Default_Filter "" # Begin Source File -SOURCE=..\..\include\cppunit\extensions\TestFactory.h -# End Source File -# Begin Source File - SOURCE=..\..\include\cppunit\extensions\AutoRegisterSuite.h # End Source File # Begin Source File @@ -109,6 +130,10 @@ SOURCE=..\..\include\cppunit\extensions\TestDecorator.h # End Source File # Begin Source File +SOURCE=..\..\include\cppunit\extensions\TestFactory.h +# End Source File +# Begin Source File + SOURCE=.\TestFactoryRegistry.cpp # End Source File # Begin Source File @@ -127,9 +152,21 @@ SOURCE=..\..\include\cppunit\extensions\TestSuiteBuilder.h SOURCE=..\..\include\cppunit\extensions\TestSuiteFactory.h # End Source File +# Begin Source File + +SOURCE=.\TypeInfoHelper.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\include\cppunit\extensions\TypeInfoHelper.h +# End Source File # End Group # Begin Source File +SOURCE=..\..\ChangeLog +# End Source File +# Begin Source File + SOURCE=.\estring.h # End Source File # Begin Source File @@ -204,13 +241,5 @@ SOURCE=.\TextTestResult.cpp SOURCE=..\..\include\cppunit\TextTestResult.h # End Source File -# Begin Source File - -SOURCE=.\TypeInfoHelper.cpp -# End Source File -# Begin Source File - -SOURCE=.\TypeInfoHelper.h -# End Source File # End Target # End Project |
