aboutsummaryrefslogtreecommitdiff
path: root/testing.h
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2025-07-22 09:34:52 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2025-07-22 09:34:52 +0200
commit95018d0e410c22fc56a6518d967be25428e3a6ed (patch)
tree9bb0157a888f1c7ed1904a636d3a733d942dcccd /testing.h
parent13fdee74dc28f0b068503843c6e14071a7c339f2 (diff)
feat(json): Float parsing
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; \
}