diff -r e86049631677 -r 87638f19f6dd test/base64.c --- a/test/base64.c Wed Dec 31 16:41:16 2025 +0100 +++ b/test/base64.c Wed Jan 07 22:23:43 2026 +0100 @@ -35,20 +35,20 @@ #include #include -UCX_TEST(test_util_base64decode) { +CX_TEST(test_util_base64decode) { char *s1 = util_base64decode("YWJj"); char *s2 = util_base64decode("aGVsbG8gd29ybGQ="); char *s3 = util_base64decode("MA=="); char *s4 = util_base64decode("MHh4MQ=="); - UCX_TEST_BEGIN; + CX_TEST_DO { - UCX_TEST_ASSERT(!strcmp(s1, "abc"), "s1 wrong"); - UCX_TEST_ASSERT(!strcmp(s2, "hello world"), "s2 wrong"); - UCX_TEST_ASSERT(!strcmp(s3, "0"), "s3 wrong"); - UCX_TEST_ASSERT(!strcmp(s4, "0xx1"), "s4 wrong"); + CX_TEST_ASSERTMM(!strcmp(s1, "abc"), "s1 wrong"); + CX_TEST_ASSERTMM(!strcmp(s2, "hello world"), "s2 wrong"); + CX_TEST_ASSERTMM(!strcmp(s3, "0"), "s3 wrong"); + CX_TEST_ASSERTMM(!strcmp(s4, "0xx1"), "s4 wrong"); - UCX_TEST_END; + } free(s1); free(s2); @@ -56,7 +56,7 @@ free(s4); } -UCX_TEST(test_util_base64decode_len) { +CX_TEST(test_util_base64decode_len) { int len1, len2, len3, len4, len5, len6; char *s1 = util_base64decode_len("aGVsbG8=", &len1); // 5 char *s2 = util_base64decode_len("MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5", &len2); // 30 @@ -65,27 +65,27 @@ char *s5 = util_base64decode_len("YWJjLS0tLS0tM3g=", &len5); // 11 char *s6 = util_base64decode_len("YWJjZGVmZy4uLjs7MGhlbGxv", &len6); // 18 - UCX_TEST_BEGIN; - - UCX_TEST_ASSERT(!strcmp(s1, "hello"), "s1 wrong"); - UCX_TEST_ASSERT(len1 == 5, "len1 wrong"); - - UCX_TEST_ASSERT(!strcmp(s2, "012345678901234567890123456789"), "s2 wrong"); - UCX_TEST_ASSERT(len2 == 30, "len2 wrong"); - - UCX_TEST_ASSERT(!strcmp(s3, "."), "s3 wrong"); - UCX_TEST_ASSERT(len3 == 1, "len3 wrong"); + CX_TEST_DO { - UCX_TEST_ASSERT(!strcmp(s4, "lol"), "s4 wrong"); - UCX_TEST_ASSERT(len4 == 3, "len4 wrong"); + CX_TEST_ASSERTMM(!strcmp(s1, "hello"), "s1 wrong"); + CX_TEST_ASSERTMM(len1 == 5, "len1 wrong"); + + CX_TEST_ASSERTMM(!strcmp(s2, "012345678901234567890123456789"), "s2 wrong"); + CX_TEST_ASSERTMM(len2 == 30, "len2 wrong"); + + CX_TEST_ASSERTMM(!strcmp(s3, "."), "s3 wrong"); + CX_TEST_ASSERTMM(len3 == 1, "len3 wrong"); + + CX_TEST_ASSERTMM(!strcmp(s4, "lol"), "s4 wrong"); + CX_TEST_ASSERTMM(len4 == 3, "len4 wrong"); + + CX_TEST_ASSERTMM(!strcmp(s5, "abc------3x"), "s5 wrong"); + CX_TEST_ASSERTMM(len5 == 11, "len5 wrong"); + + CX_TEST_ASSERTMM(!strcmp(s6, "abcdefg...;;0hello"), "s6 failed"); + CX_TEST_ASSERTMM(len6 == 18, "len6 wrong"); - UCX_TEST_ASSERT(!strcmp(s5, "abc------3x"), "s5 wrong"); - UCX_TEST_ASSERT(len5 == 11, "len5 wrong"); - - UCX_TEST_ASSERT(!strcmp(s6, "abcdefg...;;0hello"), "s6 failed"); - UCX_TEST_ASSERT(len6 == 18, "len6 wrong"); - - UCX_TEST_END; + } free(s1); free(s2); @@ -95,7 +95,7 @@ free(s6); } -UCX_TEST(test_util_base64encode) { +CX_TEST(test_util_base64encode) { char *str1 = "hello world"; char *str2 = "test string"; char *str3 = "01234567890123456789012345678901234567890123456789"; @@ -127,21 +127,21 @@ char *b9 = util_base64encode(str9, strlen(str9)); char *b10 = util_base64encode(str10, strlen(str10)); - UCX_TEST_BEGIN; - - UCX_TEST_ASSERT(!strcmp(b1, "aGVsbG8gd29ybGQ="), "b1 failed"); - UCX_TEST_ASSERT(!strcmp(b2, "dGVzdCBzdHJpbmc="), "b2 failed"); - UCX_TEST_ASSERT(!strcmp(b3, "MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODk="), "b3 failed"); - UCX_TEST_ASSERT(!strcmp(b4, "AAwDMgJuPwE="), "b4 failed"); + CX_TEST_DO { - UCX_TEST_ASSERT(!strcmp(b5, "YQ=="), "b5 failed"); - UCX_TEST_ASSERT(!strcmp(b6, "YWI="), "b6 failed"); - UCX_TEST_ASSERT(!strcmp(b7, "YWJj"), "b7 failed"); - UCX_TEST_ASSERT(!strcmp(b8, "YWJjZA=="), "b8 failed"); - UCX_TEST_ASSERT(!strcmp(b9, "YWJjZGU="), "b9 failed"); - UCX_TEST_ASSERT(!strcmp(b10, "YWJjZGVm"), "b10 failed"); + CX_TEST_ASSERTMM(!strcmp(b1, "aGVsbG8gd29ybGQ="), "b1 failed"); + CX_TEST_ASSERTMM(!strcmp(b2, "dGVzdCBzdHJpbmc="), "b2 failed"); + CX_TEST_ASSERTMM(!strcmp(b3, "MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODk="), "b3 failed"); + CX_TEST_ASSERTMM(!strcmp(b4, "AAwDMgJuPwE="), "b4 failed"); + + CX_TEST_ASSERTMM(!strcmp(b5, "YQ=="), "b5 failed"); + CX_TEST_ASSERTMM(!strcmp(b6, "YWI="), "b6 failed"); + CX_TEST_ASSERTMM(!strcmp(b7, "YWJj"), "b7 failed"); + CX_TEST_ASSERTMM(!strcmp(b8, "YWJjZA=="), "b8 failed"); + CX_TEST_ASSERTMM(!strcmp(b9, "YWJjZGU="), "b9 failed"); + CX_TEST_ASSERTMM(!strcmp(b10, "YWJjZGVm"), "b10 failed"); - UCX_TEST_END; + } free(b1); free(b2);