Correctly handle m68k long double format.
[glibc/pb-stable.git] / libio / tst_swprintf.c
blob67d10a006ddf7e25412d1df1a601f32458b021de
1 #include <stdio.h>
2 #include <wchar.h>
4 int
5 main (int argc, char *argv[])
7 wchar_t buf[100];
8 int n;
9 int result = 0;
11 puts ("test 1");
12 n = swprintf (buf, sizeof (buf) / sizeof (buf[0]), L"Hello %s", "world");
13 if (n != 11)
15 printf ("incorrect return value: %d instead of 11\n", n);
16 result = 1;
19 if (wcscmp (buf, L"Hello world") != 0)
21 printf ("incorrect string: L\"%ls\" instead of L\"Hello world\"\n", buf);
22 result = 1;
25 puts ("test 2");
26 n = swprintf (buf, sizeof (buf) / sizeof (buf[0]), L"Is this >%g< 3.1?",
27 3.1);
28 if (n != 18)
30 printf ("incorrect return value: %d instead of 18\n", n);
31 result = 1;
34 if (wcscmp (buf, L"Is this >3.1< 3.1?") != 0)
36 printf ("incorrect string: L\"%ls\" instead of L\"Is this >3.1< 3.1?\"\n",
37 buf);
38 result = 1;
41 return result;