test/string_tests.c

changeset 364
5577d6c27a33
parent 306
90b6d69bb499
child 378
952c2df7e7ac
equal deleted inserted replaced
363:8175ba2b3bcb 364:5577d6c27a33
450 UCX_TEST_ASSERT(!sstrsuffix(str, S("fox")), "suffix false positive"); 450 UCX_TEST_ASSERT(!sstrsuffix(str, S("fox")), "suffix false positive");
451 451
452 452
453 UCX_TEST_END 453 UCX_TEST_END
454 } 454 }
455
456 UCX_TEST(test_sstrcaseprefixsuffix) {
457 sstr_t str = ST("test my prefix and my suffix");
458 sstr_t empty = ST("");
459
460 UCX_TEST_BEGIN
461
462 UCX_TEST_ASSERT(!sstrcaseprefix(empty, S("pREf")), "prefix empty string fails");
463 UCX_TEST_ASSERT(!sstrcasesuffix(empty, S("sUf")), "suffix empty string fails");
464
465 UCX_TEST_ASSERT(sstrcaseprefix(str, empty), "empty prefix fails");
466 UCX_TEST_ASSERT(sstrcasesuffix(str, empty), "empty suffix fails");
467
468 UCX_TEST_ASSERT(sstrcaseprefix(empty, empty), "string and prefix empty fails");
469 UCX_TEST_ASSERT(sstrcasesuffix(empty, empty), "string and suffix empty fails");
470
471 UCX_TEST_ASSERT(sstrcaseprefix(str, S("TEST ")), "prefix false negative");
472 UCX_TEST_ASSERT(!sstrcaseprefix(str, S("8-) fsck ")), "prefix false positive");
473
474 UCX_TEST_ASSERT(sstrcasesuffix(str, S("FIX")), "suffix false negative");
475 UCX_TEST_ASSERT(!sstrcasesuffix(str, S("fox")), "suffix false positive");
476
477 UCX_TEST_END
478 }

mercurial