summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorsanine-a <sanine.not@pm.me>2021-08-08 13:14:50 -0500
committersanine-a <sanine.not@pm.me>2021-08-08 13:14:50 -0500
commitbc53998c018b23f3fd59efa00dd7631bed762ee7 (patch)
treee8bb2c75e39a3d369c794450894ba7918e847c4c /src/tests
parenta0f980124f59cf405d18d8a86e6a0a1825ad03d9 (diff)
add equality test macros
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/hs_tests.h7
1 files changed, 7 insertions, 0 deletions
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); \