summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-06-16 21:14:36 -0500
committersanine <sanine.not@pm.me>2022-06-16 21:14:36 -0500
commitc6262360d067fb988e06266865701bee9ddf4231 (patch)
tree209b5769861b1e8713c7ff00ea975a9594f6ee64 /src/test
parentca4f950ee2e8a1881bf74c4931343d696ca44654 (diff)
add helper macros for mocking
Diffstat (limited to 'src/test')
-rw-r--r--src/test/honey-test.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/honey-test.h b/src/test/honey-test.h
index 65bd959..ac79d8a 100644
--- a/src/test/honey-test.h
+++ b/src/test/honey-test.h
@@ -3,6 +3,25 @@
#include "lily-test.h"
+#define MOCK(name) \
+ lily_mock_t * name ## _data = NULL; \
+ void name
+
+#define CLEAN_MOCK(name) \
+ do { \
+ if (name ## _data != NULL) { \
+ lily_mock_destroy(name ## _data); \
+ name ## _data = NULL; \
+ } \
+ } while(0)
+
+#define USE_MOCK(name) \
+ do { \
+ CLEAN_MOCK(name); \
+ name ## _data = lily_mock_create(); \
+ } while(0)
+
+
void suite_logging();
#define RUN_TESTS() \