+#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 700
+#endif
#include <stdio.h>
#include <string.h>
#include <errno.h>
const char *expect;
} fp_tests[] = {
/* basic form, handling of exponent/precision for 0 */
+ { "%a", 0.0, "0x0p+0" },
{ "%e", 0.0, "0.000000e+00" },
{ "%f", 0.0, "0.000000" },
{ "%g", 0.0, "0" },
{ "%#g", 0.0, "0.00000" },
+ { "%la", 0.0, "0x0p+0" },
+ { "%le", 0.0, "0.000000e+00" },
+ { "%lf", 0.0, "0.000000" },
+ { "%lg", 0.0, "0" },
+ { "%#lg", 0.0, "0.00000" },
/* rounding */
{ "%f", 1.1, "1.100000" },
{ "%.4f", 1.06125, "1.0612" },
{ "%.2f", 1.375, "1.38" },
{ "%.1f", 1.375, "1.4" },
+ { "%.1lf", 1.375, "1.4" },
{ "%.15f", 1.1, "1.100000000000000" },
{ "%.16f", 1.1, "1.1000000000000001" },
{ "%.17f", 1.1, "1.10000000000000009" },
{ NULL, 0.0, NULL }
};
-void test_snprintf(void)
+int main(void)
{
int i, j, k;
char b[2000];
}
TEST(i, snprintf(0, 0, "%.4a", 1.0), 11, "%d != %d");
+ return test_status;
}