1//
2// TestSuite.cpp
3//
4
5
6#include "Poco/CppUnit/TestSuite.h"
7#include "Poco/CppUnit/TestResult.h"
8
9
10namespace CppUnit {
11
12
13// Deletes all tests in the suite.
14void TestSuite::deleteContents()
15{
16 for (std::vector<Test*>::iterator it = _tests.begin(); it != _tests.end(); ++it)
17 delete *it;
18}
19
20
21// Runs the tests and collects their result in a TestResult.
22void TestSuite::run(TestResult *result)
23{
24 for (std::vector<Test*>::iterator it = _tests.begin(); it != _tests.end(); ++it)
25 {
26 if (result->shouldStop ())
27 break;
28
29 Test *test = *it;
30 test->run(result);
31 }
32}
33
34
35// Counts the number of test cases that will be run by this test.
36int TestSuite::countTestCases()
37{
38 int count = 0;
39
40 for (std::vector<Test*>::iterator it = _tests.begin (); it != _tests.end (); ++it)
41 count += (*it)->countTestCases();
42
43 return count;
44}
45
46
47} // namespace CppUnit
48