aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-05-04 02:04:51 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-05-04 02:04:51 +0200
commite5a4bfe05bea551fc17048548695810a1ca48f5c (patch)
tree9a6d911cdad5dc437006662312b9a60de9c098e8 /test
parent2030a059606ec4895f61828761da3b51a17963e7 (diff)
Use a ternary
Diffstat (limited to 'test')
-rw-r--r--test/_case-test.h15
1 files changed, 5 insertions, 10 deletions
diff --git a/test/_case-test.h b/test/_case-test.h
index 997eecd..121667a 100644
--- a/test/_case-test.h
+++ b/test/_case-test.h
@@ -60,16 +60,11 @@ test(const char8_t *line, int id)
after.len = flags.p - after.p - 1;
flags.len = strlen(flags.p);
- enum caseflags cf = 0;
- if (u8eq(U8_ARGS(flags), U8_ARGS(U8("ẞ"))))
- cf |= CF_ẞ;
- else if (u8eq(U8_ARGS(flags), U8_ARGS(U8("AZ"))))
- cf |= CF_LANG_AZ;
- else if (u8eq(U8_ARGS(flags), U8_ARGS(U8("LT"))))
- cf |= CF_LANG_LT;
- else if (u8eq(U8_ARGS(flags), U8_ARGS(U8("NL"))))
- cf |= CF_LANG_NL;
-
+ enum caseflags cf = u8eq(U8_ARGS(flags), U8_ARGS(U8("ẞ"))) ? CF_ẞ
+ : u8eq(U8_ARGS(flags), U8_ARGS(U8("AZ"))) ? CF_LANG_AZ
+ : u8eq(U8_ARGS(flags), U8_ARGS(U8("LT"))) ? CF_LANG_LT
+ : u8eq(U8_ARGS(flags), U8_ARGS(U8("NL"))) ? CF_LANG_NL
+ : 0;
char8_t *buf = bufalloc(nullptr, 1, after.len);
size_t bufsz = FUNC(nullptr, 0, U8_ARGS(before), cf);
if (bufsz != after.len) {