소스 검색

tests: prevent compiler warning when comparing floats

Kosma Moczek 11 년 전
부모
커밋
df695c4933
1개의 변경된 파일7개의 추가작업 그리고 0개의 파일을 삭제
  1. 7 0
      tests.c

+ 7 - 0
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");