From cd1e69e13d8dc1df57b5f371edc3f23ceb9bafc1 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov <0x7fffff@guattari.ru> Date: Mon, 8 Aug 2022 02:50:03 +0400 Subject: Add tests --- source/kit_test/test.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'source/kit_test/test.h') diff --git a/source/kit_test/test.h b/source/kit_test/test.h index fdbfbdc..4dc7aac 100644 --- a/source/kit_test/test.h +++ b/source/kit_test/test.h @@ -79,20 +79,17 @@ extern kit_tests_list_t kit_tests_list; # endif #endif +void kit_test_register(char const *name, kit_test_run_fn fn); + #define KIT_TEST(name) \ static void KIT_TEST_CONCAT3_(kit_test_run_, __LINE__, \ KIT_TEST_FILE)(int, \ kit_test_report_fn); \ KIT_TEST_ON_START_( \ KIT_TEST_CONCAT3_(kit_test_case_, __LINE__, KIT_TEST_FILE)) { \ - int n = kit_tests_list.size; \ - if (n < KIT_TESTS_SIZE_LIMIT) { \ - kit_tests_list.size++; \ - kit_tests_list.tests[n].test_fn = KIT_TEST_CONCAT3_( \ - kit_test_run_, __LINE__, KIT_TEST_FILE); \ - strcpy(kit_tests_list.tests[n].test_name, name); \ - kit_tests_list.tests[n].assertions = 0; \ - } \ + kit_test_register( \ + name, \ + KIT_TEST_CONCAT3_(kit_test_run_, __LINE__, KIT_TEST_FILE)); \ } \ static void KIT_TEST_CONCAT3_(kit_test_run_, __LINE__, \ KIT_TEST_FILE)( \ @@ -108,6 +105,7 @@ int kit_run_tests(int argc, char **argv); # define TEST KIT_TEST # define REQUIRE KIT_REQUIRE +# define test_register kit_test_register # define run_tests kit_run_tests #endif -- cgit v1.2.3