diff options
Diffstat (limited to 'test/utf8.c')
| -rw-r--r-- | test/utf8.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/utf8.c b/test/utf8.c new file mode 100644 index 0000000..5b020c3 --- /dev/null +++ b/test/utf8.c @@ -0,0 +1,13 @@ +#include "utf8.h" +#include "assert.h" +#include "test.h" +#include "wchar.h" + +void test_nchars_nbytes() { + ASSERT(utf8_nchars((uint8_t *)"👴", 2) == 1, + "Expected old man emoji to be 1 char"); + ASSERT(utf8_nbytes((uint8_t *)"👴", 1) == 4, + "Expected old man emoji to be 4 bytes"); +} + +void run_utf8_tests() { run_test(test_nchars_nbytes); } |
