1 /* Test of 32-bit wide character properties.
2 Copyright (C) 2023-2024 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 <https://www.gnu.org/licenses/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>, 2023. */
23 #include "signature.h"
24 SIGNATURE_CHECK (c32_apply_type_test
, int, (wint_t, c32_type_test_t
));
29 main (int argc
, char *argv
[])
33 desc
= c32_get_type_test ("any");
34 ASSERT (desc
== (c32_type_test_t
) 0);
36 desc
= c32_get_type_test ("blank");
37 ASSERT (desc
!= (c32_type_test_t
) 0);
38 ASSERT (c32_apply_type_test ((char32_t
) ' ', desc
));
39 ASSERT (c32_apply_type_test ((char32_t
) '\t', desc
));
40 ASSERT (! c32_apply_type_test ((char32_t
) '\n', desc
));
41 ASSERT (! c32_apply_type_test ((char32_t
) 'a', desc
));
42 ASSERT (! c32_apply_type_test ((char32_t
) '_', desc
));
43 ASSERT (! c32_apply_type_test (WEOF
, desc
));
45 desc
= c32_get_type_test ("space");
46 ASSERT (desc
!= (c32_type_test_t
) 0);
47 ASSERT (c32_apply_type_test ((char32_t
) ' ', desc
));
48 ASSERT (c32_apply_type_test ((char32_t
) '\t', desc
));
49 ASSERT (c32_apply_type_test ((char32_t
) '\n', desc
));
50 ASSERT (! c32_apply_type_test ((char32_t
) 'a', desc
));
51 ASSERT (! c32_apply_type_test ((char32_t
) '_', desc
));
52 ASSERT (! c32_apply_type_test (WEOF
, desc
));
54 desc
= c32_get_type_test ("punct");
55 ASSERT (desc
!= (c32_type_test_t
) 0);
56 ASSERT (c32_apply_type_test ((char32_t
) '$', desc
));
57 ASSERT (c32_apply_type_test ((char32_t
) '.', desc
));
58 ASSERT (c32_apply_type_test ((char32_t
) '<', desc
));
59 ASSERT (c32_apply_type_test ((char32_t
) '>', desc
));
60 ASSERT (! c32_apply_type_test ((char32_t
) ' ', desc
));
61 ASSERT (! c32_apply_type_test ((char32_t
) 'a', desc
));
62 ASSERT (! c32_apply_type_test ((char32_t
) '1', desc
));
63 ASSERT (! c32_apply_type_test (WEOF
, desc
));
65 desc
= c32_get_type_test ("lower");
66 ASSERT (desc
!= (c32_type_test_t
) 0);
67 ASSERT (c32_apply_type_test ((char32_t
) 'a', desc
));
68 ASSERT (c32_apply_type_test ((char32_t
) 'z', desc
));
69 ASSERT (! c32_apply_type_test ((char32_t
) 'A', desc
));
70 ASSERT (! c32_apply_type_test ((char32_t
) 'Z', desc
));
71 ASSERT (! c32_apply_type_test ((char32_t
) '1', desc
));
72 ASSERT (! c32_apply_type_test ((char32_t
) '_', desc
));
73 ASSERT (! c32_apply_type_test (WEOF
, desc
));
75 desc
= c32_get_type_test ("upper");
76 ASSERT (desc
!= (c32_type_test_t
) 0);
77 ASSERT (c32_apply_type_test ((char32_t
) 'A', desc
));
78 ASSERT (c32_apply_type_test ((char32_t
) 'Z', desc
));
79 ASSERT (! c32_apply_type_test ((char32_t
) 'a', desc
));
80 ASSERT (! c32_apply_type_test ((char32_t
) 'z', desc
));
81 ASSERT (! c32_apply_type_test ((char32_t
) '1', desc
));
82 ASSERT (! c32_apply_type_test ((char32_t
) '_', desc
));
83 ASSERT (! c32_apply_type_test (WEOF
, desc
));
85 desc
= c32_get_type_test ("alpha");
86 ASSERT (desc
!= (c32_type_test_t
) 0);
87 ASSERT (c32_apply_type_test ((char32_t
) 'a', desc
));
88 ASSERT (c32_apply_type_test ((char32_t
) 'z', desc
));
89 ASSERT (c32_apply_type_test ((char32_t
) 'A', desc
));
90 ASSERT (c32_apply_type_test ((char32_t
) 'Z', desc
));
91 ASSERT (! c32_apply_type_test ((char32_t
) '1', desc
));
92 ASSERT (! c32_apply_type_test ((char32_t
) '$', desc
));
93 ASSERT (! c32_apply_type_test (WEOF
, desc
));
95 desc
= c32_get_type_test ("digit");
96 ASSERT (desc
!= (c32_type_test_t
) 0);
97 ASSERT (c32_apply_type_test ((char32_t
) '0', desc
));
98 ASSERT (c32_apply_type_test ((char32_t
) '9', desc
));
99 ASSERT (! c32_apply_type_test ((char32_t
) 'a', desc
));
100 ASSERT (! c32_apply_type_test ((char32_t
) 'f', desc
));
101 ASSERT (! c32_apply_type_test ((char32_t
) 'A', desc
));
102 ASSERT (! c32_apply_type_test ((char32_t
) 'F', desc
));
103 ASSERT (! c32_apply_type_test (WEOF
, desc
));
105 desc
= c32_get_type_test ("xdigit");
106 ASSERT (desc
!= (c32_type_test_t
) 0);
107 ASSERT (c32_apply_type_test ((char32_t
) '0', desc
));
108 ASSERT (c32_apply_type_test ((char32_t
) '9', desc
));
109 ASSERT (c32_apply_type_test ((char32_t
) 'a', desc
));
110 ASSERT (c32_apply_type_test ((char32_t
) 'f', desc
));
111 ASSERT (c32_apply_type_test ((char32_t
) 'A', desc
));
112 ASSERT (c32_apply_type_test ((char32_t
) 'F', desc
));
113 ASSERT (! c32_apply_type_test ((char32_t
) 'g', desc
));
114 ASSERT (! c32_apply_type_test ((char32_t
) 'G', desc
));
115 ASSERT (! c32_apply_type_test (WEOF
, desc
));
117 desc
= c32_get_type_test ("alnum");
118 ASSERT (desc
!= (c32_type_test_t
) 0);
119 ASSERT (c32_apply_type_test ((char32_t
) 'a', desc
));
120 ASSERT (c32_apply_type_test ((char32_t
) 'z', desc
));
121 ASSERT (c32_apply_type_test ((char32_t
) 'A', desc
));
122 ASSERT (c32_apply_type_test ((char32_t
) 'Z', desc
));
123 ASSERT (c32_apply_type_test ((char32_t
) '0', desc
));
124 ASSERT (c32_apply_type_test ((char32_t
) '9', desc
));
125 ASSERT (! c32_apply_type_test ((char32_t
) ' ', desc
));
126 ASSERT (! c32_apply_type_test ((char32_t
) '_', desc
));
127 ASSERT (! c32_apply_type_test (WEOF
, desc
));
129 desc
= c32_get_type_test ("cntrl");
130 ASSERT (desc
!= (c32_type_test_t
) 0);
131 ASSERT (c32_apply_type_test ((char32_t
) '\0', desc
));
132 ASSERT (c32_apply_type_test ((char32_t
) '\n', desc
));
133 ASSERT (c32_apply_type_test ((char32_t
) '\t', desc
));
134 ASSERT (! c32_apply_type_test ((char32_t
) ' ', desc
));
135 ASSERT (! c32_apply_type_test ((char32_t
) 'a', desc
));
136 ASSERT (! c32_apply_type_test ((char32_t
) '\\', desc
));
137 ASSERT (! c32_apply_type_test (WEOF
, desc
));
139 desc
= c32_get_type_test ("graph");
140 ASSERT (desc
!= (c32_type_test_t
) 0);
141 ASSERT (c32_apply_type_test ((char32_t
) 'a', desc
));
142 ASSERT (c32_apply_type_test ((char32_t
) 'z', desc
));
143 ASSERT (c32_apply_type_test ((char32_t
) 'A', desc
));
144 ASSERT (c32_apply_type_test ((char32_t
) 'Z', desc
));
145 ASSERT (c32_apply_type_test ((char32_t
) '0', desc
));
146 ASSERT (c32_apply_type_test ((char32_t
) '9', desc
));
147 ASSERT (c32_apply_type_test ((char32_t
) '$', desc
));
148 ASSERT (! c32_apply_type_test ((char32_t
) ' ', desc
));
149 ASSERT (! c32_apply_type_test ((char32_t
) '\t', desc
));
150 ASSERT (! c32_apply_type_test ((char32_t
) '\n', desc
));
151 ASSERT (! c32_apply_type_test ((char32_t
) '\0', desc
));
152 ASSERT (! c32_apply_type_test (WEOF
, desc
));
154 desc
= c32_get_type_test ("print");
155 ASSERT (desc
!= (c32_type_test_t
) 0);
156 ASSERT (c32_apply_type_test ((char32_t
) 'a', desc
));
157 ASSERT (c32_apply_type_test ((char32_t
) 'z', desc
));
158 ASSERT (c32_apply_type_test ((char32_t
) 'A', desc
));
159 ASSERT (c32_apply_type_test ((char32_t
) 'Z', desc
));
160 ASSERT (c32_apply_type_test ((char32_t
) '0', desc
));
161 ASSERT (c32_apply_type_test ((char32_t
) '9', desc
));
162 ASSERT (c32_apply_type_test ((char32_t
) '$', desc
));
163 ASSERT (c32_apply_type_test ((char32_t
) ' ', desc
));
164 ASSERT (! c32_apply_type_test ((char32_t
) '\t', desc
));
165 ASSERT (! c32_apply_type_test ((char32_t
) '\n', desc
));
166 ASSERT (! c32_apply_type_test ((char32_t
) '\0', desc
));
167 ASSERT (! c32_apply_type_test (WEOF
, desc
));
169 return test_exit_status
;