From e5a4bfe05bea551fc17048548695810a1ca48f5c Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sat, 4 May 2024 02:04:51 +0200 Subject: Use a ternary --- test/_case-test.h | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'test') 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) { -- cgit v1.2.3