Browse code

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.

John Hawthorn authored on 17/04/2017 06:35:38
Showing 1 changed files

... ...
@@ -5,7 +5,8 @@
5 5
 
6 6
 #include "greatest/greatest.h"
7 7
 
8
-#define ASSERT_SCORE_EQ(a,b) ASSERT_EQ_FMT((a), (b), "%f")
8
+#define SCORE_TOLERANCE 0.000001
9
+#define ASSERT_SCORE_EQ(a,b) ASSERT_IN_RANGE((a), (b), SCORE_TOLERANCE)
9 10
 #define ASSERT_INT_EQ(a,b) ASSERT_EQ_FMT((a), (b), "%d")
10 11
 
11 12
 /* has_match(char *needle, char *haystack) */