1*8ce2ca0fSOliver Tappe /* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
2*8ce2ca0fSOliver Tappe This file is part of the GNU C Library.
3*8ce2ca0fSOliver Tappe
4*8ce2ca0fSOliver Tappe The GNU C Library is free software; you can redistribute it and/or
5*8ce2ca0fSOliver Tappe modify it under the terms of the GNU Lesser General Public
6*8ce2ca0fSOliver Tappe License as published by the Free Software Foundation; either
7*8ce2ca0fSOliver Tappe version 2.1 of the License, or (at your option) any later version.
8*8ce2ca0fSOliver Tappe
9*8ce2ca0fSOliver Tappe The GNU C Library is distributed in the hope that it will be useful,
10*8ce2ca0fSOliver Tappe but WITHOUT ANY WARRANTY; without even the implied warranty of
11*8ce2ca0fSOliver Tappe MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12*8ce2ca0fSOliver Tappe Lesser General Public License for more details.
13*8ce2ca0fSOliver Tappe
14*8ce2ca0fSOliver Tappe You should have received a copy of the GNU Lesser General Public
15*8ce2ca0fSOliver Tappe License along with the GNU C Library; if not, write to the Free
16*8ce2ca0fSOliver Tappe Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17*8ce2ca0fSOliver Tappe 02111-1307 USA. */
18*8ce2ca0fSOliver Tappe
19*8ce2ca0fSOliver Tappe #include <stdio.h>
20*8ce2ca0fSOliver Tappe #include <stdlib.h>
21*8ce2ca0fSOliver Tappe #include <wctype.h>
22*8ce2ca0fSOliver Tappe
23*8ce2ca0fSOliver Tappe
24*8ce2ca0fSOliver Tappe int
main(int argc,char * argv[])25*8ce2ca0fSOliver Tappe main(int argc, char *argv[])
26*8ce2ca0fSOliver Tappe {
27*8ce2ca0fSOliver Tappe int result = 0;
28*8ce2ca0fSOliver Tappe wint_t ch;
29*8ce2ca0fSOliver Tappe
30*8ce2ca0fSOliver Tappe for (ch = 0; ch < 128; ++ch) {
31*8ce2ca0fSOliver Tappe if (iswlower(ch)) {
32*8ce2ca0fSOliver Tappe /* Get corresponding upper case character. */
33*8ce2ca0fSOliver Tappe wint_t up = towupper(ch);
34*8ce2ca0fSOliver Tappe /* This should have no effect. */
35*8ce2ca0fSOliver Tappe wint_t low = towlower(ch);
36*8ce2ca0fSOliver Tappe
37*8ce2ca0fSOliver Tappe if ((ch != low) || (up == ch) || (up == low)) {
38*8ce2ca0fSOliver Tappe printf(
39*8ce2ca0fSOliver Tappe "iswlower/towupper/towlower for character \\%x failed\n",
40*8ce2ca0fSOliver Tappe ch);
41*8ce2ca0fSOliver Tappe result++;
42*8ce2ca0fSOliver Tappe }
43*8ce2ca0fSOliver Tappe }
44*8ce2ca0fSOliver Tappe if (iswupper(ch)) {
45*8ce2ca0fSOliver Tappe /* Get corresponding lower case character. */
46*8ce2ca0fSOliver Tappe wint_t low = towlower(ch);
47*8ce2ca0fSOliver Tappe /* This should have no effect. */
48*8ce2ca0fSOliver Tappe wint_t up = towupper(ch);
49*8ce2ca0fSOliver Tappe
50*8ce2ca0fSOliver Tappe if ((ch != up) || (low == ch) || (up == low)) {
51*8ce2ca0fSOliver Tappe printf(
52*8ce2ca0fSOliver Tappe "iswupper/towlower/towupper for character \\%x failed\n",
53*8ce2ca0fSOliver Tappe ch);
54*8ce2ca0fSOliver Tappe result++;
55*8ce2ca0fSOliver Tappe }
56*8ce2ca0fSOliver Tappe }
57*8ce2ca0fSOliver Tappe }
58*8ce2ca0fSOliver Tappe
59*8ce2ca0fSOliver Tappe /* Finally some specific tests. */
60*8ce2ca0fSOliver Tappe ch = L'A';
61*8ce2ca0fSOliver Tappe if (!iswupper(ch) || iswlower(ch)) {
62*8ce2ca0fSOliver Tappe printf("!iswupper/iswlower (L'A') failed\n");
63*8ce2ca0fSOliver Tappe result++;
64*8ce2ca0fSOliver Tappe
65*8ce2ca0fSOliver Tappe }
66*8ce2ca0fSOliver Tappe ch = L'a';
67*8ce2ca0fSOliver Tappe if (iswupper(ch) || !iswlower(ch)) {
68*8ce2ca0fSOliver Tappe printf("iswupper/!iswlower (L'a') failed\n");
69*8ce2ca0fSOliver Tappe result++;
70*8ce2ca0fSOliver Tappe }
71*8ce2ca0fSOliver Tappe if (towlower(L'A') != L'a') {
72*8ce2ca0fSOliver Tappe printf("towlower(L'A') failed\n");
73*8ce2ca0fSOliver Tappe result++;
74*8ce2ca0fSOliver Tappe }
75*8ce2ca0fSOliver Tappe if (towupper(L'a') != L'A') {
76*8ce2ca0fSOliver Tappe printf("towupper(L'a') failed\n");
77*8ce2ca0fSOliver Tappe result++;
78*8ce2ca0fSOliver Tappe }
79*8ce2ca0fSOliver Tappe
80*8ce2ca0fSOliver Tappe if (result == 0)
81*8ce2ca0fSOliver Tappe puts("All test successful!");
82*8ce2ca0fSOliver Tappe return result != 0;
83*8ce2ca0fSOliver Tappe }
84