root/library/tests/unittest-cpp/TestResults.cpp @ 725

Revision 706, 1.1 kB (checked in by smidl, 15 years ago)

eol-native

  • Property svn:eol-style set to native
Line 
1#include "TestResults.h"
2#include "TestReporter.h"
3
4#include "TestDetails.h"
5
6namespace UnitTest {
7
8TestResults::TestResults ( TestReporter* testReporter )
9                : m_testReporter ( testReporter )
10                , m_totalTestCount ( 0 )
11                , m_failedTestCount ( 0 )
12                , m_failureCount ( 0 )
13                , m_currentTestFailed ( false ) {
14}
15
16void TestResults::OnTestStart ( TestDetails const& test ) {
17        ++m_totalTestCount;
18        m_currentTestFailed = false;
19        if ( m_testReporter )
20                m_testReporter->ReportTestStart ( test );
21}
22
23void TestResults::OnTestFailure ( TestDetails const& test, char const* failure ) {
24        ++m_failureCount;
25        if ( !m_currentTestFailed ) {
26                ++m_failedTestCount;
27                m_currentTestFailed = true;
28        }
29
30        if ( m_testReporter )
31                m_testReporter->ReportFailure ( test, failure );
32}
33
34void TestResults::OnTestFinish ( TestDetails const& test, float secondsElapsed ) {
35        if ( m_testReporter )
36                m_testReporter->ReportTestFinish ( test, secondsElapsed );
37}
38
39int TestResults::GetTotalTestCount() const {
40        return m_totalTestCount;
41}
42
43int TestResults::GetFailedTestCount() const {
44        return m_failedTestCount;
45}
46
47int TestResults::GetFailureCount() const {
48        return m_failureCount;
49}
50
51
52}
Note: See TracBrowser for help on using the browser.