From bc53998c018b23f3fd59efa00dd7631bed762ee7 Mon Sep 17 00:00:00 2001 From: sanine-a Date: Sun, 8 Aug 2021 13:14:50 -0500 Subject: add equality test macros --- src/tests/hs_tests.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/tests/hs_tests.h b/src/tests/hs_tests.h index 3e1c98e..33285d7 100644 --- a/src/tests/hs_tests.h +++ b/src/tests/hs_tests.h @@ -22,6 +22,13 @@ if (!(test)) return message \ "\n" mu_indent " [" __FILE__ ":" STR(__LINE__) "]"; \ } while (0) +#define mu_assert_equal(a, b) mu_assert("'" #a "' is not equal to '" #b "'", (a) == (b)) +#define mu_assert_not_equal(a, b) mu_assert("'" #a "' is equal to '" #b "'", (a) != (b)) +#define mu_assert_str_equal(a, b) \ + mu_assert("'" #a "' is not equal to '" #b "'", strcmp((a), (b)) == 0) +#define mu_assert_str_not_equal(a, b) \ + mu_assert("'" #a "' is equal to '" #b "'", strcmp((a), (b)) != 0) + #define mu_run_test(name, test) do { \ lua_State *L = luaL_newstate(); \ luaL_openlibs(L); \ -- cgit v1.2.1