summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Hawthorn <john.hawthorn@gmail.com>2017-04-16 23:35:38 -0700
committerJohn Hawthorn <john.hawthorn@gmail.com>2017-04-16 23:35:38 -0700
commit43b8f4e75a32d4b14bd16259af600e1364d68821 (patch)
treeae6cafcb4cb1f052de97d2ada9d72d3168a9b737 /test
parentec5d25fe15f7887d8da3ac92a006ca27bd6a32db (diff)
Use a tolerance for assertions on exact score
This caused the test suite to fail on i386 (and possibly other archs), because the value was off my a minute amount due to floating point representation.
Diffstat (limited to 'test')
-rw-r--r--test/test_match.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/test_match.c b/test/test_match.c
index 00dcdb0..8d52191 100644
--- a/test/test_match.c
+++ b/test/test_match.c
@@ -5,7 +5,8 @@
#include "greatest/greatest.h"
-#define ASSERT_SCORE_EQ(a,b) ASSERT_EQ_FMT((a), (b), "%f")
+#define SCORE_TOLERANCE 0.000001
+#define ASSERT_SCORE_EQ(a,b) ASSERT_IN_RANGE((a), (b), SCORE_TOLERANCE)
#define ASSERT_INT_EQ(a,b) ASSERT_EQ_FMT((a), (b), "%d")
/* has_match(char *needle, char *haystack) */