summaryrefslogtreecommitdiff
path: root/src/cppunit/TestSuite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cppunit/TestSuite.cpp')
-rw-r--r--src/cppunit/TestSuite.cpp70
1 files changed, 18 insertions, 52 deletions
diff --git a/src/cppunit/TestSuite.cpp b/src/cppunit/TestSuite.cpp
index 7659939..ff9c88b 100644
--- a/src/cppunit/TestSuite.cpp
+++ b/src/cppunit/TestSuite.cpp
@@ -1,11 +1,11 @@
-#include "cppunit/TestSuite.h"
-#include "cppunit/TestResult.h"
+#include <cppunit/TestSuite.h>
+#include <cppunit/TestResult.h>
namespace CppUnit {
/// Default constructor
TestSuite::TestSuite( std::string name )
- : m_name( name )
+ : TestComposite( name )
{
}
@@ -21,43 +21,11 @@ TestSuite::~TestSuite()
void
TestSuite::deleteContents()
{
- 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 )
-{
- 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 count = 0;
-
- for ( std::vector<Test *>::const_iterator it = m_tests.begin();
- it != m_tests.end();
- ++it )
- count += (*it)->countTestCases();
+ int childCount = getChildTestCount();
+ for ( int index =0; index < childCount; ++index )
+ delete getChildTestAt( index );
- return count;
+ m_tests.clear();
}
@@ -69,26 +37,24 @@ TestSuite::addTest( Test *test )
}
-/// Returns a string representation of the test suite.
-std::string
-TestSuite::toString() const
-{
- return "suite " + getName();
+const std::vector<Test *> &
+TestSuite::getTests() const
+{
+ return m_tests;
}
-/// Returns the name of the test suite.
-std::string
-TestSuite::getName() const
-{
- return m_name;
+int
+TestSuite::getChildTestCount() const
+{
+ return m_tests.size();
}
-const std::vector<Test *> &
-TestSuite::getTests() const
+Test *
+TestSuite::doGetChildTestAt( int index ) const
{
- return m_tests;
+ return m_tests[index];
}