-
Notifications
You must be signed in to change notification settings - Fork 176
Expand file tree
/
Copy pathThrowingTestReporter.cpp
More file actions
61 lines (51 loc) · 1.51 KB
/
ThrowingTestReporter.cpp
File metadata and controls
61 lines (51 loc) · 1.51 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
#include "ThrowingTestReporter.h"
#include "RequiredCheckException.h"
#ifdef UNITTEST_NO_EXCEPTIONS
#include "ReportAssertImpl.h"
#endif
namespace UnitTest {
ThrowingTestReporter::ThrowingTestReporter(TestReporter* decoratedReporter)
: m_decoratedReporter(decoratedReporter)
{}
//virtual
ThrowingTestReporter::~ThrowingTestReporter()
{}
//virtual
void ThrowingTestReporter::ReportTestStart(TestDetails const& test)
{
if(m_decoratedReporter)
{
m_decoratedReporter->ReportTestStart(test);
}
}
//virtual
void ThrowingTestReporter::ReportFailure(TestDetails const& test, char const* failure)
{
if(m_decoratedReporter)
{
m_decoratedReporter->ReportFailure(test, failure);
}
#ifndef UNITTEST_NO_EXCEPTIONS
throw RequiredCheckException();
#else
static const int stopTest = 1;
UNITTEST_LONGJMP(*UnitTest::Detail::GetAssertJmpBuf(), stopTest);
#endif
}
//virtual
void ThrowingTestReporter::ReportTestFinish(TestDetails const& test, float secondsElapsed)
{
if(m_decoratedReporter)
{
m_decoratedReporter->ReportTestFinish(test, secondsElapsed);
}
}
//virtual
void ThrowingTestReporter::ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed)
{
if(m_decoratedReporter)
{
m_decoratedReporter->ReportSummary(totalTestCount, failedTestCount, failureCount, secondsElapsed);
}
}
}