1 | #include <ctype.h> |
---|---|
2 | #include <locale.h> |
3 | #include <stdio.h> |
4 | #include <wctype.h> |
5 | |
6 | |
7 | static int |
8 | do_test (void) |
9 | { |
10 | const char *loc = "de_DE.ISO-8859-1"; |
11 | if (setlocale (LC_ALL, loc) == NULL) |
12 | { |
13 | printf (format: "cannot set %s locale\n", loc); |
14 | return 1; |
15 | } |
16 | printf (format: "selected locale %s\n", loc); |
17 | |
18 | wint_t win = 0xe4; |
19 | wint_t wex = 0xc4; |
20 | wint_t wch = towupper (win); |
21 | if (wch != wex) |
22 | { |
23 | printf (format: "towupper(%x) = %x, expected %x\n", win, wch, wex); |
24 | return 1; |
25 | } |
26 | wch = toupper (win); |
27 | if (wch != wex) |
28 | { |
29 | printf (format: "toupper(%x) = %x, expected %x\n", win, wch, wex); |
30 | return 1; |
31 | } |
32 | |
33 | win = 0x69; |
34 | wex = 0x49; |
35 | wch = towupper (win); |
36 | if (wch != wex) |
37 | { |
38 | printf (format: "towupper(%x) = %x, expected %x\n", win, wch, wex); |
39 | return 1; |
40 | } |
41 | wch = toupper (win); |
42 | if (wch != wex) |
43 | { |
44 | printf (format: "toupper(%x) = %x, expected %x\n", win, wch, wex); |
45 | return 1; |
46 | } |
47 | |
48 | loc = "tr_TR.ISO-8859-9"; |
49 | if (setlocale (LC_ALL, loc) == NULL) |
50 | { |
51 | printf (format: "cannot set %s locale\n", loc); |
52 | return 1; |
53 | } |
54 | printf (format: "selected locale %s\n", loc); |
55 | |
56 | win = 0x69; |
57 | wex = 0x130; |
58 | wch = towupper (win); |
59 | if (wch != wex) |
60 | { |
61 | printf (format: "towupper(%x) = %x, expected %x\n", win, wch, wex); |
62 | return 1; |
63 | } |
64 | wch = toupper (win); |
65 | wex = 0xdd; |
66 | if (wch != wex) |
67 | { |
68 | printf (format: "toupper(%x) = %x, expected %x\n", win, wch, wex); |
69 | return 1; |
70 | } |
71 | |
72 | return 0; |
73 | } |
74 | |
75 | #define TEST_FUNCTION do_test () |
76 | #include "../test-skeleton.c" |
77 |