|
Packit |
8c9aa0 |
#ifndef CPPUNIT_TESTSUITE_H // -*- C++ -*-
|
|
Packit |
8c9aa0 |
#define CPPUNIT_TESTSUITE_H
|
|
Packit |
8c9aa0 |
|
|
Packit |
8c9aa0 |
#include <cppunit/Portability.h>
|
|
Packit |
8c9aa0 |
|
|
Packit |
8c9aa0 |
#if CPPUNIT_NEED_DLL_DECL
|
|
Packit |
8c9aa0 |
#pragma warning( push )
|
|
Packit |
8c9aa0 |
#pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z
|
|
Packit |
8c9aa0 |
#endif
|
|
Packit |
8c9aa0 |
|
|
Packit |
8c9aa0 |
#include <cppunit/TestComposite.h>
|
|
Packit |
8c9aa0 |
#include <vector>
|
|
Packit |
8c9aa0 |
|
|
Packit |
8c9aa0 |
CPPUNIT_NS_BEGIN
|
|
Packit |
8c9aa0 |
|
|
Packit |
8c9aa0 |
|
|
Packit |
8c9aa0 |
#if CPPUNIT_NEED_DLL_DECL
|
|
Packit |
8c9aa0 |
// template class CPPUNIT_API std::vector<Test *>;
|
|
Packit |
8c9aa0 |
#endif
|
|
Packit |
8c9aa0 |
|
|
Packit |
8c9aa0 |
|
|
Packit |
8c9aa0 |
/*! \brief A Composite of Tests.
|
|
Packit |
8c9aa0 |
* \ingroup CreatingTestSuite
|
|
Packit |
8c9aa0 |
*
|
|
Packit |
8c9aa0 |
* It runs a collection of test cases. Here is an example.
|
|
Packit |
8c9aa0 |
* \code
|
|
Packit |
8c9aa0 |
* CppUnit::TestSuite *suite= new CppUnit::TestSuite();
|
|
Packit |
8c9aa0 |
* suite->addTest(new CppUnit::TestCaller<MathTest> (
|
|
Packit |
8c9aa0 |
* "testAdd", testAdd));
|
|
Packit |
8c9aa0 |
* suite->addTest(new CppUnit::TestCaller<MathTest> (
|
|
Packit |
8c9aa0 |
* "testDivideByZero", testDivideByZero));
|
|
Packit |
8c9aa0 |
* \endcode
|
|
Packit |
8c9aa0 |
* Note that \link TestSuite TestSuites \endlink assume lifetime
|
|
Packit |
8c9aa0 |
* control for any tests added to them.
|
|
Packit |
8c9aa0 |
*
|
|
Packit |
8c9aa0 |
* TestSuites do not register themselves in the TestRegistry.
|
|
Packit |
8c9aa0 |
* \see Test
|
|
Packit |
8c9aa0 |
* \see TestCaller
|
|
Packit |
8c9aa0 |
*/
|
|
Packit |
8c9aa0 |
class CPPUNIT_API TestSuite : public TestComposite
|
|
Packit |
8c9aa0 |
{
|
|
Packit |
8c9aa0 |
public:
|
|
Packit |
8c9aa0 |
/*! Constructs a test suite with the specified name.
|
|
Packit |
8c9aa0 |
*/
|
|
Packit |
8c9aa0 |
TestSuite( std::string name = "" );
|
|
Packit |
8c9aa0 |
|
|
Packit |
8c9aa0 |
~TestSuite();
|
|
Packit |
8c9aa0 |
|
|
Packit |
8c9aa0 |
/*! Adds the specified test to the suite.
|
|
Packit |
8c9aa0 |
* \param test Test to add. Must not be \c NULL.
|
|
Packit |
8c9aa0 |
*/
|
|
Packit |
8c9aa0 |
void addTest( Test *test );
|
|
Packit |
8c9aa0 |
|
|
Packit |
8c9aa0 |
/*! Returns the list of the tests (DEPRECATED).
|
|
Packit |
8c9aa0 |
* \deprecated Use getChildTestCount() & getChildTestAt() of the
|
|
Packit |
8c9aa0 |
* TestComposite interface instead.
|
|
Packit |
8c9aa0 |
* \return Reference on a vector that contains the tests of the suite.
|
|
Packit |
8c9aa0 |
*/
|
|
Packit |
8c9aa0 |
const std::vector<Test *> &getTests() const;
|
|
Packit |
8c9aa0 |
|
|
Packit |
8c9aa0 |
/*! Destroys all the tests of the suite.
|
|
Packit |
8c9aa0 |
*/
|
|
Packit |
8c9aa0 |
virtual void deleteContents();
|
|
Packit |
8c9aa0 |
|
|
Packit |
8c9aa0 |
int getChildTestCount() const;
|
|
Packit |
8c9aa0 |
|
|
Packit |
8c9aa0 |
Test *doGetChildTestAt( int index ) const;
|
|
Packit |
8c9aa0 |
|
|
Packit |
8c9aa0 |
private:
|
|
Packit |
8c9aa0 |
std::vector<Test *> m_tests;
|
|
Packit |
8c9aa0 |
};
|
|
Packit |
8c9aa0 |
|
|
Packit |
8c9aa0 |
|
|
Packit |
8c9aa0 |
CPPUNIT_NS_END
|
|
Packit |
8c9aa0 |
|
|
Packit |
8c9aa0 |
#if CPPUNIT_NEED_DLL_DECL
|
|
Packit |
8c9aa0 |
#pragma warning( pop )
|
|
Packit |
8c9aa0 |
#endif
|
|
Packit |
8c9aa0 |
|
|
Packit |
8c9aa0 |
#endif // CPPUNIT_TESTSUITE_H
|