diff options
| author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2001-10-02 19:44:54 +0000 |
|---|---|---|
| committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2001-10-02 19:44:54 +0000 |
| commit | ddfca2261132a879f631cbaaf22e82feaa2460ef (patch) | |
| tree | 7b1d7a758398613609af6490727503467eb775a9 /include/cppunit | |
| parent | 9e5ff0f6a865524e5784450f26a1c74807dc0c80 (diff) | |
| download | cppunit-ddfca2261132a879f631cbaaf22e82feaa2460ef.tar.gz | |
Include/cppunit/extensions/TestFactoryRegistry.
include/cppunit/extensions/TestFactoryRegistry.h
* src/cppunit/TestFactoryRegistry.cpp : fixed memory leaks that
occured when a TestFactoryRegistry was registered into another
TestFactoryRegistry.
* include/cppunit/extensions/AutoRegisterSuite.h : updated doc.
* include/cppunit/extensions/HelperMacros.h : added macro
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION to register a suite into
a named suite. Updated doc.
* examples/cppunittest/CoreSuite.h:
* examples/cppunittest/ExtensionSuite.h:
* examples/cppunittest/HelperSuite.h: added, declaration of suite for
use with CPPUNIT_TEST_SUITE_NAMED_REGISTRATION.
* examples/cppunittest/makefile.am : added HelperSuite.h, CoreSuite.h,
ExtensionSuite.h, CppUnitTestSuite.h and CppUnitTestSuite.cpp.
* examples/cppunittest/CppUnitTestSuite.*: added.
* examples/cppunittest/ExceptionTest.cpp:
* examples/cppunittest/TestAssertTest.cpp:
* examples/cppunittest/TestCaseTest.cpp:
* examples/cppunittest/TestFailureTest.cpp:
* examples/cppunittest/TestListenerTest.cpp:
* examples/cppunittest/TestResultTest.cpp:
* examples/cppunittest/TestSuiteTest.cpp: moved into named suite
"Core" using CPPUNIT_TEST_SUITE_NAMED_REGISTRATION.
* examples/cppunittest/OrthodoxTest.cpp:
* examples/cppunittest/RepeatedTest.cpp:
* examples/cppunittest/TestDecoratorTest.cpp:
* examples/cppunittest/TestSetUpTest.cpp: moved into named suite
"Extension" using CPPUNIT_TEST_SUITE_NAMED_REGISTRATION.
* examples/cppunittest/HelperMacrosTest.cpp:
* examples/cppunittest/TestCallerTest.cpp: moved into named suite
"Helper" using CPPUNIT_TEST_SUITE_NAMED_REGISTRATION.
* examples/cppunittest/CppUnitTest.dsp :
* examples/msvc6/CppUnitTestApp/CppUnitTestApp.dsp : added
Makefile.am, HelperSuite.h, CoreSuite.h, ExtensionSuite.h,
CppUnitTestSuite.h and CppUnitTestSuite.cpp.
Diffstat (limited to 'include/cppunit')
| -rw-r--r-- | include/cppunit/extensions/AutoRegisterSuite.h | 2 | ||||
| -rw-r--r-- | include/cppunit/extensions/HelperMacros.h | 27 | ||||
| -rw-r--r-- | include/cppunit/extensions/TestFactoryRegistry.h | 2 |
3 files changed, 25 insertions, 6 deletions
diff --git a/include/cppunit/extensions/AutoRegisterSuite.h b/include/cppunit/extensions/AutoRegisterSuite.h index 7033412..28a3e7c 100644 --- a/include/cppunit/extensions/AutoRegisterSuite.h +++ b/include/cppunit/extensions/AutoRegisterSuite.h @@ -15,7 +15,7 @@ namespace CppUnit { * This object is intented to be used as a static variable. * * \param TestCaseType Type of the test case which suite is registered. - * \see CPPUNIT_TEST_SUITE_REGISTRATION. + * \see CPPUNIT_TEST_SUITE_REGISTRATION, CppUnit::TestFactoryRegistry. */ template<typename TestCaseType> class AutoRegisterSuite diff --git a/include/cppunit/extensions/HelperMacros.h b/include/cppunit/extensions/HelperMacros.h index 9291fc7..08307eb 100644 --- a/include/cppunit/extensions/HelperMacros.h +++ b/include/cppunit/extensions/HelperMacros.h @@ -241,13 +241,34 @@ * \param ATestCaseType Type of the test case class. * \warning This macro should be used only once per line of code (the line * number is used to name a hidden static variable). - * \see CPPUNIT_TEST_SUITE, CppUnit::AutoRegisterSuite. + * \see CPPUNIT_TEST_SUITE, CppUnit::AutoRegisterSuite, + * CppUnit::TestFactoryRegistry. */ -#define CPPUNIT_TEST_SUITE_REGISTRATION( ATestCaseType ) \ - static CppUnit::AutoRegisterSuite< ATestCaseType > \ +#define CPPUNIT_TEST_SUITE_REGISTRATION( ATestCaseType ) \ + static CppUnit::AutoRegisterSuite< ATestCaseType > \ __CPPUNIT_MAKE_UNIQUE_NAME(__autoRegisterSuite ) +/** Register test suite into the specified global registry suite. + * + * This macro declares a static variable whose construction + * causes a test suite factory to be inserted in the global registry + * suite of the specified name. The registry is available by calling + * the static function CppUnit::TestFactoryRegistry::getRegistry(). + * + * \param ATestCaseType Type of the test case class. + * \param suiteName Name of the global registry suite the test suite is + * registered into. + * \warning This macro should be used only once per line of code (the line + * number is used to name a hidden static variable). + * \see CPPUNIT_TEST_SUITE, CppUnit::AutoRegisterSuite, + * CppUnit::TestFactoryRegistry.. + */ +#define CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ATestCaseType, suiteName ) \ + static CppUnit::AutoRegisterSuite< ATestCaseType > \ + __CPPUNIT_MAKE_UNIQUE_NAME(__autoRegisterSuite )(suiteName) + + // Backwards compatibility // (Not tested!) diff --git a/include/cppunit/extensions/TestFactoryRegistry.h b/include/cppunit/extensions/TestFactoryRegistry.h index e835321..a9edea2 100644 --- a/include/cppunit/extensions/TestFactoryRegistry.h +++ b/include/cppunit/extensions/TestFactoryRegistry.h @@ -66,8 +66,6 @@ namespace CppUnit { typedef std::map<std::string, TestFactory *> Factories; Factories m_factories; - typedef std::map<std::string, TestFactoryRegistry *> NamedRegistries; - std::string m_name; }; |
