diff options
| author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2002-03-24 18:39:55 +0000 |
|---|---|---|
| committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2002-03-24 18:39:55 +0000 |
| commit | c37e0491c761f8b8499163bf7e748ea1afcf9203 (patch) | |
| tree | e299faf6dc3d4f5c54493a82218f9450ddb091b7 /src/cppunit/TestSuite.cpp | |
| parent | e13f6632c91fdd1a866800392f4fb12c238d14ba (diff) | |
| download | cppunit-c37e0491c761f8b8499163bf7e748ea1afcf9203.tar.gz | |
INSTALL-WIN32.
INSTALL-WIN32.txt: added some info to build cppunit as a DLL.
* include/cppunit/config-msvc6.h: added definition of macro CPPUNIT_API when
building or linking DLL. Defined CPPUNIT_BUILD_DLL when building, and
CPPUNIT_DLL when linking.
* include/cppunit/Portability.h: added empty definition of macro CPPUNIT_API
when not building or using CppUnit as a DLL. When any of those symbol is defined,
the symbol CPPUNIT_NEED_DLL_DECL is set to 1.
* include/cppunit/extensions/RepeatedTest.h:
* include/cppunit/extensions/TestDecorator.h:
* include/cppunit/extensions/TestSetUp.h:
* include/cppunit/TestCaller.h
* include/cppunit/extensions/TestFactory.h
* include/cppunit/extensions/TestFactoryRegistry.h
* include/cppunit/extensions/TypeInfoHelper.h
* include/cppunit/Asserter.h
* include/cppunit/Exception.h
* include/cppunit/NotEqualException.h
* include/cppunit/SourceLine.h
* include/cppunit/SynchronizedObject.h
* include/cppunit/Test.h
* include/cppunit/TestAssert.h
* include/cppunit/TestCase.h
* include/cppunit/TestFailure.h
* include/cppunit/TestListener.h
* include/cppunit/TestResult.h
* include/cppunit/TestSuite.h
* include/cppunit/CompilerOutputter.h
* include/cppunit/Outputter.h
* include/cppunit/TestResultCollector.h
* include/cppunit/TestSuccessListener.h
* include/cppunit/TextOutputter.h
* include/cppunit/TextTestProgressListener.h
* include/cppunit/TextTestResult.h
* include/cppunit/TextTestRunner.h
* include/cppunit/XmlOutputter.h: added CPPUNIT_API for DLL export.
* include/cppunit/TestSuite.h:
* src/cppunit/TestSuite.cpp: reindented
* include/cppunit/extensions/TestSetUp.h:
* src/cppunit/TestSetUp.cpp: added .cpp. extracted inline method and moved them
to cpp file.
Diffstat (limited to 'src/cppunit/TestSuite.cpp')
| -rw-r--r-- | src/cppunit/TestSuite.cpp | 91 |
1 files changed, 50 insertions, 41 deletions
diff --git a/src/cppunit/TestSuite.cpp b/src/cppunit/TestSuite.cpp index 33ea2ce..7659939 100644 --- a/src/cppunit/TestSuite.cpp +++ b/src/cppunit/TestSuite.cpp @@ -3,85 +3,94 @@ namespace CppUnit { +/// Default constructor +TestSuite::TestSuite( std::string name ) + : m_name( name ) +{ +} + + +/// Destructor +TestSuite::~TestSuite() +{ + deleteContents(); +} + + /// Deletes all tests in the suite. -void TestSuite::deleteContents () +void +TestSuite::deleteContents() { - for (std::vector<Test *>::iterator it = m_tests.begin (); - it != m_tests.end (); - ++it) + for ( std::vector<Test *>::iterator it = m_tests.begin(); + it != m_tests.end(); + ++it) delete *it; m_tests.clear(); } + /// Runs the tests and collects their result in a TestResult. -void TestSuite::run (TestResult *result) +void +TestSuite::run( TestResult *result ) { - for (std::vector<Test *>::iterator it = m_tests.begin (); - it != m_tests.end (); - ++it) { - if (result->shouldStop ()) - break; - - Test *test = *it; - test->run (result); - } - + for ( std::vector<Test *>::iterator it = m_tests.begin(); + it != m_tests.end(); + ++it ) + { + if ( result->shouldStop() ) + break; + + Test *test = *it; + test->run( result ); + } } /// Counts the number of test cases that will be run by this test. -int TestSuite::countTestCases () const +int +TestSuite::countTestCases() const { - int count = 0; + int count = 0; - for (std::vector<Test *>::const_iterator it = m_tests.begin (); - it != m_tests.end (); - ++it) - count += (*it)->countTestCases (); - - return count; + for ( std::vector<Test *>::const_iterator it = m_tests.begin(); + it != m_tests.end(); + ++it ) + count += (*it)->countTestCases(); + return count; } -/// Default constructor -TestSuite::TestSuite (std::string name) - : m_name (name) -{ -} - -/// Destructor -TestSuite::~TestSuite () -{ - deleteContents (); -} /// Adds a test to the suite. void - TestSuite::addTest (Test *test) +TestSuite::addTest( Test *test ) { - m_tests.push_back (test); + m_tests.push_back( test ); } /// Returns a string representation of the test suite. std::string - TestSuite::toString () const +TestSuite::toString() const { - return "suite " + getName(); + return "suite " + getName(); } + /// Returns the name of the test suite. std::string - TestSuite::getName () const +TestSuite::getName() const { return m_name; } -const std::vector<Test *>& - TestSuite::getTests () const + +const std::vector<Test *> & +TestSuite::getTests() const { return m_tests; } + } // namespace CppUnit |
