aboutsummaryrefslogtreecommitdiff
path: root/unit/include/bh
diff options
context:
space:
mode:
Diffstat (limited to 'unit/include/bh')
-rw-r--r--unit/include/bh/unit.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/unit/include/bh/unit.h b/unit/include/bh/unit.h
new file mode 100644
index 0000000..42d41cd
--- /dev/null
+++ b/unit/include/bh/unit.h
@@ -0,0 +1,24 @@
+#ifndef BHLIB_UNIT_H
+#define BHLIB_UNIT_H
+
+#include <stdio.h>
+
+typedef int (*bh_unit_cb_t)(void);
+
+#define bh_unit_assert(e) \
+ if (!(e)) { \
+ printf("%s:%d\t%s", __FILE__, __LINE__, #e); \
+ return -1; \
+ }
+
+
+#define bh_unit_assert_delta(x, y, e) \
+ if ((((x)>(y))?((x)-(y)):((y)-(x)))>(e)) { \
+ printf("%s:%d\t%s", __FILE__, __LINE__, #x " == " #y); \
+ return -1; \
+ }
+
+void bh_unit_add(const char *name, bh_unit_cb_t func);
+int bh_unit_run(void);
+
+#endif /* BHLIB_UNIT_H */