8000 ------------------------------------------------------------------------ · tobscher/unittest-cpp@d6ba794 · GitHub
[go: up one dir, main page]

Skip to content

Commit d6ba794

Browse files
committed
------------------------------------------------------------------------
r204 | cnicholson | 2008-11-15 11:08:34 -0600 (Sat, 15 Nov 2008) | 1 line fix for VC6 with native dinkumware stl, cstdio doesn't pull in std:: so we redefine it at the top of the file. yuck. ------------------------------------------------------------------------
1 parent 24216b2 commit d6ba794

File tree

1 file changed

+46
-41
lines changed

1 file changed

+46
-41
lines changed

src/TestReporterStdout.cpp

Lines changed: 46 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,46 @@
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-
#if defined(__APPLE__) || defined(__GNUG__)
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-
16-
using namespace std;
17-
printf(errorFormat, details.filename, details.lineNumber, details.testName, failure);
18-
}
19-
20-
void TestReporterStdout::ReportTestStart(TestDetails const& /*test*/)
21-
{
22-
}
23-
24-
void TestReporterStdout::ReportTestFinish(TestDetails const& /*test*/, float)
25-
{
26-
}
27-
28-
void TestReporterStdout::ReportSummary(int const totalTestCount, int const failedTestCount,
29-
int const failureCount, float secondsElapsed)
30-
{
31-
using namespace std;
32-
33-
if (failureCount > 0)
34-
printf("FAILURE: %d out of %d tests failed (%d failures).\n", failedTestCount, totalTestCount, failureCount);
35-
else
36-
printf("Success: %d tests passed.\n", totalTestCount);
37-
38-
printf("Test time: %.2f seconds.\n", secondsElapsed);
39-
}
40-
41-
}
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+
11+
namespace UnitTest {
12+
13+
void 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+
25+
void TestReporterStdout::ReportTestStart(TestDetails const& /*test*/)
26+
{
27+
}
28+
29+
void TestReporterStdout::ReportTestFinish(TestDetails const& /*test*/, float)
30+
{
31+
}
32+
33+
void 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+
}

0 commit comments

Comments
 (0)
0