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

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

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