Skip to content

Commit f27660b

Browse files
Created message GTEST_OUT_EQ and GTEST_OUT_NE
1 parent e3238c6 commit f27660b

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

test/common/test_helpers.h

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,24 @@ static inline bool UT_LOG_ERR(const char *format, ...) {
5353
return false;
5454
}
5555

56-
#define GTEST_OUT(cnd) ((bool)((cnd) || (UT_LOG_ERR("%s:%d %s - assertion failure\nExpected: %s", __FILE__, \
57-
__LINE__, __func__, #cnd), \
58-
0)))
56+
#define GTEST_OUT_EQ(lhs, rhs) \
57+
((bool)(((lhs) == (rhs)) || \
58+
(UT_LOG_ERR("%s:%d %s - assertion failure\n\
59+
Expected: %s == %s, actual: (0x%llx) vs (0x%llx)" \
60+
, \
61+
__FILE__, __LINE__, __func__, #lhs, \
62+
#rhs, (unsigned long long)(lhs), \
63+
(unsigned long long)(rhs)), \
64+
0)))
65+
66+
#define GTEST_OUT_NE(lhs, rhs) \
67+
((bool)(((lhs) != (rhs)) || \
68+
(UT_LOG_ERR("%s:%d %s - assertion failure\nExpected: %s != %s, actual: %llx vs %llx" \
69+
, \
70+
__FILE__, __LINE__, __func__, #lhs, \
71+
#rhs, (unsigned long long)(lhs), \
72+
(unsigned long long)(rhs)), \
73+
0)))
5974
// Assert a condition is true at runtime
6075
#define UT_ASSERT(cnd) \
6176
((void)((cnd) || (UT_FATAL("%s:%d %s - assertion failure: %s", __FILE__, \

test/memspaces/memspace_lowest_latency.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ static bool canQueryLatency(size_t nodeId) {
3131

3232
// return false;
3333
// }
34-
if (!(GTEST_OUT(ret != 0))) {
35-
EXPECT_NE(ret, 0);
34+
if (!(GTEST_OUT_NE(ret, 0))) {
35+
// EXPECT_NE(ret, 0);
3636
return false;
3737
}
3838
ret = hwloc_topology_load(topology);

0 commit comments

Comments
 (0)