Update.
[platform/upstream/glibc.git] / localedata / tst-fmon.c
1 #include <monetary.h>
2 #include <stdio.h>
3 #include <locale.h>
4
5 static int
6 check (const char *fmt, double n)
7 {
8   int result;
9   char buf[1000];
10
11   result = strfmon (buf, sizeof buf, fmt, n) == -1;
12
13   printf ("\"%s\"\n", buf);
14   return result;
15 }
16
17 int
18 main (void)
19 {
20   int result = 0;
21
22   setlocale (LC_ALL, "");
23
24   result |= check ("%n", 123.45);
25   result |= check ("%n", -123.45);
26   result |= check ("%n", 3456.781);
27
28   result |= check ("%11n", 123.45);
29   result |= check ("%11n", -123.45);
30   result |= check ("%11n", 3456.781);
31
32   result |= check ("%#5n", 123.45);
33   result |= check ("%#5n", -123.45);
34   result |= check ("%#5n", 3456.781);
35
36   result |= check ("%=*#5n", 123.45);
37   result |= check ("%=*#5n", -123.45);
38   result |= check ("%=*#5n", 3456.781);
39
40   result |= check ("%=0#5n", 123.45);
41   result |= check ("%=0#5n", -123.45);
42   result |= check ("%=0#5n", 3456.781);
43
44   result |= check ("%^#5n", 123.45);
45   result |= check ("%^#5n", -123.45);
46   result |= check ("%^#5n", 3456.781);
47
48   result |= check ("%^#5.0n", 123.45);
49   result |= check ("%^#5.0n", -123.45);
50   result |= check ("%^#5.0n", 3456.781);
51
52   result |= check ("%^#5.4n", 123.45);
53   result |= check ("%^#5.4n", -123.45);
54   result |= check ("%^#5.4n", 3456.781);
55
56   result |= check ("%(#5n", 123.45);
57   result |= check ("%(#5n", -123.45);
58   result |= check ("%(#5n", 3456.781);
59
60   result |= check ("%!(#5n", 123.45);
61   result |= check ("%!(#5n", -123.45);
62   result |= check ("%!(#5n", 3456.781);
63
64   return result;
65 }