[Cppunit-devel] A better version of CPPUNIT_TEST_SUITE_REGISTRATION macro(?)
Brought to you by:
blep
From: Gola Bartlomiej-A. <Bar...@mo...> - 2005-07-13 10:06:38
|
Hi, I've encountered a problem when using CPPUNIT_TEST_SUITE_REGISTRATION macro. I have several files with various tests and in each one of them I'm using the above macro to register the test class. The problem arises when you put the registration macro in the same line (but in the separate files!) which generates compilation error (identifier redefinition). To resolve the problem, I've modified the CPPUNIT_TEST_SUITE_REGISTRATION macro: instead of using the "autoRegisterRegistry__" prefix for a class name, a little bit more complex syntax could be used. The modified macro: #define CPPUNIT_TEST_SUITE_REGISTRATION( ATestFixtureType ) \ static CPPUNIT_NS::AutoRegisterSuite< ATestFixtureType > \ CPPUNIT_MAKE_UNIQUE_NAME( CPPUNIT_JOIN(ATestFixtureType, _AutoRegisterSuite_) ) The original version: #define CPPUNIT_TEST_SUITE_REGISTRATION( ATestFixtureType ) \ static CPPUNIT_NS::AutoRegisterSuite< ATestFixtureType > \ CPPUNIT_MAKE_UNIQUE_NAME(autoRegisterRegistry__ ) If you think it is a good idea I would more than happy if you used my solution in the next CppUnit version. Best regards and thanks for a great test framework, Bartek Gola |