diff options
Diffstat (limited to 'test.c')
-rw-r--r-- | test.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1,5 +1,6 @@ #include <stdio.h> #include <stdarg.h> +#include <float.h> unsigned int total_passed = 0; unsigned int total_failed = 0; @@ -87,6 +88,12 @@ void test_int_equals_imp(const char *expression, int result, int expected) print_result(result == expected, "%s == %d", expression, expected); } +void test_double_imp(const char *expression, double result, double expected) +{ + int success = (result - expected < DBL_EPSILON); + print_result(success, "%s == %d", expression, (int)expected); +} + void test_void_imp(const char *expression) { putchar('?'); |