Revision 706, 1.1 kB
(checked in by smidl, 15 years ago)
|
eol-native
|
-
Property svn:eol-style set to
native
|
Rev | Line | |
---|
[418] | 1 | #include "TestResults.h" |
---|
| 2 | #include "TestReporter.h" |
---|
| 3 | |
---|
| 4 | #include "TestDetails.h" |
---|
| 5 | |
---|
| 6 | namespace UnitTest { |
---|
| 7 | |
---|
[477] | 8 | TestResults::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] | 16 | void 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] | 23 | void 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] | 34 | void TestResults::OnTestFinish ( TestDetails const& test, float secondsElapsed ) { |
---|
| 35 | if ( m_testReporter ) |
---|
| 36 | m_testReporter->ReportTestFinish ( test, secondsElapsed ); |
---|
[418] | 37 | } |
---|
| 38 | |
---|
[477] | 39 | int TestResults::GetTotalTestCount() const { |
---|
| 40 | return m_totalTestCount; |
---|
[418] | 41 | } |
---|
| 42 | |
---|
[477] | 43 | int TestResults::GetFailedTestCount() const { |
---|
| 44 | return m_failedTestCount; |
---|
[418] | 45 | } |
---|
| 46 | |
---|
[477] | 47 | int TestResults::GetFailureCount() const { |
---|
| 48 | return m_failureCount; |
---|
[418] | 49 | } |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | } |
---|