update options for pip installation in README.md
[liba.git] / test / utf.h
blobcefcd359d68f2d55a58e08e4ef0e725d7a32f1b0
1 #define MAIN(x) utf##x
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;