CppUnit project page FAQ CppUnit home page

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

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 
00026   template<typename TestCaseType>
00027   class AutoRegisterSuite
00028   {
00029     public:
00032       AutoRegisterSuite()
00033       {
00034         TestFactory *factory = new TestSuiteFactory<TestCaseType>();
00035         TestFactoryRegistry::getRegistry().registerFactory( factory );
00036       }
00037 
00041       AutoRegisterSuite( const std::string &name )
00042       {
00043         TestFactory *factory = new TestSuiteFactory<TestCaseType>();
00044         TestFactoryRegistry::getRegistry( name ).registerFactory( factory );
00045       }
00046   };
00047 
00048 } // namespace CppUnit
00049 
00050 
00051 #endif  // CPPUNIT_EXTENSIONS_AUTOREGISTERSUITE_H

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