Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/UnitTest++/src/TestReporterStdout.cpp')
-rw-r--r--src/testing/UnitTest++/src/TestReporterStdout.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/testing/UnitTest++/src/TestReporterStdout.cpp b/src/testing/UnitTest++/src/TestReporterStdout.cpp
new file mode 100644
index 0000000..133e6fa
--- /dev/null
+++ b/src/testing/UnitTest++/src/TestReporterStdout.cpp
@@ -0,0 +1,36 @@
+#include "TestReporterStdout.h"
+#include <cstdio>
+
+#include "TestDetails.h"
+
+namespace UnitTest {
+
+void TestReporterStdout::ReportFailure(TestDetails const& details, char const* failure)
+{
+#ifdef __APPLE__
+ char const* const errorFormat = "%s:%d: error: Failure in %s: %s\n";
+#else
+ char const* const errorFormat = "%s(%d): error: Failure in %s: %s\n";
+#endif
+ std::printf(errorFormat, details.filename, details.lineNumber, details.testName, failure);
+}
+
+void TestReporterStdout::ReportTestStart(TestDetails const& /*test*/)
+{
+}
+
+void TestReporterStdout::ReportTestFinish(TestDetails const& /*test*/, float)
+{
+}
+
+void TestReporterStdout::ReportSummary(int const totalTestCount, int const failedTestCount,
+ int const failureCount, float secondsElapsed)
+{
+ if (failureCount > 0)
+ std::printf("FAILURE: %d out of %d tests failed (%d failures).\n", failedTestCount, totalTestCount, failureCount);
+ else
+ std::printf("Success: %d tests passed.\n", totalTestCount);
+ std::printf("Test time: %.2f seconds.\n", secondsElapsed);
+}
+
+}