From 2f4cb88d5c60f725323739300bb49dfa8923e7d5 Mon Sep 17 00:00:00 2001 From: Albert Cervin Date: Wed, 2 Nov 2022 22:20:04 +0100 Subject: =?UTF-8?q?=F0=9F=8E=89=20And=20so=20it=20begins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/utf8.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 test/utf8.c (limited to 'test/utf8.c') 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); } -- cgit v1.2.3