unittest: fix potential name collisions

This commit is contained in:
Thomas Kolb 2025-02-22 20:57:33 +01:00
commit f896c0264e

View file

@ -4,16 +4,16 @@
#include <inttypes.h>
#define ASSERT_RESULT(expected, call) { \
result_t result = call; \
if(result != expected) { \
LOG(LVL_FATAL, "L%d: result = %i, expected = %i!", __LINE__, result, expected); \
result_t __result = call; \
if(__result != expected) { \
LOG(LVL_FATAL, "L%d: result = %i, expected = %i!", __LINE__, __result, expected); \
exit(1); \
} \
}
#define ASSERT_TRUE(call) { \
bool result = call; \
if(!result) { \
bool __result = call; \
if(!__result) { \
LOG(LVL_FATAL, "L%d: "#call" evaluates to false"); \
exit(1); \
} \
@ -22,17 +22,17 @@
#define ASSERT_FALSE(call) ASSERT_TRUE(!call)
#define ASSERT_EQUAL_INT(expected, call) { \
int64_t result = (int64_t)call; \
if(result != expected) { \
LOG(LVL_FATAL, "L%d: result = %"PRIi64", expected = %"PRIi64"!", __LINE__, result, expected); \
int64_t __result = (int64_t)call; \
if(__result != expected) { \
LOG(LVL_FATAL, "L%d: result = %"PRIi64", expected = %"PRIi64"!", __LINE__, __result, expected); \
exit(1); \
} \
}
#define ASSERT_EQUAL_UINT(expected, call) { \
uint64_t result = (uint64_t)call; \
if(result != expected) { \
LOG(LVL_FATAL, "L%d: result = %"PRIu64", expected = %"PRIu64"!", __LINE__, result, expected); \
uint64_t __result = (uint64_t)call; \
if(__result != expected) { \
LOG(LVL_FATAL, "L%d: result = %"PRIu64", expected = %"PRIu64"!", __LINE__, __result, expected); \
exit(1); \
} \
}