comparison ext/UnitTest++/src/TestReporterStdout.cpp @ 37:0d325e9d5953

added unittest++ files into ext. Not hooked into build scripts yet
author jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
date Sat, 12 Jul 2008 12:00:57 +0000
parents
children
comparison
equal deleted inserted replaced
36:6f1227f4932b 37:0d325e9d5953
1 #include "TestReporterStdout.h"
2 #include <cstdio>
3
4 #include "TestDetails.h"
5
6 namespace UnitTest {
7
8 void TestReporterStdout::ReportFailure(TestDetails const& details, char const* failure)
9 {
10 #ifdef __APPLE__
11 char const* const errorFormat = "%s:%d: error: Failure in %s: %s\n";
12 #else
13 char const* const errorFormat = "%s(%d): error: Failure in %s: %s\n";
14 #endif
15 std::printf(errorFormat, details.filename, details.lineNumber, details.testName, failure);
16 }
17
18 void TestReporterStdout::ReportTestStart(TestDetails const& /*test*/)
19 {
20 }
21
22 void TestReporterStdout::ReportTestFinish(TestDetails const& /*test*/, float)
23 {
24 }
25
26 void TestReporterStdout::ReportSummary(int const totalTestCount, int const failedTestCount,
27 int const failureCount, float secondsElapsed)
28 {
29 if (failureCount > 0)
30 std::printf("FAILURE: %d out of %d tests failed (%d failures).\n", failedTestCount, totalTestCount, failureCount);
31 else
32 std::printf("Success: %d tests passed.\n", totalTestCount);
33 std::printf("Test time: %.2f seconds.\n", secondsElapsed);
34 }
35
36 }