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 <set>
12#include <cppunit/extensions/TestFactory.h>
13#include <string>
14
15 CPPUNIT_NS_BEGIN
16
17
18class TestSuite;
19
75 class CPPUNIT_API TestFactoryRegistry : public TestFactory
76{
77public:
82 TestFactoryRegistry( std::string name );
83
85 virtual ~TestFactoryRegistry();
86
91 virtual Test *makeTest();
92
102 static TestFactoryRegistry &getRegistry( const std::string &name = "All Tests" );
103
107 void addTestToSuite( TestSuite *suite );
108
113 void registerFactory( TestFactory *factory );
114
121 void unregisterFactory( TestFactory *factory );
122
133 void addRegistry( const std::string &name );
134
148 static bool isValid();
149
155 void registerFactory( const std::string &name,
156 TestFactory *factory );
157
158private:
159 TestFactoryRegistry( const TestFactoryRegistry &copy );
160 void operator =( const TestFactoryRegistry &copy );
161
162private:
163 typedef std::set<TestFactory *, std::less<TestFactory*> > Factories;
164 Factories m_factories;
165
166 std::string m_name;
167};
168
169
170 CPPUNIT_NS_END
171
172#if CPPUNIT_NEED_DLL_DECL
173#pragma warning( pop )
174#endif
175
176
177#endif // CPPUNIT_EXTENSIONS_TESTFACTORYREGISTRY_H
CPPUNIT_API
#define CPPUNIT_API
Definition CppUnitApi.h:27
Portability.h
CPPUNIT_NS_END
#define CPPUNIT_NS_END
Definition Portability.h:106
CPPUNIT_NS_BEGIN
#define CPPUNIT_NS_BEGIN
Definition Portability.h:105
TestFactory.h
TestFactory
Abstract Test factory.
Definition TestFactory.h:14
TestFactory::makeTest
virtual Test * makeTest()=0
TestFactoryRegistry
Registry for TestFactory.
Definition TestFactoryRegistry.h:76
TestFactoryRegistry::TestFactoryRegistry
TestFactoryRegistry(const TestFactoryRegistry &copy)
TestFactoryRegistry::m_factories
Factories m_factories
Definition TestFactoryRegistry.h:164
TestFactoryRegistry::Factories
std::set< TestFactory *, std::less< TestFactory * > > Factories
Definition TestFactoryRegistry.h:163
TestFactoryRegistry::m_name
std::string m_name
Definition TestFactoryRegistry.h:166
Test
Base class for all test objects.
Definition Test.h:26
TestSuite
A Composite of Tests.
Definition TestSuite.h:41

| Send comments to: CppUnit Developers