diff -r 8175ba2b3bcb -r 5577d6c27a33 test/string_tests.c --- a/test/string_tests.c Sun Nov 03 16:22:46 2019 +0100 +++ b/test/string_tests.c Sun Nov 03 16:34:29 2019 +0100 @@ -452,3 +452,27 @@ UCX_TEST_END } + +UCX_TEST(test_sstrcaseprefixsuffix) { + sstr_t str = ST("test my prefix and my suffix"); + sstr_t empty = ST(""); + + UCX_TEST_BEGIN + + UCX_TEST_ASSERT(!sstrcaseprefix(empty, S("pREf")), "prefix empty string fails"); + UCX_TEST_ASSERT(!sstrcasesuffix(empty, S("sUf")), "suffix empty string fails"); + + UCX_TEST_ASSERT(sstrcaseprefix(str, empty), "empty prefix fails"); + UCX_TEST_ASSERT(sstrcasesuffix(str, empty), "empty suffix fails"); + + UCX_TEST_ASSERT(sstrcaseprefix(empty, empty), "string and prefix empty fails"); + UCX_TEST_ASSERT(sstrcasesuffix(empty, empty), "string and suffix empty fails"); + + UCX_TEST_ASSERT(sstrcaseprefix(str, S("TEST ")), "prefix false negative"); + UCX_TEST_ASSERT(!sstrcaseprefix(str, S("8-) fsck ")), "prefix false positive"); + + UCX_TEST_ASSERT(sstrcasesuffix(str, S("FIX")), "suffix false negative"); + UCX_TEST_ASSERT(!sstrcasesuffix(str, S("fox")), "suffix false positive"); + + UCX_TEST_END +}