[Cppunit-devel] news features...
Brought to you by:
blep
From: Baptiste L. <bl...@cl...> - 2001-10-02 20:42:39
|
1) CPPUNIT_TEST_EXCEPTION( method, ExceptionType) 2) CPPUNIT_TEST_FAIL( method ) 4) CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( TestFixtureType, SuiteName ) : register the fixture's suite in a suite of the specified name. Those features have been added. I would really appreciate if somebody could read and adjust the documentation of those macros. Somebody reviewing the TestFactoryRegistry code would be nice too (probably the weirdest life-cycle managment I've ever done). CppUnit test suite hierarchy have been reworked to use CPPUNIT_TEST_SUITE_NAMED_REGISTRATION (one of the problem of singleton is that they are very difficult to test. So CppUnit itself use the things that may break in the TestRegistry). You can found a screen-shot of the hiearchy there: http://gaiacrtn.free.fr/cppunit/CppUniTestHierarchy-20011002.jpg Now, there still one little piece of TestFactoryRegistry that need work. To create the suite hierarchy, we do (CppUnitTestSuite.cpp): CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry(); istry.registerFactory( &CppUnit::TestFactoryRegistry::getRegistry( coreSuiteName() ) ); registry.registerFactory( &CppUnit::TestFactoryRegistry::getRegistry( helperSuiteName() ) ); ... As you figured out, it would be nice to be able to do: registry.registerNamedRegistry( coreSuiteName() ); registry.registerNamedRegistry( helperSuiteName() ); What I need is a good name for the method. What this method does can be really confusing, so a good name would help. Here is what it does (well, wording it can be somewhat confusing too...): You have a TestFactoryRegistry that contains a list of TestFactory. Since a TestFactoryRegistry is a TestFactory, you can add a TestFactoryRegistry to another TestFactoryRegistry (what is done in the example). The method would retreive the registry of the specified name using TestFactory::getRegistry( name ), and regist er that factory to its list of factory (using registerFactory). I would also need a macro name. The macro would work in the spirit of CPPUNIT_TEST_SUITE_REGISTRATION: CPPUNIT_REGISTER_REGISTRY_SUITE_INTO( suiteToRegisterName, suiteName ) // with some decorating, it would do: stFactory::getRegistry( suiteName).registerNamedRegistry( suiteToRegisterNam e ) Any suggestions ? Baptiste. |