1 /* Test program for character classes and mappings.
2 Copyright (C) 1999 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
29 const char lower
[] = "abcdefghijklmnopqrstuvwxyz";
30 const char upper
[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
31 #define LEN (sizeof (upper) - 1)
32 const wchar_t wlower
[] = L
"abcdefghijklmnopqrstuvwxyz";
33 const wchar_t wupper
[] = L
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
37 setlocale (LC_ALL
, "test6");
39 for (i
= 0; i
< LEN
; ++i
)
41 /* Test basic table handling (basic == not more than 256 characters).
42 The charmaps swaps the normal lower-upper case meaning of the
43 ASCII characters used in the source code while the Unicode mapping
44 in the repertoire map has the normal correspondants. This test
45 shows the independence of the tables for `char' and `wchar_t'
48 if (islower (lower
[i
]))
50 printf ("islower ('%c') false\n", lower
[i
]);
53 if (! isupper (lower
[i
]))
55 printf ("isupper ('%c') false\n", lower
[i
]);
59 if (! islower (upper
[i
]))
61 printf ("islower ('%c') false\n", upper
[i
]);
64 if (isupper (upper
[i
]))
66 printf ("isupper ('%c') false\n", upper
[i
]);
70 if (toupper (lower
[i
]) != lower
[i
])
72 printf ("toupper ('%c') false\n", lower
[i
]);
75 if (tolower (lower
[i
]) != upper
[i
])
77 printf ("tolower ('%c') false\n", lower
[i
]);
81 if (tolower (upper
[i
]) != upper
[i
])
83 printf ("tolower ('%c') false\n", upper
[i
]);
86 if (toupper (upper
[i
]) != lower
[i
])
88 printf ("toupper ('%c') false\n", upper
[i
]);
92 if (iswlower (wupper
[i
]))
94 printf ("iswlower (L'%c') false\n", upper
[i
]);
97 if (! iswupper (wupper
[i
]))
99 printf ("iswupper (L'%c') false\n", upper
[i
]);
103 if (iswupper (wlower
[i
]))
105 printf ("iswupper (L'%c') false\n", lower
[i
]);
108 if (! iswlower (wlower
[i
]))
110 printf ("iswlower (L'%c') false\n", lower
[i
]);
114 if (towupper (wlower
[i
]) != wupper
[i
])
116 printf ("towupper ('%c') false\n", lower
[i
]);
119 if (towlower (wlower
[i
]) != wlower
[i
])
121 printf ("towlower ('%c') false\n", lower
[i
]);
125 if (towlower (wupper
[i
]) != wlower
[i
])
127 printf ("towlower ('%c') false\n", upper
[i
]);
130 if (towupper (wupper
[i
]) != wupper
[i
])
132 printf ("towupper ('%c') false\n", upper
[i
]);