@@ -50,9 +50,12 @@ static inline bool UT_LOG_ERR(const char *format, ...) {
50
50
51
51
fprintf (stderr , "\n" );
52
52
53
+ // For lazy evaluation in GTEST_OUT_*
53
54
return false;
54
55
}
55
56
57
+ // Assertions which does not impact the program execution
58
+ // Formatting is intended to resemble GTEST assertions outputs
56
59
#define GTEST_OUT_EQ (lhs , rhs ) \
57
60
((bool)(((lhs) == (rhs)) || \
58
61
(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, ...) {
64
67
65
68
#define GTEST_OUT_NE (lhs , rhs ) \
66
69
((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) " \
68
71
, \
69
72
__FILE__, __LINE__, __func__, #lhs, \
70
73
#rhs, (unsigned long long)(lhs), \
71
74
(unsigned long long)(rhs)), \
72
75
0)))
73
-
76
+
74
77
// Assert a condition is true at runtime
75
78
#define UT_ASSERT (cnd ) \
76
79
((void)((cnd) || (UT_FATAL("%s:%d %s - assertion failure: %s", __FILE__, \
0 commit comments