platform.texi: Move LAM after LAHF64_SAHF64
[glibc.git] / stdio-common / bug16.c
blob91bc45282631aab7b8bf0e54b366f9eb125e748c
1 #include <array_length.h>
2 #include <stdio.h>
3 #include <string.h>
5 struct
7 long double val;
8 const char str[4][7];
9 } tests[] =
11 { 0x0.FFFFp+0L, { "0X1P+0", "0X2P-1", "0X4P-2", "0X8P-3" } },
12 { 0x0.FFFFp+1L, { "0X1P+1", "0X2P+0", "0X4P-1", "0X8P-2" } },
13 { 0x0.FFFFp+2L, { "0X1P+2", "0X2P+1", "0X4P+0", "0X8P-1" } },
14 { 0x0.FFFFp+3L, { "0X1P+3", "0X2P+2", "0X4P+1", "0X8P+0" } }
17 static int
18 do_test (void)
20 char buf[100];
21 int ret = 0;
23 for (size_t i = 0; i < array_length (tests); ++i)
25 snprintf (buf, sizeof (buf), "%.0LA", tests[i].val);
27 size_t j;
28 for (j = 0; j < 4; ++j)
29 if (strcmp (buf, tests[i].str[j]) == 0)
30 break;
32 if (j == 4)
34 printf ("%zd: got \"%s\", expected \"%s\" or equivalent\n",
35 i, buf, tests[i].str[0]);
36 ret = 1;
40 return ret;
43 #define TEST_FUNCTION do_test ()
44 #include "../test-skeleton.c"