Simplify TEST_CHAR_CLASS by using TEST for each character separately. This increases the number of tests to 3598, but avoids the need for using internal functions and test_msg() for custom messages. The resulting macro has minimal test setup overhead. Signed-off-by: René Scharfe <l.s.r@xxxxxx> --- t/unit-tests/t-ctype.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/t/unit-tests/t-ctype.c b/t/unit-tests/t-ctype.c index 56dfefb68e..aa728175a6 100644 --- a/t/unit-tests/t-ctype.c +++ b/t/unit-tests/t-ctype.c @@ -1,17 +1,12 @@ #include "test-lib.h" #define TEST_CHAR_CLASS(class, string) do { \ - int skip = test__run_begin(); \ - if (!skip) { \ - for (int i = 0; i < 256; i++) { \ - int expect = !!memchr(string, i, sizeof(string) - 1); \ - if (!check_int(class(i), ==, expect)) \ - test_msg(" i: 0x%02x", i); \ - } \ - if (!check(!class(EOF))) \ - test_msg(" i: 0x%02x (EOF)", EOF); \ + for (int i = 0; i < 256; i++) { \ + int expect = !!memchr(string, i, sizeof(string) - 1); \ + TEST(check_int(class(i), ==, expect), \ + #class "(0x%02x) works", i); \ } \ - test__run_end(!skip, TEST_LOCATION(), #class " works"); \ + TEST(check(!class(EOF)), #class "(EOF) works"); \ } while (0) #define DIGIT "0123456789" -- 2.44.0