summaryrefslogtreecommitdiff
path: root/src/libstrongswan/utils/test.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/utils/test.h')
-rw-r--r--src/libstrongswan/utils/test.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/libstrongswan/utils/test.h b/src/libstrongswan/utils/test.h
index a1b2a2d9b..f9a84713e 100644
--- a/src/libstrongswan/utils/test.h
+++ b/src/libstrongswan/utils/test.h
@@ -24,19 +24,20 @@
#include "collections/hashtable.h"
/**
- * Collection of testable functions.
+ * Register a (possibly static) function so that it can be called from tests.
*
- * @note Is initialized only if libtest is loaded.
+ * @param name name (namespace/function)
+ * @param fn function to register (set to NULL to unregister)
*/
-extern hashtable_t *testable_functions;
+void testable_function_register(char *name, void *fn);
/**
- * Register a (possibly static) function so that it can be called from tests.
+ * Find a previously registered testable function.
*
* @param name name (namespace/function)
- * @param fn function to register (set to NULL to unregister)
+ * @return function, NULL if not found
*/
-void testable_function_register(char *name, void *fn);
+void* testable_function_get(char *name);
/**
* Macro to automatically register/unregister a function that can be called
@@ -82,10 +83,7 @@ static ret (*TEST_##ns##name)(__VA_ARGS__);
*/
#define TEST_FUNCTION(ns, name, ...) \
({ \
- if (testable_functions) \
- { \
- TEST_##ns##name = testable_functions->get(testable_functions, #ns "/" #name); \
- } \
+ TEST_##ns##name = testable_function_get( #ns "/" #name); \
if (!TEST_##ns##name) \
{ \
test_fail_msg(__FILE__, __LINE__, "function " #name " (" #ns ") not found"); \