1 /*
2 Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
3 
4 Permission to use, copy, modify, and distribute this software
5 is freely granted, provided that this notice is preserved.
6  */
7 #include <wctype.h>
8 #include <ctype.h>
9 #include <stdio.h>
10 #include <string.h>
11 #include <locale.h>
12 #include "check.h"
13 
main()14 int main()
15 {
16 #if !defined(_ELIX_LEVEL) || _ELIX_LEVEL > 1
17   if (_MB_LEN_MAX == 1)
18     {
19       CHECK (iswalpha(L'a'));
20       CHECK (!iswalpha(L'3'));
21       CHECK (iswalnum(L'9'));
22       CHECK (!iswalnum(L'$'));
23       CHECK (iswcntrl(L'\n'));
24       CHECK (!iswcntrl(L'#'));
25       CHECK (iswdigit(L'2'));
26       CHECK (!iswdigit(L'a'));
27       CHECK (iswgraph(L'2'));
28       CHECK (!iswgraph(L' '));
29       CHECK (iswlower(L'g'));
30       CHECK (!iswlower(L'G'));
31       CHECK (iswprint(L'*'));
32       CHECK (!iswprint(L'\n'));
33       CHECK (iswpunct(L','));
34       CHECK (!iswpunct(L'\n'));
35       CHECK (iswspace(L'\t'));
36       CHECK (!iswspace(L':'));
37       CHECK (iswupper(L'G'));
38       CHECK (!iswupper(L'g'));
39       CHECK (iswxdigit(L'A'));
40       CHECK (!iswxdigit(L'g'));
41     }
42   else
43     {
44       setlocale (LC_CTYPE, "C-UTF-8");
45       CHECK (iswalpha(0x0967));
46       CHECK (!iswalpha(0x128e));
47       CHECK (iswalnum(0x1d7ce));
48       CHECK (!iswalnum(0x1d800));
49       CHECK (iswcntrl(0x007f));
50       CHECK (!iswcntrl(0x2027));
51       CHECK (iswdigit(L'2'));
52       CHECK (!iswdigit(0x0009));
53       CHECK (iswlower(0x03b3));
54       CHECK (!iswlower(0x04aa));
55       CHECK (iswprint(0x0b13));
56       CHECK (!iswprint(0x0ce4));
57       CHECK (iswpunct(0x002d));
58       CHECK (!iswpunct(0x0a84));
59       CHECK (iswspace(0x000a));
60       CHECK (!iswspace(0x2060));
61       CHECK (iswupper(0x01a4));
62       CHECK (!iswupper(0x1e6d));
63       CHECK (iswxdigit(L'A'));
64       CHECK (!iswxdigit(0x1f48));
65     }
66 #endif
67 
68   exit (0);
69 }
70