root/library/tests/unittest-cpp/TestReporterStdout.cpp @ 418

Revision 418, 1.3 kB (checked in by vbarta, 15 years ago)

#27: added UnitTest?++ to bdm sources, changed test_user_data to use it

Line 
1#include "TestReporterStdout.h"
2#include <cstdio>
3
4#include "TestDetails.h"
5
6// cstdio doesn't pull in namespace std on VC6, so we do it here.
7#if defined(_MSC_VER) && (_MSC_VER == 1200)
8        namespace std {}
9#endif
10
11namespace UnitTest {
12
13void TestReporterStdout::ReportFailure(TestDetails const& details, char const* failure)
14{
15#if defined(__APPLE__) || defined(__GNUG__)
16    char const* const errorFormat = "%s:%d: error: Failure in %s: %s\n";
17#else
18    char const* const errorFormat = "%s(%d): error: Failure in %s: %s\n";
19#endif
20
21        using namespace std;
22    printf(errorFormat, details.filename, details.lineNumber, details.testName, failure);
23}
24
25void TestReporterStdout::ReportTestStart(TestDetails const& /*test*/)
26{
27}
28
29void TestReporterStdout::ReportTestFinish(TestDetails const& /*test*/, float)
30{
31}
32
33void TestReporterStdout::ReportSummary(int const totalTestCount, int const failedTestCount,
34                                       int const failureCount, float secondsElapsed)
35{
36        using namespace std;
37
38    if (failureCount > 0)
39        printf("FAILURE: %d out of %d tests failed (%d failures).\n", failedTestCount, totalTestCount, failureCount);
40    else
41        printf("Success: %d tests passed.\n", totalTestCount);
42
43    printf("Test time: %.2f seconds.\n", secondsElapsed);
44}
45
46}
Note: See TracBrowser for help on using the browser.