aboutsummaryrefslogtreecommitdiff
path: root/include/kpl_test.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/kpl_test.h')
-rw-r--r--include/kpl_test.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/kpl_test.h b/include/kpl_test.h
index 70a99b2..6a423eb 100644
--- a/include/kpl_test.h
+++ b/include/kpl_test.h
@@ -29,21 +29,23 @@ typedef struct _kpl_test {
void _kpl_test_add(kpl_test *_test); // do not call outside KPL_TEST macro
-#define _KPL_TEST_FN_DEFINITION(NAME) static void NAME(__attribute__((unused)) kpl_test *_test)
+#define _KPL_TEST_FN_NAME(NAME) kpl_test_ ## NAME
+
+#define _KPL_TEST_FN_DEFINITION(NAME) static void _KPL_TEST_FN_NAME(NAME)(__attribute__((unused)) kpl_test *_test)
/*
* Each test is a static function added to the test list and tree by a static gnu constructor function
* The NAME becomes the function name _NAME becomes the constructor name, only one name can be used per file
*/
#define KPL_TEST(NAME) _KPL_TEST_FN_DEFINITION(NAME); \
-static void __attribute__((constructor)) _ ## NAME(void) { \
+static void __attribute__((constructor)) kpl_test_constructor_ ## NAME(void) { \
static kpl_test _test = { \
.tree_left = NULL, .tree_right = NULL, .tree_duplicates = NULL, \
.tree_height = KPL_TREE_TREE_HEIGHT_INIT, \
.error_line_number = KPL_TEST_ERROR_LINE_NUMBER_INIT, \
.list_next = NULL, \
.source_file = __FILE__, .name = #NAME, .error_message = NULL, \
- .test_fn = NAME \
+ .test_fn = _KPL_TEST_FN_NAME(NAME) \
}; \
_kpl_test_add(&_test); \
} \