From 0b84414bdde53b367bc28563a6936513c4d3b50c Mon Sep 17 00:00:00 2001 From: c Date: Sun, 28 Jan 2024 22:58:01 -0500 Subject: Macro Hell. --- test/include/test.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'test/include') diff --git a/test/include/test.h b/test/include/test.h index 8cde34d..7366aa2 100644 --- a/test/include/test.h +++ b/test/include/test.h @@ -18,13 +18,17 @@ extern unsigned int TESTS_PASSED; #define ASSERT(EXPR) \ TESTS_RUN++; \ - (EXPR && ++TESTS_PASSED) ? \ - log_inf("%s:%s:%d: Assertion passed!", __FILE__, __func__, __LINE__) : \ - log_err("%s:%s:%d: Assertion failed:\n\t%s", __FILE__, __func__, __LINE__, #EXPR); + if (EXPR && ++TESTS_PASSED) { \ + LOG_INF("%s:%s:%d: Assertion passed!", __FILE__, __func__, __LINE__); \ + } else { \ + LOG_ERR("%s:%s:%d: Assertion failed:\n\t%s", __FILE__, __func__, __LINE__, #EXPR); \ + } #define TEST_REPORT \ - (TESTS_RUN == TESTS_PASSED) ? \ - log_yay("%s: All %d tests passed!", __FILE__, TESTS_RUN) : \ - log_err("%d/%d tests failed.", TESTS_RUN - TESTS_PASSED, TESTS_RUN); + if (TESTS_RUN == TESTS_PASSED) { \ + LOG_YAY("%s: All %d tests passed!", __FILE__, TESTS_RUN); \ + } else { \ + LOG_ERR("%d/%d tests failed.", TESTS_RUN - TESTS_PASSED, TESTS_RUN); \ + } #endif -- cgit v1.2.3