summaryrefslogtreecommitdiff
path: root/src/tests/hs_tests.h
diff options
context:
space:
mode:
authorsanine-a <sanine.not@pm.me>2021-07-02 22:02:06 -0500
committersanine-a <sanine.not@pm.me>2021-07-02 22:02:06 -0500
commit6416977ea7e2159a67fd6a9877c5e01abe2f8269 (patch)
tree84941ea147ade3eb3545048d6b7cf68b5ee29e0d /src/tests/hs_tests.h
parent8c66847bfc4a6af1ca86e916b678a6b8ce58be2f (diff)
begin refactor of tests into individual source files
Diffstat (limited to 'src/tests/hs_tests.h')
-rw-r--r--src/tests/hs_tests.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/tests/hs_tests.h b/src/tests/hs_tests.h
new file mode 100644
index 0000000..df73318
--- /dev/null
+++ b/src/tests/hs_tests.h
@@ -0,0 +1,55 @@
+#pragma once
+
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+
+#include <lua.h>
+#include <lualib.h>
+#include <lauxlib.h>
+
+#include "../honeysuckle.h"
+#include "colors.h"
+
+/* minunit testing macros modified from those at
+ www.jera.com/techinfo/jtns/jtn002.html */
+#define mu_assert(message, test) do { if (!(test)) return message; } while (0)
+#define mu_run_test(name, test) do { \
+ lua_State *L = luaL_newstate(); \
+ luaL_openlibs(L); \
+ const char *message = test(L); \
+ lua_close(L); \
+ tests_run++; \
+ if (message) { \
+ printf(RED " test '%s' failed: %s\n" RESET, name, message); \
+ tests_failed++; \
+ } \
+ } while (0)
+
+#define TEST(name) static const char* name(lua_State *L)
+
+extern int tests_run, tests_failed;
+
+void hs_type_to_string_tests();
+void hs_parse_args_tests();
+void hs_parse_overloaded_tests();
+void hs_create_table_tests();
+void hs_create_enum_tests();
+void hs_process_table_tests();
+void hs_throw_error_tests();
+void hs_traceback_tests();
+void hs_call_tests();
+void hs_call_args_tests();
+void hs_pushstring_tests();
+void hs_rxx_tests();
+
+/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * tests for hs_create_enum
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+#define check_value(string, value)
+
+