X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Ftesting.h;h=4056311f8a9467e4f93fb90e38b224f653a934f4;hb=9461848421c468d9117bf6c57335b344db0a420e;hp=5df1b83a3e0f076b3a35bff53df09b021b9a0ea5;hpb=233ef890d210e7f231ebbc474894e90032ba49b1;p=collectd.git diff --git a/src/testing.h b/src/testing.h index 5df1b83a..4056311f 100644 --- a/src/testing.h +++ b/src/testing.h @@ -54,6 +54,15 @@ static int check_count__ = 0; printf ("ok %i - %s evaluates to \"%s\"\n", ++check_count__, #actual, expect); \ } while (0) +#define DBLEQ(expect, actual) do { \ + if ((isnan (expect) && !isnan (actual)) || ((expect) != (actual))) {\ + printf ("not ok %i - %s incorrect: expected %.15g, got %.15g\n", \ + ++check_count__, #actual, expect, actual); \ + return (-1); \ + } \ + printf ("ok %i - %s evaluates to %.15g\n", ++check_count__, #actual, expect); \ +} while (0) + #define CHECK_NOT_NULL(expr) do { \ void *ptr_; \ ptr_ = (expr); \