From cf1da45b781d43fc351f6a2fcd5d8a103315ad60 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Sat, 18 Sep 2021 09:57:25 +0200 Subject: [PATCH] Test: Update macro output formatting --- test/macro.h | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/test/macro.h b/test/macro.h index adb55a9..8da47d1 100644 --- a/test/macro.h +++ b/test/macro.h @@ -1,30 +1,30 @@ #ifndef TEST_H #define TEST_H -#include // printf -#include // cout +#include // fprintf +#include // cerr -#define EXPECT(x) \ - if (!(x)) { \ - fprintf(stderr, "\033[31;1mFAIL\033[0m: %s:%d: EXPECT(%s) failed\n", \ - __FILE__, __LINE__, #x); \ - Test::TestSuite::the().currentTestCaseFailed(); \ +#define EXPECT(x) \ + if (!(x)) { \ + fprintf(stderr, " \033[31;1mFAIL:\033[0m %s:%d: EXPECT(%s) failed\n", \ + __FILE__, __LINE__, #x); \ + Test::TestSuite::the().currentTestCaseFailed(); \ } -#define EXPECT_EQ(a, b) \ - if (a != b) { \ - std::cerr << "\033[31;1mFAIL\033[0m: " << __FILE__ << ":" << __LINE__ \ - << ": EXPECT_EQ(" << #a << ", " << #b ") failed with" \ - << " lhs='" << a << "' and rhs='" << b << "'" << std::endl; \ - Test::TestSuite::the().currentTestCaseFailed(); \ +#define EXPECT_EQ(a, b) \ + if (a != b) { \ + std::cerr << " \033[31;1mFAIL:\033[0m " << __FILE__ << ":" << __LINE__ \ + << ": EXPECT_EQ(" << #a << ", " << #b ") failed with" \ + << " lhs='" << a << "' and rhs='" << b << "'" << std::endl; \ + Test::TestSuite::the().currentTestCaseFailed(); \ } -#define EXPECT_NE(a, b) \ - if (a == b) { \ - std::cerr << "\033[31;1mFAIL\033[0m: " << __FILE__ << ":" << __LINE__ \ - << ": EXPECT_NE(" << #a << ", " << #b ") failed with" \ - << " lhs='" << a << "' and rhs='" << b << "'" << std::endl; \ - Test::TestSuite::the().currentTestCaseFailed(); \ +#define EXPECT_NE(a, b) \ + if (a == b) { \ + std::cerr << " \033[31;1mFAIL:\033[0m " << __FILE__ << ":" << __LINE__ \ + << ": EXPECT_NE(" << #a << ", " << #b ") failed with" \ + << " lhs='" << a << "' and rhs='" << b << "'" << std::endl; \ + Test::TestSuite::the().currentTestCaseFailed(); \ } #endif // TEST_H