CppUnit project page FAQ CppUnit home page

Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

AutoRegisterSuite.h

Go to the documentation of this file.
00001 #ifndef CPPUNIT_EXTENSIONS_AUTOREGISTERSUITE_H
00002 #define CPPUNIT_EXTENSIONS_AUTOREGISTERSUITE_H
00003 
00004 #include <string>
00005 #include <cppunit/extensions/TestSuiteFactory.h>
00006 #include <cppunit/extensions/TestFactoryRegistry.h>
00007 
00008 namespace CppUnit {
00009 
00020   template<typename TestCaseType>
00021   class AutoRegisterSuite
00022   {
00023     public:
00026       AutoRegisterSuite()
00027       {
00028         TestFactory *factory = new TestSuiteFactory<TestCaseType>();
00029         TestFactoryRegistry::getRegistry().registerFactory( factory );
00030       }
00031 
00035       AutoRegisterSuite( const std::string &name )
00036       {
00037         TestFactory *factory = new TestSuiteFactory<TestCaseType>();
00038         TestFactoryRegistry::getRegistry( name ).registerFactory( factory );
00039       }
00040   };
00041 
00042 } // namespace CppUnit
00043 
00044 
00045 #endif  // CPPUNIT_EXTENSIONS_AUTOREGISTERSUITE_H

SourceForge Logo hosts this site. Send comments to:
CppUnit Developers