aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ode-0.9/tests/CppTestHarness/TestRunner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ode-0.9/tests/CppTestHarness/TestRunner.cpp')
-rw-r--r--libraries/ode-0.9/tests/CppTestHarness/TestRunner.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/libraries/ode-0.9/tests/CppTestHarness/TestRunner.cpp b/libraries/ode-0.9/tests/CppTestHarness/TestRunner.cpp
new file mode 100644
index 0000000..51db141
--- /dev/null
+++ b/libraries/ode-0.9/tests/CppTestHarness/TestRunner.cpp
@@ -0,0 +1,56 @@
1#include "TestRunner.h"
2#include "TestLauncher.h"
3#include "TestResults.h"
4#include "Test.h"
5
6#include "PrintfTestReporter.h"
7
8namespace CppTestHarness
9{
10
11TestRunner::TestRunner()
12 : m_testLauncherListHead(TestLauncher::GetHeadAddr())
13 , m_testReporter(&m_defaultTestReporter)
14{
15}
16
17TestRunner::~TestRunner()
18{
19}
20
21void TestRunner::SetTestLauncherListHead(TestLauncher** listHead)
22{
23 m_testLauncherListHead = listHead;
24}
25
26void TestRunner::SetTestReporter(TestReporter* testReporter)
27{
28 m_testReporter = testReporter;
29}
30
31int TestRunner::RunAllTests()
32{
33 int failureCount = 0;
34
35 int testCount = 0;
36 TestLauncher const* curLauncher = *m_testLauncherListHead;
37 while (curLauncher)
38 {
39 ++testCount;
40
41 TestResults result(*m_testReporter);
42 curLauncher->Launch(result);
43
44 if (result.Failed())
45 ++failureCount;
46
47 curLauncher = curLauncher->GetNext();
48 }
49
50 m_testReporter->ReportSummary(testCount, failureCount);
51
52 return failureCount;
53}
54
55}
56