1 /* iswctype( wint_t, wctype_t )
3 This file is part of the Public Domain C Library (PDCLib).
4 Permission is granted to use, modify, and / or redistribute at will.
9 #include "_PDCLIB_locale.h"
11 int _PDCLIB_iswctype_l( wint_t wc, wctype_t desc, locale_t l )
13 wc = _PDCLIB_unpackwint( wc );
15 _PDCLIB_wcinfo_t *info = _PDCLIB_wcgetinfo( l, wc );
19 return info->flags & desc;
22 int iswctype( wint_t wc, wctype_t desc )
24 return _PDCLIB_iswctype_l( wc, desc, _PDCLIB_threadlocale() );
30 #include "_PDCLIB_test.h"
34 TESTCASE( iswctype(L'a', wctype("alpha")));
35 TESTCASE( iswctype(L'z', wctype("alpha")));
36 TESTCASE( iswctype(L'E', wctype("alpha")));
37 TESTCASE(!iswctype(L'3', wctype("alpha")));
38 TESTCASE(!iswctype(L';', wctype("alpha")));
40 TESTCASE( iswctype(L'a', wctype("alnum")));
41 TESTCASE( iswctype(L'3', wctype("alnum")));
42 TESTCASE(!iswctype(L';', wctype("alnum")));
44 TESTCASE( iswctype(L' ', wctype("blank")));
45 TESTCASE( iswctype(L'\t', wctype("blank")));
46 TESTCASE(!iswctype(L'\n', wctype("blank")));
47 TESTCASE(!iswctype(L';', wctype("blank")));
49 TESTCASE( iswctype(L'\0', wctype("cntrl")));
50 TESTCASE( iswctype(L'\n', wctype("cntrl")));
51 TESTCASE( iswctype(L'\v', wctype("cntrl")));
52 TESTCASE(!iswctype(L'\t', wctype("cntrl")));
53 TESTCASE(!iswctype(L'a', wctype("cntrl")));
55 TESTCASE( iswctype(L'0', wctype("digit")));
56 TESTCASE( iswctype(L'1', wctype("digit")));
57 TESTCASE( iswctype(L'2', wctype("digit")));
58 TESTCASE( iswctype(L'3', wctype("digit")));
59 TESTCASE( iswctype(L'4', wctype("digit")));
60 TESTCASE( iswctype(L'5', wctype("digit")));
61 TESTCASE( iswctype(L'6', wctype("digit")));
62 TESTCASE( iswctype(L'7', wctype("digit")));
63 TESTCASE( iswctype(L'8', wctype("digit")));
64 TESTCASE( iswctype(L'9', wctype("digit")));
65 TESTCASE(!iswctype(L'X', wctype("digit")));
66 TESTCASE(!iswctype(L'?', wctype("digit")));
68 TESTCASE( iswctype(L'a', wctype("graph")));
69 TESTCASE( iswctype(L'z', wctype("graph")));
70 TESTCASE( iswctype(L'E', wctype("graph")));
71 TESTCASE( iswctype(L'E', wctype("graph")));
72 TESTCASE(!iswctype(L' ', wctype("graph")));
73 TESTCASE(!iswctype(L'\t', wctype("graph")));
74 TESTCASE(!iswctype(L'\n', wctype("graph")));
76 TESTCASE( iswctype(L'a', wctype("lower")));
77 TESTCASE( iswctype(L'e', wctype("lower")));
78 TESTCASE( iswctype(L'z', wctype("lower")));
79 TESTCASE(!iswctype(L'A', wctype("lower")));
80 TESTCASE(!iswctype(L'E', wctype("lower")));
81 TESTCASE(!iswctype(L'Z', wctype("lower")));
83 TESTCASE(!iswctype(L'a', wctype("upper")));
84 TESTCASE(!iswctype(L'e', wctype("upper")));
85 TESTCASE(!iswctype(L'z', wctype("upper")));
86 TESTCASE( iswctype(L'A', wctype("upper")));
87 TESTCASE( iswctype(L'E', wctype("upper")));
88 TESTCASE( iswctype(L'Z', wctype("upper")));
90 TESTCASE( iswctype(L'Z', wctype("print")));
91 TESTCASE( iswctype(L'a', wctype("print")));
92 TESTCASE( iswctype(L';', wctype("print")));
93 TESTCASE( iswctype(L'\t', wctype("print")));
94 TESTCASE(!iswctype(L'\0', wctype("print")));
96 TESTCASE( iswctype(L';', wctype("punct")));
97 TESTCASE( iswctype(L'.', wctype("punct")));
98 TESTCASE( iswctype(L'?', wctype("punct")));
99 TESTCASE(!iswctype(L' ', wctype("punct")));
100 TESTCASE(!iswctype(L'Z', wctype("punct")));
102 TESTCASE( iswctype(L' ', wctype("space")));
103 TESTCASE( iswctype(L'\t', wctype("space")));
105 TESTCASE( iswctype(L'0', wctype("xdigit")));
106 TESTCASE( iswctype(L'1', wctype("xdigit")));
107 TESTCASE( iswctype(L'2', wctype("xdigit")));
108 TESTCASE( iswctype(L'3', wctype("xdigit")));
109 TESTCASE( iswctype(L'4', wctype("xdigit")));
110 TESTCASE( iswctype(L'5', wctype("xdigit")));
111 TESTCASE( iswctype(L'6', wctype("xdigit")));
112 TESTCASE( iswctype(L'7', wctype("xdigit")));
113 TESTCASE( iswctype(L'8', wctype("xdigit")));
114 TESTCASE( iswctype(L'9', wctype("xdigit")));
115 TESTCASE( iswctype(L'a', wctype("xdigit")));
116 TESTCASE( iswctype(L'b', wctype("xdigit")));
117 TESTCASE( iswctype(L'c', wctype("xdigit")));
118 TESTCASE( iswctype(L'd', wctype("xdigit")));
119 TESTCASE( iswctype(L'e', wctype("xdigit")));
120 TESTCASE( iswctype(L'f', wctype("xdigit")));
121 TESTCASE( iswctype(L'A', wctype("xdigit")));
122 TESTCASE( iswctype(L'B', wctype("xdigit")));
123 TESTCASE( iswctype(L'C', wctype("xdigit")));
124 TESTCASE( iswctype(L'D', wctype("xdigit")));
125 TESTCASE( iswctype(L'E', wctype("xdigit")));
126 TESTCASE( iswctype(L'F', wctype("xdigit")));
127 TESTCASE(!iswctype(L'g', wctype("xdigit")));
128 TESTCASE(!iswctype(L'G', wctype("xdigit")));
129 TESTCASE(!iswctype(L'x', wctype("xdigit")));
130 TESTCASE(!iswctype(L'X', wctype("xdigit")));
131 TESTCASE(!iswctype(L' ', wctype("xdigit")));