1 /* Test of character handling in C locale.
2 Copyright (C) 2005, 2007-2012 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program 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
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>, 2005. */
32 for (c
= -0x80; c
< 0x100; c
++)
34 ASSERT (c_isascii (c
) == (c
>= 0 && c
< 0x80));
38 case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
39 case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
40 case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
41 case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
43 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
44 case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
45 case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
46 case 's': case 't': case 'u': case 'v': case 'w': case 'x':
48 case '0': case '1': case '2': case '3': case '4': case '5':
49 case '6': case '7': case '8': case '9':
50 ASSERT (c_isalnum (c
) == 1);
53 ASSERT (c_isalnum (c
) == 0);
59 case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
60 case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
61 case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
62 case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
64 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
65 case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
66 case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
67 case 's': case 't': case 'u': case 'v': case 'w': case 'x':
69 ASSERT (c_isalpha (c
) == 1);
72 ASSERT (c_isalpha (c
) == 0);
79 ASSERT (c_isblank (c
) == 1);
82 ASSERT (c_isblank (c
) == 0);
86 ASSERT (c_iscntrl (c
) == ((c
>= 0 && c
< 0x20) || c
== 0x7f));
90 case '0': case '1': case '2': case '3': case '4': case '5':
91 case '6': case '7': case '8': case '9':
92 ASSERT (c_isdigit (c
) == 1);
95 ASSERT (c_isdigit (c
) == 0);
101 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
102 case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
103 case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
104 case 's': case 't': case 'u': case 'v': case 'w': case 'x':
106 ASSERT (c_islower (c
) == 1);
109 ASSERT (c_islower (c
) == 0);
113 ASSERT (c_isgraph (c
) == ((c
>= 0x20 && c
< 0x7f) && c
!= ' '));
115 ASSERT (c_isprint (c
) == (c
>= 0x20 && c
< 0x7f));
117 ASSERT (c_ispunct (c
) == (c_isgraph (c
) && !c_isalnum (c
)));
121 case ' ': case '\t': case '\n': case '\v': case '\f': case '\r':
122 ASSERT (c_isspace (c
) == 1);
125 ASSERT (c_isspace (c
) == 0);
131 case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
132 case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
133 case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
134 case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
136 ASSERT (c_isupper (c
) == 1);
139 ASSERT (c_isupper (c
) == 0);
145 case '0': case '1': case '2': case '3': case '4': case '5':
146 case '6': case '7': case '8': case '9':
147 case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
148 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
149 ASSERT (c_isxdigit (c
) == 1);
152 ASSERT (c_isxdigit (c
) == 0);
159 ASSERT (c_tolower (c
) == 'a');
160 ASSERT (c_toupper (c
) == c
);
163 ASSERT (c_tolower (c
) == 'b');
164 ASSERT (c_toupper (c
) == c
);
167 ASSERT (c_tolower (c
) == 'c');
168 ASSERT (c_toupper (c
) == c
);
171 ASSERT (c_tolower (c
) == 'd');
172 ASSERT (c_toupper (c
) == c
);
175 ASSERT (c_tolower (c
) == 'e');
176 ASSERT (c_toupper (c
) == c
);
179 ASSERT (c_tolower (c
) == 'f');
180 ASSERT (c_toupper (c
) == c
);
183 ASSERT (c_tolower (c
) == 'g');
184 ASSERT (c_toupper (c
) == c
);
187 ASSERT (c_tolower (c
) == 'h');
188 ASSERT (c_toupper (c
) == c
);
191 ASSERT (c_tolower (c
) == 'i');
192 ASSERT (c_toupper (c
) == c
);
195 ASSERT (c_tolower (c
) == 'j');
196 ASSERT (c_toupper (c
) == c
);
199 ASSERT (c_tolower (c
) == 'k');
200 ASSERT (c_toupper (c
) == c
);
203 ASSERT (c_tolower (c
) == 'l');
204 ASSERT (c_toupper (c
) == c
);
207 ASSERT (c_tolower (c
) == 'm');
208 ASSERT (c_toupper (c
) == c
);
211 ASSERT (c_tolower (c
) == 'n');
212 ASSERT (c_toupper (c
) == c
);
215 ASSERT (c_tolower (c
) == 'o');
216 ASSERT (c_toupper (c
) == c
);
219 ASSERT (c_tolower (c
) == 'p');
220 ASSERT (c_toupper (c
) == c
);
223 ASSERT (c_tolower (c
) == 'q');
224 ASSERT (c_toupper (c
) == c
);
227 ASSERT (c_tolower (c
) == 'r');
228 ASSERT (c_toupper (c
) == c
);
231 ASSERT (c_tolower (c
) == 's');
232 ASSERT (c_toupper (c
) == c
);
235 ASSERT (c_tolower (c
) == 't');
236 ASSERT (c_toupper (c
) == c
);
239 ASSERT (c_tolower (c
) == 'u');
240 ASSERT (c_toupper (c
) == c
);
243 ASSERT (c_tolower (c
) == 'v');
244 ASSERT (c_toupper (c
) == c
);
247 ASSERT (c_tolower (c
) == 'w');
248 ASSERT (c_toupper (c
) == c
);
251 ASSERT (c_tolower (c
) == 'x');
252 ASSERT (c_toupper (c
) == c
);
255 ASSERT (c_tolower (c
) == 'y');
256 ASSERT (c_toupper (c
) == c
);
259 ASSERT (c_tolower (c
) == 'z');
260 ASSERT (c_toupper (c
) == c
);
263 ASSERT (c_tolower (c
) == c
);
264 ASSERT (c_toupper (c
) == 'A');
267 ASSERT (c_tolower (c
) == c
);
268 ASSERT (c_toupper (c
) == 'B');
271 ASSERT (c_tolower (c
) == c
);
272 ASSERT (c_toupper (c
) == 'C');
275 ASSERT (c_tolower (c
) == c
);
276 ASSERT (c_toupper (c
) == 'D');
279 ASSERT (c_tolower (c
) == c
);
280 ASSERT (c_toupper (c
) == 'E');
283 ASSERT (c_tolower (c
) == c
);
284 ASSERT (c_toupper (c
) == 'F');
287 ASSERT (c_tolower (c
) == c
);
288 ASSERT (c_toupper (c
) == 'G');
291 ASSERT (c_tolower (c
) == c
);
292 ASSERT (c_toupper (c
) == 'H');
295 ASSERT (c_tolower (c
) == c
);
296 ASSERT (c_toupper (c
) == 'I');
299 ASSERT (c_tolower (c
) == c
);
300 ASSERT (c_toupper (c
) == 'J');
303 ASSERT (c_tolower (c
) == c
);
304 ASSERT (c_toupper (c
) == 'K');
307 ASSERT (c_tolower (c
) == c
);
308 ASSERT (c_toupper (c
) == 'L');
311 ASSERT (c_tolower (c
) == c
);
312 ASSERT (c_toupper (c
) == 'M');
315 ASSERT (c_tolower (c
) == c
);
316 ASSERT (c_toupper (c
) == 'N');
319 ASSERT (c_tolower (c
) == c
);
320 ASSERT (c_toupper (c
) == 'O');
323 ASSERT (c_tolower (c
) == c
);
324 ASSERT (c_toupper (c
) == 'P');
327 ASSERT (c_tolower (c
) == c
);
328 ASSERT (c_toupper (c
) == 'Q');
331 ASSERT (c_tolower (c
) == c
);
332 ASSERT (c_toupper (c
) == 'R');
335 ASSERT (c_tolower (c
) == c
);
336 ASSERT (c_toupper (c
) == 'S');
339 ASSERT (c_tolower (c
) == c
);
340 ASSERT (c_toupper (c
) == 'T');
343 ASSERT (c_tolower (c
) == c
);
344 ASSERT (c_toupper (c
) == 'U');
347 ASSERT (c_tolower (c
) == c
);
348 ASSERT (c_toupper (c
) == 'V');
351 ASSERT (c_tolower (c
) == c
);
352 ASSERT (c_toupper (c
) == 'W');
355 ASSERT (c_tolower (c
) == c
);
356 ASSERT (c_toupper (c
) == 'X');
359 ASSERT (c_tolower (c
) == c
);
360 ASSERT (c_toupper (c
) == 'Y');
363 ASSERT (c_tolower (c
) == c
);
364 ASSERT (c_toupper (c
) == 'Z');
367 ASSERT (c_tolower (c
) == c
);
368 ASSERT (c_toupper (c
) == c
);
379 setlocale (LC_ALL
, "de_DE");
382 setlocale (LC_ALL
, "ja_JP.EUC-JP");