src/testing.h: Fix result of EXPECT_EQ_DOUBLE() when actual is NAN.
authorFlorian Forster <octo@collectd.org>
Mon, 15 May 2017 15:25:44 +0000 (17:25 +0200)
committerFlorian Forster <octo@collectd.org>
Tue, 16 May 2017 07:07:09 +0000 (09:07 +0200)
src/testing.h

index 42f45ce..96b6ba9 100644 (file)
@@ -104,7 +104,8 @@ static int check_count__ = 0;
   do {                                                                         \
     double want__ = (double)expect;                                            \
     double got__ = (double)actual;                                             \
-    if (isnan(want__) && !isnan(got__)) {                                      \
+    if ((isnan(want__) && !isnan(got__)) ||                                    \
+        (!isnan(want__) && isnan(got__))) {                                    \
       printf("not ok %i - %s = %.15g, want %.15g\n", ++check_count__, #actual, \
              got__, want__);                                                   \
       return (-1);                                                             \