-#define T(desc,got,want) do{ \
-if (got!=want) t_error("fpclassify(%s) failed: got %s want %s\n", desc, strclass(got), #want); \
+#define T(f, desc, c, cwant, s, swant) do{ \
+ c = fpclassify(f); \
+ if (c != cwant) \
+ t_error("fpclassify(%s) failed: got %s want %s\n", desc, strclass(c), #cwant); \
+ memset(s, 0, sizeof(s)); \
+ if (snprintf(s, sizeof(s), "%La", f) >= sizeof(s)) \
+ t_error("snprintf(\"%%La\", %s) failed with invalid return value\n", desc); \
+ if (strcmp(s,swant) != 0) \
+ t_error("snprintf(\"%%La\", %s) failed: got \"%.*s\" want %s\n", desc, sizeof(s), s, #swant); \