2 Copyright (C) 2022-2023 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
25 #include <support/check.h>
26 #include <support/support.h>
31 xsetlocale (LC_ALL
, "de_DE.UTF-8");
36 char8_t buf
[1] = { 0 };
39 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 0, &s
), (size_t) -2); /* no input */
40 TEST_VERIFY (mbsinit (&s
));
45 const char *mbs
= "\x00"; /* 0x00 => U+0000 */
46 char8_t buf
[1] = { 0 };
49 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) 0);
51 TEST_COMPARE (buf
[0], 0x00);
52 TEST_VERIFY (mbsinit (&s
));
55 /* First non-null character in the code point range that maps to a single
58 const char *mbs
= "\x01"; /* 0x01 => U+0001 */
59 char8_t buf
[1] = { 0 };
62 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) 1);
64 TEST_COMPARE (buf
[0], 0x01);
65 TEST_VERIFY (mbsinit (&s
));
68 /* Last character in the code point range that maps to a single code unit. */
70 const char *mbs
= "\x7F"; /* 0x7F => U+007F */
71 char8_t buf
[1] = { 0 };
74 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) 1);
76 TEST_COMPARE (buf
[0], 0x7F);
77 TEST_VERIFY (mbsinit (&s
));
80 /* First character in the code point range that maps to two code units. */
82 const char *mbs
= "\xC2\x80"; /* 0xC2 0x80 => U+0080 */
83 char8_t buf
[1] = { 0 };
86 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) 2);
88 TEST_COMPARE (buf
[0], 0xC2);
89 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
90 TEST_COMPARE (buf
[0], 0x80);
91 TEST_VERIFY (mbsinit (&s
));
94 /* Same as last test, but one code unit at a time. */
96 const char *mbs
= "\xC2\x80"; /* 0xC2 0x80 => U+0080 */
97 char8_t buf
[1] = { 0 };
100 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
102 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) 1);
104 TEST_COMPARE (buf
[0], 0xC2);
105 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
106 TEST_COMPARE (buf
[0], 0x80);
107 TEST_VERIFY (mbsinit (&s
));
110 /* Last character in the code point range that maps to two code units. */
112 const char *mbs
= "\xDF\xBF"; /* 0xDF 0xBF => U+07FF */
113 char8_t buf
[1] = { 0 };
116 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) 2);
118 TEST_COMPARE (buf
[0], 0xDF);
119 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
120 TEST_COMPARE (buf
[0], 0xBF);
121 TEST_VERIFY (mbsinit (&s
));
124 /* Same as last test, but one code unit at a time. */
126 const char *mbs
= "\xDF\xBF"; /* 0xDF 0xBF => U+07FF */
127 char8_t buf
[1] = { 0 };
130 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
132 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) 1);
134 TEST_COMPARE (buf
[0], 0xDF);
135 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
136 TEST_COMPARE (buf
[0], 0xBF);
137 TEST_VERIFY (mbsinit (&s
));
140 /* First character in the code point range that maps to three code units. */
142 const char *mbs
= u8
"\xE0\xA0\x80"; /* 0xE0 0xA0 0x80 => U+0800 */
143 char8_t buf
[1] = { 0 };
146 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) 3);
148 TEST_COMPARE (buf
[0], 0xE0);
149 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
150 TEST_COMPARE (buf
[0], 0xA0);
151 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
152 TEST_COMPARE (buf
[0], 0x80);
153 TEST_VERIFY (mbsinit (&s
));
156 /* Same as last test, but one code unit at a time. */
158 const char *mbs
= u8
"\xE0\xA0\x80"; /* 0xE0 0xA0 0x80 => U+0800 */
159 char8_t buf
[1] = { 0 };
162 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
164 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
166 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) 1);
168 TEST_COMPARE (buf
[0], 0xE0);
169 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
170 TEST_COMPARE (buf
[0], 0xA0);
171 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
172 TEST_COMPARE (buf
[0], 0x80);
173 TEST_VERIFY (mbsinit (&s
));
176 /* Last character in the code point range that maps to three code units
177 before the surrogate code point range. */
179 const char *mbs
= "\xED\x9F\xBF"; /* 0xED 0x9F 0xBF => U+D7FF */
180 char8_t buf
[1] = { 0 };
183 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) 3);
185 TEST_COMPARE (buf
[0], 0xED);
186 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
187 TEST_COMPARE (buf
[0], 0x9F);
188 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
189 TEST_COMPARE (buf
[0], 0xBF);
190 TEST_VERIFY (mbsinit (&s
));
193 /* Same as last test, but one code unit at a time. */
195 const char *mbs
= "\xED\x9F\xBF"; /* 0xED 0x9F 0xBF => U+D7FF */
196 char8_t buf
[1] = { 0 };
199 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
201 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
203 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) 1);
205 TEST_COMPARE (buf
[0], 0xED);
206 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
207 TEST_COMPARE (buf
[0], 0x9F);
208 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
209 TEST_COMPARE (buf
[0], 0xBF);
210 TEST_VERIFY (mbsinit (&s
));
213 /* First character in the code point range that maps to three code units
214 after the surrogate code point range. */
216 const char *mbs
= "\xEE\x80\x80"; /* 0xEE 0x80 0x80 => U+E000 */
217 char8_t buf
[1] = { 0 };
220 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) 3);
222 TEST_COMPARE (buf
[0], 0xEE);
223 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
224 TEST_COMPARE (buf
[0], 0x80);
225 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
226 TEST_COMPARE (buf
[0], 0x80);
227 TEST_VERIFY (mbsinit (&s
));
230 /* Same as last test, but one code unit at a time. */
232 const char *mbs
= "\xEE\x80\x80"; /* 0xEE 0x80 0x80 => U+E000 */
233 char8_t buf
[1] = { 0 };
236 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
238 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
240 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) 1);
242 TEST_COMPARE (buf
[0], 0xEE);
243 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
244 TEST_COMPARE (buf
[0], 0x80);
245 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
246 TEST_COMPARE (buf
[0], 0x80);
247 TEST_VERIFY (mbsinit (&s
));
252 const char *mbs
= "\xEF\xBB\xBF"; /* 0xEF 0xBB 0xBF => U+FEFF */
253 char8_t buf
[1] = { 0 };
256 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) 3);
258 TEST_COMPARE (buf
[0], 0xEF);
259 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
260 TEST_COMPARE (buf
[0], 0xBB);
261 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
262 TEST_COMPARE (buf
[0], 0xBF);
263 TEST_VERIFY (mbsinit (&s
));
266 /* Same as last test, but one code unit at a time. */
268 const char *mbs
= "\xEF\xBB\xBF"; /* 0xEF 0xBB 0xBF => U+FEFF */
269 char8_t buf
[1] = { 0 };
272 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
274 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
276 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) 1);
278 TEST_COMPARE (buf
[0], 0xEF);
279 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
280 TEST_COMPARE (buf
[0], 0xBB);
281 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
282 TEST_COMPARE (buf
[0], 0xBF);
283 TEST_VERIFY (mbsinit (&s
));
286 /* Replacement character. */
288 const char *mbs
= "\xEF\xBF\xBD"; /* 0xEF 0xBF 0xBD => U+FFFD */
289 char8_t buf
[1] = { 0 };
292 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) 3);
294 TEST_COMPARE (buf
[0], 0xEF);
295 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
296 TEST_COMPARE (buf
[0], 0xBF);
297 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
298 TEST_COMPARE (buf
[0], 0xBD);
299 TEST_VERIFY (mbsinit (&s
));
302 /* Same as last test, but one code unit at a time. */
304 const char *mbs
= "\xEF\xBF\xBD"; /* 0xEF 0xBF 0xBD => U+FFFD */
305 char8_t buf
[1] = { 0 };
308 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
310 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
312 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) 1);
314 TEST_COMPARE (buf
[0], 0xEF);
315 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
316 TEST_COMPARE (buf
[0], 0xBF);
317 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
318 TEST_COMPARE (buf
[0], 0xBD);
319 TEST_VERIFY (mbsinit (&s
));
322 /* Last character in the code point range that maps to three code units. */
324 const char *mbs
= "\xEF\xBF\xBF"; /* 0xEF 0xBF 0xBF => U+FFFF */
325 char8_t buf
[1] = { 0 };
328 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) 3);
330 TEST_COMPARE (buf
[0], 0xEF);
331 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
332 TEST_COMPARE (buf
[0], 0xBF);
333 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
334 TEST_COMPARE (buf
[0], 0xBF);
335 TEST_VERIFY (mbsinit (&s
));
338 /* Same as last test, but one code unit at a time. */
340 const char *mbs
= "\xEF\xBF\xBF"; /* 0xEF 0xBF 0xBF => U+FFFF */
341 char8_t buf
[1] = { 0 };
344 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
346 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
348 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) 1);
350 TEST_COMPARE (buf
[0], 0xEF);
351 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
352 TEST_COMPARE (buf
[0], 0xBF);
353 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
354 TEST_COMPARE (buf
[0], 0xBF);
355 TEST_VERIFY (mbsinit (&s
));
358 /* First character in the code point range that maps to four code units. */
360 const char *mbs
= "\xF0\x90\x80\x80"; /* 0xF0 0x90 0x80 0x80 => U+10000 */
361 char8_t buf
[1] = { 0 };
364 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) 4);
366 TEST_COMPARE (buf
[0], 0xF0);
367 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
368 TEST_COMPARE (buf
[0], 0x90);
369 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
370 TEST_COMPARE (buf
[0], 0x80);
371 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
372 TEST_COMPARE (buf
[0], 0x80);
373 TEST_VERIFY (mbsinit (&s
));
376 /* Same as last test, but one code unit at a time. */
378 const char *mbs
= "\xF0\x90\x80\x80"; /* 0xF0 0x90 0x80 0x80 => U+10000 */
379 char8_t buf
[1] = { 0 };
382 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
384 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
386 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
388 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) 1);
390 TEST_COMPARE (buf
[0], 0xF0);
391 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
392 TEST_COMPARE (buf
[0], 0x90);
393 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
394 TEST_COMPARE (buf
[0], 0x80);
395 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
396 TEST_COMPARE (buf
[0], 0x80);
397 TEST_VERIFY (mbsinit (&s
));
400 /* Last character in the code point range that maps to four code units. */
402 const char *mbs
= "\xF4\x8F\xBF\xBF"; /* 0xF4 0x8F 0xBF 0xBF => U+10FFFF */
403 char8_t buf
[1] = { 0 };
406 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) 4);
408 TEST_COMPARE (buf
[0], 0xF4);
409 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
410 TEST_COMPARE (buf
[0], 0x8F);
411 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
412 TEST_COMPARE (buf
[0], 0xBF);
413 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
414 TEST_COMPARE (buf
[0], 0xBF);
415 TEST_VERIFY (mbsinit (&s
));
418 /* Same as last test, but one code unit at a time. */
420 const char *mbs
= "\xF4\x8F\xBF\xBF"; /* 0xF4 0x8F 0xBF 0xBF => U+10FFFF */
421 char8_t buf
[1] = { 0 };
424 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
426 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
428 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
430 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) 1);
432 TEST_COMPARE (buf
[0], 0xF4);
433 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
434 TEST_COMPARE (buf
[0], 0x8F);
435 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
436 TEST_COMPARE (buf
[0], 0xBF);
437 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
438 TEST_COMPARE (buf
[0], 0xBF);
439 TEST_VERIFY (mbsinit (&s
));
446 test_big5_hkscs (void)
448 xsetlocale (LC_ALL
, "zh_HK.BIG5-HKSCS");
450 /* A double byte character that maps to a pair of two byte UTF-8 code unit
453 const char *mbs
= "\x88\x62"; /* 0x88 0x62 => U+00CA U+0304 */
454 char8_t buf
[1] = { 0 };
457 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) 2);
459 TEST_COMPARE (buf
[0], 0xC3);
460 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
461 TEST_COMPARE (buf
[0], 0x8A);
462 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
463 TEST_COMPARE (buf
[0], 0xCC);
464 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
465 TEST_COMPARE (buf
[0], 0x84);
466 TEST_VERIFY (mbsinit (&s
));
469 /* Same as last test, but one code unit at a time. */
471 const char *mbs
= "\x88\x62"; /* 0x88 0x62 => U+00CA U+0304 */
472 char8_t buf
[1] = { 0 };
475 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
477 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) 1);
479 TEST_COMPARE (buf
[0], 0xC3);
480 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
481 TEST_COMPARE (buf
[0], 0x8A);
482 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
483 TEST_COMPARE (buf
[0], 0xCC);
484 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
485 TEST_COMPARE (buf
[0], 0x84);
486 TEST_VERIFY (mbsinit (&s
));
489 /* Another double byte character that maps to a pair of two byte UTF-8 code
492 const char *mbs
= "\x88\xA5"; /* 0x88 0xA5 => U+00EA U+030C */
493 char8_t buf
[1] = { 0 };
496 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) 2);
498 TEST_COMPARE (buf
[0], 0xC3);
499 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
500 TEST_COMPARE (buf
[0], 0xAA);
501 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
502 TEST_COMPARE (buf
[0], 0xCC);
503 TEST_COMPARE (mbrtoc8 (buf
, mbs
, strlen (mbs
) + 1, &s
), (size_t) -3);
504 TEST_COMPARE (buf
[0], 0x8C);
505 TEST_VERIFY (mbsinit (&s
));
508 /* Same as last test, but one code unit at a time. */
510 const char *mbs
= "\x88\xA5"; /* 0x88 0xA5 => U+00EA U+030C */
511 char8_t buf
[1] = { 0 };
514 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -2);
516 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) 1);
518 TEST_COMPARE (buf
[0], 0xC3);
519 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
520 TEST_COMPARE (buf
[0], 0xAA);
521 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
522 TEST_COMPARE (buf
[0], 0xCC);
523 TEST_COMPARE (mbrtoc8 (buf
, mbs
, 1, &s
), (size_t) -3);
524 TEST_COMPARE (buf
[0], 0x8C);
525 TEST_VERIFY (mbsinit (&s
));
539 #include <support/test-driver.c>