diff --git a/test/correctness/misc/override_parameters.cpp b/test/correctness/misc/override_parameters.cpp index 4283c039..535d9286 100644 --- a/test/correctness/misc/override_parameters.cpp +++ b/test/correctness/misc/override_parameters.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include "utilities/utilities.hpp" #include "test/routines/level3/xgemm.hpp" @@ -120,9 +121,9 @@ size_t RunOverrideTests(int argc, char *argv[], const bool silent, const std::st } // Prints and returns the statistics - fprintf(stdout, " %zu test(s) passed\n", passed); - fprintf(stdout, " %zu test(s) failed\n", errors); - fprintf(stdout, "\n"); + std::cout << " " << passed << " test(s) passed" << std::endl; + std::cout << " " << errors << " test(s) failed" << std::endl; + std::cout << std::endl; return errors; } diff --git a/test/correctness/testblas.cpp b/test/correctness/testblas.cpp index edd9d4ea..659131c5 100644 --- a/test/correctness/testblas.cpp +++ b/test/correctness/testblas.cpp @@ -198,12 +198,12 @@ void TestBlas::TestRegular(std::vector> &test_vector, const st if (!TestSimilarity(result1[index], result2[index])) { if (l2error >= kErrorMarginL2) { errors++; } if (verbose_) { - if (get_id2_(args) == 1) { fprintf(stdout, "\n Error at index %zu: ", id1); } - else { fprintf(stdout, "\n Error at %zu,%zu: ", id1, id2); } - fprintf(stdout, " %s (reference) versus ", ToString(result1[index]).c_str()); - fprintf(stdout, " %s (CLBlast)", ToString(result2[index]).c_str()); + if (get_id2_(args) == 1) { std::cout << std::endl << " Error at index " << id1 << ": "; } + else { std::cout << std::endl << " Error at " << id1 << "," << id2 << ": "; } + std::cout << " " << ToString(result1[index]) << " (reference) versus "; + std::cout << " " << ToString(result2[index]) << " (CLBlast)"; if (l2error < kErrorMarginL2) { - fprintf(stdout, " - error suppressed by a low total L2 error\n"); + std::cout << " - error suppressed by a low total L2 error" << std::endl; } } } diff --git a/test/correctness/tester.cpp b/test/correctness/tester.cpp index fb85e609..700a86f7 100644 --- a/test/correctness/tester.cpp +++ b/test/correctness/tester.cpp @@ -185,14 +185,14 @@ Tester::Tester(const std::vector &arguments, const bool silent template Tester::~Tester() { if (PrecisionSupported(device_)) { - fprintf(stdout, "* Completed all test-cases for this routine. Results:\n"); - fprintf(stdout, " %zu test(s) passed\n", tests_passed_); - if (tests_skipped_ > 0) { fprintf(stdout, "%s", kPrintWarning.c_str()); } - fprintf(stdout, " %zu test(s) skipped%s\n", tests_skipped_, kPrintEnd.c_str()); - if (tests_failed_ > 0) { fprintf(stdout, "%s", kPrintError.c_str()); } - fprintf(stdout, " %zu test(s) failed%s\n", tests_failed_, kPrintEnd.c_str()); + std::cout << "* Completed all test-cases for this routine. Results:" << std::endl; + std::cout << " " << tests_passed_ << " test(s) passed" << std::endl; + if (tests_skipped_ > 0) { std::cout << kPrintWarning; } + std::cout << " " << tests_skipped_ << " test(s) skipped" << kPrintEnd << std::endl; + if (tests_failed_ > 0) { std::cout << kPrintError; } + std::cout << " " << tests_failed_ << " test(s) failed" << kPrintEnd << std::endl; } - fprintf(stdout, "\n"); + std::cout << std::endl; // Cleans-up clBLAS #ifdef CLBLAST_REF_CLBLAS @@ -238,18 +238,18 @@ void Tester::TestEnd() { // Prints a test summary auto pass_rate = 100*num_passed_ / static_cast(num_passed_ + num_skipped_ + num_failed_); fprintf(stdout, " Pass rate %s%5.1lf%%%s:", kPrintMessage.c_str(), pass_rate, kPrintEnd.c_str()); - fprintf(stdout, " %zu passed /", num_passed_); + std::cout << " " << num_passed_ << " passed /"; if (num_skipped_ != 0) { - fprintf(stdout, " %s%zu skipped%s /", kPrintWarning.c_str(), num_skipped_, kPrintEnd.c_str()); + std::cout << " " << kPrintWarning << num_skipped_ << " skipped" << kPrintEnd << " /"; } else { - fprintf(stdout, " %zu skipped /", num_skipped_); + std::cout << " " << num_skipped_ << " skipped /"; } if (num_failed_ != 0) { - fprintf(stdout, " %s%zu failed%s\n", kPrintError.c_str(), num_failed_, kPrintEnd.c_str()); + std::cout << " " << kPrintError << num_failed_ << " failed" << kPrintEnd << std::endl; } else { - fprintf(stdout, " %zu failed\n", num_failed_); + std::cout << " " << num_failed_ << " failed" << std::endl; } } diff --git a/test/correctness/tester.hpp b/test/correctness/tester.hpp index e544f776..dfbefdfd 100644 --- a/test/correctness/tester.hpp +++ b/test/correctness/tester.hpp @@ -153,20 +153,38 @@ template const size_t Tester::kResultsPerLine = si template const float Tester::kStatusError = -1.0f; // Constants holding start and end strings for terminal-output in colour -template const std::string Tester::kPrintError = "\x1b[31m"; -template const std::string Tester::kPrintSuccess = "\x1b[32m"; -template const std::string Tester::kPrintWarning = "\x1b[35m"; -template const std::string Tester::kPrintMessage = "\x1b[1m"; -template const std::string Tester::kPrintEnd = "\x1b[0m"; +#if defined(_WIN32) + template const std::string Tester::kPrintError = ""; + template const std::string Tester::kPrintSuccess = ""; + template const std::string Tester::kPrintWarning = ""; + template const std::string Tester::kPrintMessage = ""; + template const std::string Tester::kPrintEnd = ""; +#else + template const std::string Tester::kPrintError = "\x1b[31m"; + template const std::string Tester::kPrintSuccess = "\x1b[32m"; + template const std::string Tester::kPrintWarning = "\x1b[35m"; + template const std::string Tester::kPrintMessage = "\x1b[1m"; + template const std::string Tester::kPrintEnd = "\x1b[0m"; +#endif // Sets the output error coding -template const std::string Tester::kSuccessData = "\x1b[32m:\x1b[0m"; // success -template const std::string Tester::kSuccessStatus = "\x1b[32m.\x1b[0m"; // success -template const std::string Tester::kErrorData = "\x1b[31mX\x1b[0m"; // error -template const std::string Tester::kErrorStatus = "\x1b[31m/\x1b[0m"; // error -template const std::string Tester::kSkippedCompilation = "\x1b[35m\\\x1b[0m"; // warning -template const std::string Tester::kUnsupportedPrecision = "\x1b[35mo\x1b[0m"; // warning -template const std::string Tester::kUnsupportedReference = "\x1b[35m-\x1b[0m"; // warning +#if defined(_WIN32) + template const std::string Tester::kSuccessData = ":"; // success + template const std::string Tester::kSuccessStatus = "."; // success + template const std::string Tester::kErrorData = "X"; // error + template const std::string Tester::kErrorStatus = "/"; // error + template const std::string Tester::kSkippedCompilation = "\\"; // warning + template const std::string Tester::kUnsupportedPrecision = "o"; // warning + template const std::string Tester::kUnsupportedReference = "-"; // warning +#else + template const std::string Tester::kSuccessData = "\x1b[32m:\x1b[0m"; // success + template const std::string Tester::kSuccessStatus = "\x1b[32m.\x1b[0m"; // success + template const std::string Tester::kErrorData = "\x1b[31mX\x1b[0m"; // error + template const std::string Tester::kErrorStatus = "\x1b[31m/\x1b[0m"; // error + template const std::string Tester::kSkippedCompilation = "\x1b[35m\\\x1b[0m"; // warning + template const std::string Tester::kUnsupportedPrecision = "\x1b[35mo\x1b[0m"; // warning + template const std::string Tester::kUnsupportedReference = "\x1b[35m-\x1b[0m"; // warning +#endif // ================================================================================================= // Below are the non-member functions (separated because of otherwise required partial class