1#ifndef CPPUNIT_TESTSUITE_H // -*- C++ -*- 2#define CPPUNIT_TESTSUITE_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/Test.h> 12#include <vector> 13#include <string> 14 15using std::string; 16using std::vector; 17 18namespace CppUnit { 19 20class TestResult; 21 22#if CPPUNIT_NEED_DLL_DECL 23 template class CPPUNIT_API vector<Test *>; 24#endif 25 26 27/*! \brief A Composite of Tests. 28 * \ingroup CreatingTestSuite 29 * 30 * It runs a collection of test cases. Here is an example. 31 * \code 32 * CppUnit::TestSuite *suite= new CppUnit::TestSuite(); 33 * suite->addTest(new CppUnit::TestCaller<MathTest> ( 34 * "testAdd", testAdd)); 35 * suite->addTest(new CppUnit::TestCaller<MathTest> ( 36 * "testDivideByZero", testDivideByZero)); 37 * \endcode 38 * Note that TestSuites assume lifetime 39 * control for any tests added to them. 40 * 41 * TestSuites do not register themselves in the TestRegistry. 42 * \see Test 43 * \see TestCaller 44 */ 45 46 47class CPPUNIT_API TestSuite : public Test 48{ 49public: 50 TestSuite( string name = "" ); 51 ~TestSuite(); 52 53 void run( TestResult *result ); 54 int countTestCases() const; 55 string getName() const; 56 string toString() const; 57 58 void addTest( Test *test ); 59 const vector<Test *> &getTests() const; 60 61 virtual void deleteContents(); 62 63private: 64 TestSuite( const TestSuite &other ); 65 TestSuite &operator =( const TestSuite &other ); 66 67private: 68 vector<Test *> m_tests; 69 const string m_name; 70}; 71 72 73} // namespace CppUnit 74 75 76#if CPPUNIT_NEED_DLL_DECL 77#pragma warning( pop ) 78#endif 79 80#endif // CPPUNIT_TESTSUITE_H 81