Skip to content

Commit bcd7cf6

Browse files
Added more comments
1 parent de0f516 commit bcd7cf6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/common/test_helpers.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,12 @@ static inline bool UT_LOG_ERR(const char *format, ...) {
5050

5151
fprintf(stderr, "\n");
5252

53+
// For lazy evaluation in GTEST_OUT_*
5354
return false;
5455
}
5556

57+
// Assertions which does not impact the program execution
58+
// Formatting is intended to resemble GTEST assertions outputs
5659
#define GTEST_OUT_EQ(lhs, rhs) \
5760
((bool)(((lhs) == (rhs)) || \
5861
(UT_LOG_ERR("%s:%d %s - assertion failure\nExpected: %s == %s, actual: (0x%llx) vs (0x%llx)" \
@@ -64,13 +67,13 @@ static inline bool UT_LOG_ERR(const char *format, ...) {
6467

6568
#define GTEST_OUT_NE(lhs, rhs) \
6669
((bool)(((lhs) != (rhs)) || \
67-
(UT_LOG_ERR("%s:%d %s - assertion failure\nExpected: %s != %s, actual: %llx vs %llx" \
70+
(UT_LOG_ERR("%s:%d %s - assertion failure\nExpected: %s != %s, actual: (0x%llx) vs (0x%llx)" \
6871
, \
6972
__FILE__, __LINE__, __func__, #lhs, \
7073
#rhs, (unsigned long long)(lhs), \
7174
(unsigned long long)(rhs)), \
7275
0)))
73-
76+
7477
// Assert a condition is true at runtime
7578
#define UT_ASSERT(cnd) \
7679
((void)((cnd) || (UT_FATAL("%s:%d %s - assertion failure: %s", __FILE__, \

0 commit comments

Comments
 (0)