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 <newlib.h>
12 #include <locale.h>
13 #include "check.h"
14 
main()15 int main()
16 {
17 #if !defined(_ELIX_LEVEL) || _ELIX_LEVEL > 1
18   if (_MB_LEN_MAX == 1)
19     {
20       CHECK (iswalpha(L'a'));
21       CHECK (!iswalpha(L'3'));
22       CHECK (iswalnum(L'9'));
23       CHECK (!iswalnum(L'$'));
24       CHECK (iswcntrl(L'\n'));
25       CHECK (!iswcntrl(L'#'));
26       CHECK (iswdigit(L'2'));
27       CHECK (!iswdigit(L'a'));
28       CHECK (iswgraph(L'2'));
29       CHECK (!iswgraph(L' '));
30       CHECK (iswlower(L'g'));
31       CHECK (!iswlower(L'G'));
32       CHECK (iswprint(L'*'));
33       CHECK (!iswprint(L'\n'));
34       CHECK (iswpunct(L','));
35       CHECK (!iswpunct(L'\n'));
36       CHECK (iswspace(L'\t'));
37       CHECK (!iswspace(L':'));
38       CHECK (iswupper(L'G'));
39       CHECK (!iswupper(L'g'));
40       CHECK (iswxdigit(L'A'));
41       CHECK (!iswxdigit(L'g'));
42     }
43   else
44     {
45       setlocale (LC_CTYPE, "C-UTF-8");
46       CHECK (iswalpha(0x0967));
47       CHECK (!iswalpha(0x128e));
48       CHECK (iswalnum(0x1d7ce));
49       CHECK (!iswalnum(0x1d800));
50       CHECK (iswcntrl(0x007f));
51       CHECK (!iswcntrl(0x2027));
52       CHECK (iswdigit(L'2'));
53       CHECK (!iswdigit(0x0009));
54       CHECK (iswlower(0x03b3));
55       CHECK (!iswlower(0x04aa));
56       CHECK (iswprint(0x0b13));
57       CHECK (!iswprint(0x0ce4));
58       CHECK (iswpunct(0x002d));
59       CHECK (!iswpunct(0x0a84));
60       CHECK (iswspace(0x000a));
61       CHECK (!iswspace(0x2060));
62       CHECK (iswupper(0x01a4));
63       CHECK (!iswupper(0x1e6d));
64       CHECK (iswxdigit(L'A'));
65       CHECK (!iswxdigit(0x1f48));
66     }
67 #endif
68 
69   exit (0);
70 }
71