7 /* r = place to store result
8 * f = function call to test (or any expression)
10 * m = message to print on failure (with formats for r & x)
13 #define TEST(r, f, x, m) ( \
14 ((r) = (f)) == (x) || \
15 (error("%s failed (" m ")\n", #f, r, x, r-x), 0) )
17 void test_strtod(void) {
22 for (i=0; i<100; i++) {
24 snprintf(buf, sizeof buf, "%.300f", d);
25 TEST(d2, strtod(buf, 0), d, "round trip fail %a != %a (%a)");
28 TEST(d, strtod("0x1p4", 0), 16.0, "hex float %a != %a");
29 TEST(d, strtod("0x1.1p4", 0), 17.0, "hex float %a != %a");