test: Add ASSERT_EQ_ID128() and ASSERT_NE_ID128()

This commit is contained in:
Daan De Meyer
2024-07-24 18:58:40 +02:00
parent 8eb06fd162
commit 60a4505da4
2 changed files with 37 additions and 0 deletions
+27
View File
@@ -429,3 +429,30 @@ static inline int run_test_table(void) {
abort(); \
} \
})
#define ASSERT_EQ_ID128(expr1, expr2) \
({ \
typeof(expr1) _expr1 = (expr1); \
typeof(expr2) _expr2 = (expr2); \
if (!sd_id128_equal(_expr1, _expr2)) { \
log_error("%s:%i: Assertion failed: \"%s == %s\", but \"%s != %s\"", \
PROJECT_FILE, __LINE__, \
#expr1, #expr2, \
SD_ID128_TO_STRING(_expr1), SD_ID128_TO_STRING(_expr2)); \
abort(); \
} \
})
#define ASSERT_NE_ID128(expr1, expr2) \
({ \
typeof(expr1) _expr1 = (expr1); \
typeof(expr2) _expr2 = (expr2); \
if (sd_id128_equal(_expr1, _expr2)) { \
log_error("%s:%i: Assertion failed: \"%s != %s\", but \"%s == %s\"", \
PROJECT_FILE, __LINE__, \
#expr1, #expr2, \
SD_ID128_TO_STRING(_expr1), SD_ID128_TO_STRING(_expr2)); \
abort(); \
} \
})