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