CppUnit - The Unit Testing Library

CppUnit project page | FAQ

TestFactoryRegistry.h
Go to the documentation of this file.
1 #ifndef CPPUNIT_EXTENSIONS_TESTFACTORYREGISTRY_H
2 #define CPPUNIT_EXTENSIONS_TESTFACTORYREGISTRY_H
3
4 #include <cppunit/Portability.h>
5
6 #if CPPUNIT_NEED_DLL_DECL
7 #pragma warning( push )
8 #pragma warning( disable: 4251) // X needs to have dll-interface to be used by clients of class Z
9 #endif
10
11 #include <cppunit/portability/CppUnitSet.h>
12 #include <cppunit/extensions/TestFactory.h>
13 #include <string>
14
15 CPPUNIT_NS_BEGIN
16
17
18 class TestSuite;
19
20 #if CPPUNIT_NEED_DLL_DECL
21 // template class CPPUNIT_API std::set<TestFactory *>;
22 #endif
23
24
80 class CPPUNIT_API TestFactoryRegistry : public TestFactory
81 {
82 public:
87 TestFactoryRegistry( std::string name );
88
90 virtual ~TestFactoryRegistry();
91
96 virtual Test *makeTest();
97
107 static TestFactoryRegistry &getRegistry( const std::string &name = "All Tests" );
108
112 void addTestToSuite( TestSuite *suite );
113
118 void registerFactory( TestFactory *factory );
119
126 void unregisterFactory( TestFactory *factory );
127
138 void addRegistry( const std::string &name );
139
153 static bool isValid();
154
160 void registerFactory( const std::string &name,
161 TestFactory *factory );
162
163 private:
164 TestFactoryRegistry( const TestFactoryRegistry &copy );
165 void operator =( const TestFactoryRegistry &copy );
166
167 private:
168 typedef CppUnitSet<TestFactory *, std::less<TestFactory*> > Factories;
169 Factories m_factories;
170
171 std::string m_name;
172 };
173
174
175 CPPUNIT_NS_END
176
177 #if CPPUNIT_NEED_DLL_DECL
178 #pragma warning( pop )
179 #endif
180
181
182 #endif // CPPUNIT_EXTENSIONS_TESTFACTORYREGISTRY_H
Portability.h
Test
Base class for all test objects.All test objects should be a subclass of Test. Some test objects...
Definition: Test.h:25
TestFactoryRegistry::m_name
std::string m_name
Definition: TestFactoryRegistry.h:171
TestFactoryRegistry::m_factories
Factories m_factories
Definition: TestFactoryRegistry.h:169
CppUnitSet.h
TestFactoryRegistry::Factories
CppUnitSet< TestFactory *, std::less< TestFactory * > > Factories
Definition: TestFactoryRegistry.h:168
CPPUNIT_NS_END
#define CPPUNIT_NS_END
Definition: Portability.h:120
CPPUNIT_NS_BEGIN
#define CPPUNIT_NS_BEGIN
Definition: Portability.h:119
TestFactory::makeTest
virtual Test * makeTest()=0
TestFactoryRegistry
Registry for TestFactory.Notes that the registry DON&#39;T assumes lifetime control for any registered te...
Definition: TestFactoryRegistry.h:80
TestFactory
Abstract Test factory.
Definition: TestFactory.h:13
TestSuite
A Composite of Tests.It runs a collection of test cases. Here is an example.
Definition: TestSuite.h:40
CPPUNIT_API
#define CPPUNIT_API
Definition: CppUnitApi.h:27
TestFactory.h

| Send comments to: CppUnit Developers