From df695c4933cfe807c4889dce30a27800e2e2dc85 Mon Sep 17 00:00:00 2001 From: Kosma Moczek Date: Tue, 17 Jun 2014 12:22:48 +0200 Subject: [PATCH] tests: prevent compiler warning when comparing floats --- tests.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests.c b/tests.c index da7683f..6ee4228 100644 --- a/tests.c +++ b/tests.c @@ -640,6 +640,11 @@ START_TEST(test_minmea_rescale) } END_TEST +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wfloat-equal" +/* The float values used in tests should be exactly representable under IEEE754; + * false negatives will occur otherwise. */ + START_TEST(test_minmea_float) { ck_assert(isnan(minmea_tofloat(&(struct minmea_float) { 42, 0 }))); @@ -658,6 +663,8 @@ START_TEST(test_minmea_coord) } END_TEST +#pragma GCC diagnostic pop + Suite *minmea_suite(void) { Suite *s = suite_create ("minmea");