summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tests/hs_tests.h7
-rw-r--r--src/tests/tests_main.c20
2 files changed, 14 insertions, 13 deletions
diff --git a/src/tests/hs_tests.h b/src/tests/hs_tests.h
index e619f7c..3e1c98e 100644
--- a/src/tests/hs_tests.h
+++ b/src/tests/hs_tests.h
@@ -33,9 +33,12 @@
tests_failed++; \
} \
} while (0)
-#define mu_suite_start() tests_run_old = tests_run;
-#define mu_suite_finish() printf(mu_indent "ran %d tests\n", tests_run - tests_run_old);
#define TEST(name) static const char* name(lua_State *L)
+#define mu_run_suite(suite) do { \
+ tests_run_old = tests_run; \
+ suite(); \
+ printf(mu_indent "ran %d tests\n", tests_run - tests_run_old); \
+ } while (0)
extern int tests_run, tests_run_old, tests_failed;
diff --git a/src/tests/tests_main.c b/src/tests/tests_main.c
index 84de599..9a871c1 100644
--- a/src/tests/tests_main.c
+++ b/src/tests/tests_main.c
@@ -15,17 +15,15 @@ int main()
{
printf("================ start tests ================\n\n");
- hs_type_to_string_tests();
- hs_parse_args_tests();
- hs_parse_overloaded_tests();
-
- hs_create_table_tests();
- hs_create_enum_tests();
-
- hs_process_table_tests();
-
- hs_pushstring_tests();
-
+ mu_run_suite(hs_type_to_string_tests);
+ mu_run_suite(hs_parse_args_tests);
+ mu_run_suite(hs_parse_overloaded_tests);
+ mu_run_suite(hs_create_table_tests);
+ mu_run_suite(hs_create_enum_tests);
+ mu_run_suite(hs_process_table_tests);
+
+ mu_run_suite(hs_pushstring_tests);
+
printf("\n=============== tests finished ===============\n\n");
const char *color = tests_failed == 0 ? GREEN : RED;