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

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

eol-native

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