Debian Codegraph @

src/test/test-gunicode.c

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2
3 #include "gunicode.h"
4 #include "tests.h"
5 #include "utf8.h"
6
7 TEST(unichar_iswide) {
8 char32_t c;
9 int r;
10
11 /* FIXME: the cats are wide, but we get this wrong */
12 for (const char *narrow = "abX_…ąęµ!" "😼😿🙀😸😻"; *narrow; narrow += r) {
13 r = utf8_encoded_to_unichar(narrow, &c);
14 bool w = unichar_iswide(c);
15 assert_se(r > 0);
16 assert_se(!w);
17 }
18
19 for (const char *wide = "🐱/¥"; *wide; wide += r) {
20 r = utf8_encoded_to_unichar(wide, &c);
21 bool w = unichar_iswide(c);
22 assert_se(r > 0);
23 assert_se(w);
24 }
25 }
26
27 DEFINE_TEST_MAIN(LOG_INFO);