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/TestComposite.h> |
---|
12 | #include <cppunit/portability/CppUnitVector.h> |
---|
13 | |
---|
14 | CPPUNIT_NS_BEGIN |
---|
15 | |
---|
16 | |
---|
17 | #if CPPUNIT_NEED_DLL_DECL |
---|
18 | // template class CPPUNIT_API std::vector<Test *>; |
---|
19 | #endif |
---|
20 | |
---|
21 | |
---|
22 | /*! \brief A Composite of Tests. |
---|
23 | * \ingroup CreatingTestSuite |
---|
24 | * |
---|
25 | * It runs a collection of test cases. Here is an example. |
---|
26 | * \code |
---|
27 | * CppUnit::TestSuite *suite= new CppUnit::TestSuite(); |
---|
28 | * suite->addTest(new CppUnit::TestCaller<MathTest> ( |
---|
29 | * "testAdd", testAdd)); |
---|
30 | * suite->addTest(new CppUnit::TestCaller<MathTest> ( |
---|
31 | * "testDivideByZero", testDivideByZero)); |
---|
32 | * \endcode |
---|
33 | * Note that \link TestSuite TestSuites \endlink assume lifetime |
---|
34 | * control for any tests added to them. |
---|
35 | * |
---|
36 | * TestSuites do not register themselves in the TestRegistry. |
---|
37 | * \see Test |
---|
38 | * \see TestCaller |
---|
39 | */ |
---|
40 | class CPPUNIT_API TestSuite : public TestComposite |
---|
41 | { |
---|
42 | public: |
---|
43 | /*! Constructs a test suite with the specified name. |
---|
44 | */ |
---|
45 | TestSuite( std::string name = "" ); |
---|
46 | |
---|
47 | ~TestSuite(); |
---|
48 | |
---|
49 | /*! Adds the specified test to the suite. |
---|
50 | * \param test Test to add. Must not be \c NULL. |
---|
51 | */ |
---|
52 | void addTest( Test *test ); |
---|
53 | |
---|
54 | /*! Returns the list of the tests (DEPRECATED). |
---|
55 | * \deprecated Use getChildTestCount() & getChildTestAt() of the |
---|
56 | * TestComposite interface instead. |
---|
57 | * \return Reference on a vector that contains the tests of the suite. |
---|
58 | */ |
---|
59 | const CppUnitVector<Test *> &getTests() const; |
---|
60 | |
---|
61 | /*! Destroys all the tests of the suite. |
---|
62 | */ |
---|
63 | virtual void deleteContents(); |
---|
64 | |
---|
65 | int getChildTestCount() const; |
---|
66 | |
---|
67 | Test *doGetChildTestAt( int index ) const; |
---|
68 | |
---|
69 | private: |
---|
70 | CppUnitVector<Test *> m_tests; |
---|
71 | }; |
---|
72 | |
---|
73 | |
---|
74 | CPPUNIT_NS_END |
---|
75 | |
---|
76 | #if CPPUNIT_NEED_DLL_DECL |
---|
77 | #pragma warning( pop ) |
---|
78 | #endif |
---|
79 | |
---|
80 | #endif // CPPUNIT_TESTSUITE_H |
---|