aboutsummaryrefslogtreecommitdiff
path: root/test/include/BH/Unit.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/include/BH/Unit.h')
-rw-r--r--test/include/BH/Unit.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/include/BH/Unit.h b/test/include/BH/Unit.h
index f0eab71..9f9b3bb 100644
--- a/test/include/BH/Unit.h
+++ b/test/include/BH/Unit.h
@@ -2,10 +2,13 @@
#define BH_UNIT_H
#include <stdio.h>
+#include <string.h>
#include <math.h>
+
typedef int (*BH_UnitCallback)(void);
+
#define BH_VERIFY(e) \
do { \
if (!(e)) { \
@@ -35,6 +38,17 @@ typedef int (*BH_UnitCallback)(void);
} while(0)
+#define BH_VERIFY_STR_EQ(actual, expected) \
+ do { \
+ BH_VERIFY((actual) != NULL && (expected) != NULL); \
+ if (strcmp((actual), (expected)) != 0) { \
+ printf("%s:%d\tExpected '%s', got '%s'\n", \
+ __FILE__, __LINE__, (expected), (actual)); \
+ return -1; \
+ } \
+ } while(0)
+
+
#define BH_UNIT_TEST(name) \
static int unit##name(void)