Browse Source

Test: Add "not equal" macro

master
Riyyi 3 years ago
parent
commit
d423fec3c5
  1. 11
      test/macro.h

11
test/macro.h

@ -6,7 +6,8 @@
#define EXPECT(x) \ #define EXPECT(x) \
if (!(x)) { \ if (!(x)) { \
printf("FAIL: %s:%d: EXPECT(%s) failed\n", __FILE__, __LINE__, #x); \ printf("\033[31;1mFAIL\033[0m: %s:%d: EXPECT(%s) failed\n", \
__FILE__, __LINE__, #x); \
} }
#define EXPECT_EQ(a, b) \ #define EXPECT_EQ(a, b) \
@ -17,4 +18,12 @@
Test::TestSuite::the().currentTestCaseFailed(); \ Test::TestSuite::the().currentTestCaseFailed(); \
} }
#define EXPECT_NE(a, b) \
if (a == b) { \
std::cout << "\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 #endif // TEST_H

Loading…
Cancel
Save