From f5e48e94a2f4d4bbd6e5628c7f2afafc6dbcc459 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 7 Mar 2024 17:28:52 -0500 Subject: build: Build mlibc + add distclean target Signed-off-by: Ian Moffett --- lib/mlibc/tests/ansi/mbrtoc32.c | 53 ----------------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 lib/mlibc/tests/ansi/mbrtoc32.c (limited to 'lib/mlibc/tests/ansi/mbrtoc32.c') diff --git a/lib/mlibc/tests/ansi/mbrtoc32.c b/lib/mlibc/tests/ansi/mbrtoc32.c deleted file mode 100644 index 781bc71..0000000 --- a/lib/mlibc/tests/ansi/mbrtoc32.c +++ /dev/null @@ -1,53 +0,0 @@ -#include -#include -#include -#include -#include -#include - -struct { - size_t ret; - char32_t c32; - uint8_t bytes[4]; -} expected_results[] = { - {1, 0x7A, {0x7A, 0, 0, 0}}, - {2, 0xDF, {0xC3, 0x9F, 0, 0}}, - {3, 0x6C34, {0xE6, 0xB0, 0xB4, 0}}, - {4, 0x1F34C, {0xF0, 0x9F, 0x8D, 0x8C}}, -}; - -int main() { - setlocale(LC_ALL, "en_US.utf8"); - - size_t ret = 0; - - char *str = "z\u00df\u6c34\U0001F34C"; - - fprintf(stderr, "string: '%s'\n", str); - - mbstate_t state = {}; - char32_t c32; - size_t loop = 0; - while((ret = mbrtoc32(&c32, str, strlen(str), &state))) { - assert(ret != (size_t)-3); - if(ret == (size_t)-1) - break; - if(ret == (size_t)-2) - break; - - fprintf(stderr, "Next UTF-32 char: 0x%x obtained from %zu bytes [", c32, ret); - for(size_t n = 0; n < ret; ++n) { - fprintf(stderr, " 0x%02x ", (uint8_t) str[n]); - } - fprintf(stderr, "]\n"); - - assert(ret == expected_results[loop].ret); - assert(c32 == expected_results[loop].c32); - for(size_t n = 0; n < ret; ++n) { - assert((uint8_t) str[n] == expected_results[loop].bytes[n]); - } - - str += ret; - loop++; - } -} -- cgit v1.2.3