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