Changeset 477 for library/tests/unittest-cpp/TestReporterStdout.cpp
- Timestamp:
- 08/05/09 14:40:03 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/tests/unittest-cpp/TestReporterStdout.cpp
r456 r477 6 6 // cstdio doesn't pull in namespace std on VC6, so we do it here. 7 7 #if defined(_MSC_VER) && (_MSC_VER == 1200) 8 8 namespace std {} 9 9 #endif 10 10 11 11 namespace UnitTest { 12 12 13 void TestReporterStdout::ReportFailure(TestDetails const& details, char const* failure) 14 { 13 void TestReporterStdout::ReportFailure ( TestDetails const& details, char const* failure ) { 15 14 #if defined(__APPLE__) || defined(__GNUG__) 16 15 char const* const errorFormat = "%s:%d: error: Failure in %s: %s\n"; 17 16 #else 18 17 char const* const errorFormat = "%s(%d): error: Failure in %s: %s\n"; 19 18 #endif 20 19 21 20 using namespace std; 22 21 23 if (details.useFilename) {24 25 printf(errorFormat, details.filename, details.lineNumber, details.testName, failure);26 } else { 27 28 // (custom) test location info29 printf("%s\n", failure);30 22 if ( details.useFilename ) { 23 // standard way 24 printf ( errorFormat, details.filename, details.lineNumber, details.testName, failure ); 25 } else { 26 // extended for BDM - the failure string already includes 27 // (custom) test location info 28 printf ( "%s\n", failure ); 29 } 31 30 } 32 31 33 void TestReporterStdout::ReportTestStart(TestDetails const& /*test*/) 34 { 32 void TestReporterStdout::ReportTestStart ( TestDetails const& /*test*/ ) { 35 33 } 36 34 37 void TestReporterStdout::ReportTestFinish(TestDetails const& /*test*/, float) 38 { 35 void TestReporterStdout::ReportTestFinish ( TestDetails const& /*test*/, float ) { 39 36 } 40 37 41 void TestReporterStdout::ReportSummary(int const totalTestCount, int const failedTestCount, 42 int const failureCount, float secondsElapsed) 43 { 38 void TestReporterStdout::ReportSummary ( int const totalTestCount, int const failedTestCount, 39 int const failureCount, float secondsElapsed ) { 44 40 using namespace std; 45 41 46 if (failureCount > 0)47 printf("FAILURE: %d out of %d tests failed (%d failures).\n", failedTestCount, totalTestCount, failureCount);48 49 printf("Success: %d tests passed.\n", totalTestCount);42 if ( failureCount > 0 ) 43 printf ( "FAILURE: %d out of %d tests failed (%d failures).\n", failedTestCount, totalTestCount, failureCount ); 44 else 45 printf ( "Success: %d tests passed.\n", totalTestCount ); 50 46 51 printf("Test time: %.2f seconds.\n", secondsElapsed);47 printf ( "Test time: %.2f seconds.\n", secondsElapsed ); 52 48 } 53 49