commit 930df5aa860db3a95d4083d819c300e2b74ed4c6
parent 3bcef5430d26d1755d42a8371cabf7a198d01d17
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date: Thu, 21 Mar 2013 10:18:41 -0700
tests: Colour output
Diffstat:
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/tests/test.cc b/tests/test.cc
@@ -29,11 +29,13 @@ int main()
test_audio_read();
test_utils();
- std::cerr << g_passes << "/" << g_total << " tests passed" << std::endl;
- std::cerr << "-------------" << std::endl;
if (g_passes < g_total) {
+ std::cerr << "\x1b[31;1m" << (g_total - g_passes) << "/" << g_total;
+ std::cerr << " tests failed" << "\x1b[0m" << std::endl;
return -1;
} else {
+ std::cerr << "\x1b[32;1m" << g_passes << "/" << g_total;
+ std::cerr << " tests passed" << "\x1b[0m" << std::endl;
return 0;
}
}
diff --git a/tests/test.h b/tests/test.h
@@ -45,9 +45,9 @@ template<class T> void test(const std::string& message, const T& expected, const
if (equal(expected, actual)) {
g_passes++;
} else {
- std::cerr << "FAIL: " << message;
- std::cerr << ", expected: " << expected;
- std::cerr << ", actual: " << actual << std::endl;
+ std::cerr << "\x1b[31;1mFAIL:\x1b[0m " << message;
+ std::cerr << ", expected: " << "\x1b[32;1m" << expected << "\x1b[0m";
+ std::cerr << ", actual: " << "\x1b[31;1m" << actual << "\x1b[0m" << std::endl;
}
}