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

Revision 477, 1.4 kB (checked in by mido, 15 years ago)

panove, vite, jak jsem peclivej na upravu kodu.. snad se vam bude libit:) konfigurace je v souboru /system/astylerc

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)
8namespace std {}
9#endif
10
11namespace UnitTest {
12
13void TestReporterStdout::ReportFailure ( TestDetails const& details, char const* failure ) {
14#if defined(__APPLE__) || defined(__GNUG__)
15        char const* const errorFormat = "%s:%d: error: Failure in %s: %s\n";
16#else
17        char const* const errorFormat = "%s(%d): error: Failure in %s: %s\n";
18#endif
19
20        using namespace std;
21
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        }
30}
31
32void TestReporterStdout::ReportTestStart ( TestDetails const& /*test*/ ) {
33}
34
35void TestReporterStdout::ReportTestFinish ( TestDetails const& /*test*/, float ) {
36}
37
38void TestReporterStdout::ReportSummary ( int const totalTestCount, int const failedTestCount,
39        int const failureCount, float secondsElapsed ) {
40        using namespace std;
41
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 );
46
47        printf ( "Test time: %.2f seconds.\n", secondsElapsed );
48}
49
50}
Note: See TracBrowser for help on using the browser.