aboutsummaryrefslogtreecommitdiff
path: root/testing.h
diff options
context:
space:
mode:
Diffstat (limited to 'testing.h')
-rw-r--r--testing.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/testing.h b/testing.h
index d7247f1..9e0c022 100644
--- a/testing.h
+++ b/testing.h
@@ -11,6 +11,14 @@
if (!(a == b)) { \
fprintf(stderr, \
"Assertion failed: %d (%s) != %d (%s) at %s:%d in %s()\n", \
- (int)a, #a, (int)b, #b, __FILE__, __LINE__, __func__); \
+ (i32)a, #a, (i32)b, #b, __FILE__, __LINE__, __func__); \
+ return 1; \
+ }
+
+#define t_assert_fequal(a, b) \
+ if ((a - b) > 1e-6 || (b - a) > 1e-6) { \
+ fprintf(stderr, \
+ "Assertion failed: %f (%s) != %f (%s) at %s:%d in %s()\n", a, \
+ #a, b, #b, __FILE__, __LINE__, __func__); \
return 1; \
}