diff options
-rw-r--r-- | test/_brk-test.h | 12 | ||||
-rw-r--r-- | test/_case-test.h | 18 | ||||
-rw-r--r-- | test/gbrk-test.c | 3 | ||||
-rw-r--r-- | test/lower-test.c | 3 | ||||
-rw-r--r-- | test/title-test.c | 3 | ||||
-rw-r--r-- | test/upper-test.c | 3 | ||||
-rw-r--r-- | test/wbrk-test.c | 3 |
7 files changed, 24 insertions, 21 deletions
diff --git a/test/_brk-test.h b/test/_brk-test.h index 3a66f23..69e7e0a 100644 --- a/test/_brk-test.h +++ b/test/_brk-test.h @@ -1,5 +1,5 @@ -#ifndef BRKTYPE -# error "BRKTYPE is not defined!" +#if !defined(BRKTYPE) || !defined(BRKTYPE_LONG) +# error "BRKTYPE and BRKTYPE_LONG must be defined" #endif #define _GNU_SOURCE @@ -86,8 +86,8 @@ test(struct u8view sv, int id) /* Assert the item count is correct */ size_t items_got = CNTFUNC(buf); if (items_got != items.len) { - warn("case %d: expected %zu items(s) but got %zu: ‘%s’", id, items.len, - items_got, sv.p); + warn("case %d: expected %zu %s(s) but got %zu: ‘%s’", id, items.len, + STR(BRKTYPE_LONG), items_got, sv.p); return false; } @@ -96,8 +96,8 @@ test(struct u8view sv, int id) for (size_t i = 0; ITERFUNC(&it1, &buf_cpy); i++) { item it2 = items.buf[i]; if (!u8eq(it1, ((struct u8view){it2.buf, it2.len}))) { - warn("case %d: expected item ‘%.*s’ but got ‘%.*s’", id, - (int)it2.len, it2.buf, SV_PRI_ARGS(it1)); + warn("case %d: expected %s ‘%.*s’ but got ‘%.*s’", id, + STR(BRKTYPE_LONG), (int)it2.len, it2.buf, SV_PRI_ARGS(it1)); return false; } } diff --git a/test/_case-test.h b/test/_case-test.h index c594554..91e928c 100644 --- a/test/_case-test.h +++ b/test/_case-test.h @@ -1,5 +1,5 @@ -#ifndef CASETYPE -# error "CASETYPE is not defined!" +#if !defined(CASETYPE) || !defined(CASETYPE_VERB) +# error "CASETYPE and CASETYPE_VERB must be defined" #endif #define _GNU_SOURCE @@ -66,23 +66,21 @@ test(const char8_t *line, int id) char8_t *buf = bufalloc(nullptr, 1, after.len); size_t bufsz = FUNC(nullptr, 0, before, cf); if (bufsz != after.len) { - warn("case %d: expected %scased buffer size of %zu but got %zu " - "(flags=‘%.*s’)", - id, STR(CASETYPE), after.len, bufsz, SV_PRI_ARGS(flags)); + warn("case %d: expected %s buffer size of %zu but got %zu (flags=‘%.*s’)", + id, STR(CASETYPE_VERB), after.len, bufsz, SV_PRI_ARGS(flags)); return false; } bufsz = FUNC(buf, bufsz, before, cf); if (bufsz != after.len) { - warn("case %d: expected %scased length of %zu but got %zu " - "(flags=‘%.*s’)", - id, STR(CASETYPE), after.len, bufsz, SV_PRI_ARGS(flags)); + warn("case %d: expected %scased length of %zu but got %zu (flags=‘%.*s’)", + id, STR(CASETYPE_VERB), after.len, bufsz, SV_PRI_ARGS(flags)); return false; } if (!memeq(buf, after.p, bufsz)) { - warn("case %d: expected ‘%.*s’ but got ‘%.*s’ (flags=‘%.*s’)", id, - SV_PRI_ARGS(after), (int)bufsz, buf, SV_PRI_ARGS(flags)); + warn("case %d: expected ‘%.*s’ but got ‘%.*s’ (flags=‘%.*s’)", + id, SV_PRI_ARGS(after), (int)bufsz, buf, SV_PRI_ARGS(flags)); return false; } diff --git a/test/gbrk-test.c b/test/gbrk-test.c index 4e4a602..e2a3478 100644 --- a/test/gbrk-test.c +++ b/test/gbrk-test.c @@ -1,2 +1,3 @@ -#define BRKTYPE g +#define BRKTYPE g +#define BRKTYPE_LONG grapheme #include "_brk-test.h" diff --git a/test/lower-test.c b/test/lower-test.c index a9a56ca..3523917 100644 --- a/test/lower-test.c +++ b/test/lower-test.c @@ -1,2 +1,3 @@ -#define CASETYPE lower +#define CASETYPE lower +#define CASETYPE_VERB lowercased #include "_case-test.h" diff --git a/test/title-test.c b/test/title-test.c index 8f66fcd..38fbe77 100644 --- a/test/title-test.c +++ b/test/title-test.c @@ -1,2 +1,3 @@ -#define CASETYPE title +#define CASETYPE title +#define CASETYPE_VERB titlecased #include "_case-test.h" diff --git a/test/upper-test.c b/test/upper-test.c index 81db918..6448ed3 100644 --- a/test/upper-test.c +++ b/test/upper-test.c @@ -1,2 +1,3 @@ -#define CASETYPE upper +#define CASETYPE upper +#define CASETYPE_VERB uppercased #include "_case-test.h" diff --git a/test/wbrk-test.c b/test/wbrk-test.c index 0690eae..e964d4e 100644 --- a/test/wbrk-test.c +++ b/test/wbrk-test.c @@ -1,2 +1,3 @@ -#define BRKTYPE w +#define BRKTYPE w +#define BRKTYPE_LONG word #include "_brk-test.h" |