-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestRunner.cpp
More file actions
82 lines (68 loc) · 1.26 KB
/
TestRunner.cpp
File metadata and controls
82 lines (68 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "TestRunner.h"
TestRunner::TestRunner()
{
m_passedTests = 0;
m_failedTests = 0;
m_failures = 0;
}
TestRunner::~TestRunner()
{
}
void TestRunner::run()
{
// get our tests to run
TestSuite tests = getTests();
for (TestSuite::iterator it = tests.begin(); it != tests.end(); it++)
{
preTest(*it);
runTest(*it);
postTest(*it);
}
reportResults();
}
void TestRunner::preTest(TestCase* test)
{
}
void TestRunner::runTest(TestCase* test)
{
try
{
test->run();
reportPass(test);
}
catch (TestFail failure)
{
reportFail(test);
}
catch (...)
{
reportFailure(test);
}
}
void TestRunner::postTest(TestCase* test)
{
}
void TestRunner::reportPass(TestCase* test)
{
m_passedTests++;
}
void TestRunner::reportFail(TestCase* test)
{
m_failedTests++;
}
void TestRunner::reportFailure(TestCase* test)
{
m_failures++;
}
short TestRunner::getPassedTest()
{
return m_passedTests;
}
short TestRunner::getFailedTest()
{
return m_failedTests;
}
short TestRunner::getFailures()
{
return m_failures;
}