diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-05-14 23:59:05 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-05-14 23:59:05 +0200 |
commit | 1aeb7e2b426e7a94cdd4f83c4337f44c0f5a2ca8 (patch) | |
tree | b80d1751bebed6dd39c34fa0a1b832c714e57292 /test/_case-test.h | |
parent | a624e3343e1183aa0f2d4b05afea50eef348651a (diff) |
Add encoding-generic macros
Diffstat (limited to 'test/_case-test.h')
-rw-r--r-- | test/_case-test.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/test/_case-test.h b/test/_case-test.h index 701d884..24a18f1 100644 --- a/test/_case-test.h +++ b/test/_case-test.h @@ -14,7 +14,7 @@ #include <unicode/string.h> #define TESTFILE STR(CASETYPE) ".in" -#define FUNC CONCAT(u8, CASETYPE) +#define FUNC CONCAT(ucs, CASETYPE) static bool test(const char8_t *, int); @@ -54,22 +54,22 @@ test(const char8_t *line, int id) { struct u8view mapped, sv = {line, strlen(line)}; struct u8view before, after, flags; - u8cut(&before, &sv, U";", 1); - u8cut(&after, &sv, U";", 1); - u8cut(&flags, &sv, U";", 1); + ucscut(&before, &sv, U";", 1); + ucscut(&after, &sv, U";", 1); + ucscut(&flags, &sv, U";", 1); - enum caseflags cf = u8eq(flags, U8("ẞ")) ? CF_ẞ - : u8eq(flags, U8("AZ")) ? CF_LANG_AZ - : u8eq(flags, U8("LT")) ? CF_LANG_LT - : u8eq(flags, U8("NL")) ? CF_LANG_NL + enum caseflags cf = ucseq(flags, U8("ẞ")) ? CF_ẞ + : ucseq(flags, U8("AZ")) ? CF_LANG_AZ + : ucseq(flags, U8("LT")) ? CF_LANG_LT + : ucseq(flags, U8("NL")) ? CF_LANG_NL : 0; arena a = mkarena(0); - mapped.p = FUNC(&mapped.len, before, cf, alloc_arena, &(struct arena_ctx){ + mapped.p = FUNC(&mapped.len, before, cf, alloc_arena, &((struct arena_ctx){ .a = &a, - }); + })); - if (!u8eq(mapped, after)) { + if (!ucseq(mapped, after)) { warn("case %d: expected ‘%.*s’ but got ‘%.*s’", id, SV_PRI_ARGS(after), SV_PRI_ARGS(mapped)); arena_free(&a); |