change gcc to clang in docs.yaml
[liba.git] / test / utf.h
blob36c20175b812ec692633bb63b1f3275ab93dcc3f
1 #define MAIN_(x) A_CAST_2(x, _utf)
2 #include "test.h"
3 #include "a/utf.h"
5 int MAIN(int argc, char *argv[]) // NOLINT(misc-definitions-in-headers)
7 for (int i = 1; i < argc; ++i)
9 char buf[7];
10 a_u32 val = 0;
11 unsigned int offset = 0;
12 debug("%s %u", argv[i], a_cast_s(unsigned int, a_utf_length(argv[i])));
13 for (char const *s = argv[i]; (void)(offset = a_utf_decode(s, &val)), offset; s += offset)
15 a_utf_encode(A_NULL, val);
16 buf[a_utf_encode(buf, val)] = 0;
17 debug(" %s:%" PRIu32, buf, val);
18 if (!*s) { break; }
20 debug("\n");
22 return 0;