blob: 51db1417e4f17a796b300b4427b7ed13f40e5447 (
plain)
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
|
#include "TestRunner.h"
#include "TestLauncher.h"
#include "TestResults.h"
#include "Test.h"
#include "PrintfTestReporter.h"
namespace CppTestHarness
{
TestRunner::TestRunner()
: m_testLauncherListHead(TestLauncher::GetHeadAddr())
, m_testReporter(&m_defaultTestReporter)
{
}
TestRunner::~TestRunner()
{
}
void TestRunner::SetTestLauncherListHead(TestLauncher** listHead)
{
m_testLauncherListHead = listHead;
}
void TestRunner::SetTestReporter(TestReporter* testReporter)
{
m_testReporter = testReporter;
}
int TestRunner::RunAllTests()
{
int failureCount = 0;
int testCount = 0;
TestLauncher const* curLauncher = *m_testLauncherListHead;
while (curLauncher)
{
++testCount;
TestResults result(*m_testReporter);
curLauncher->Launch(result);
if (result.Failed())
++failureCount;
curLauncher = curLauncher->GetNext();
}
m_testReporter->ReportSummary(testCount, failureCount);
return failureCount;
}
}
|