tests/test_string.c

changeset 1694
a2757c6427cc
parent 1693
c2d05cf1a062
equal deleted inserted replaced
1693:c2d05cf1a062 1694:a2757c6427cc
341 CX_TEST(test_strat) { 341 CX_TEST(test_strat) {
342 cxstring str = cx_str("Hello, World!"); 342 cxstring str = cx_str("Hello, World!");
343 343
344 CX_TEST_DO { 344 CX_TEST_DO {
345 // the entire string 345 // the entire string
346 for (off_t i = 0; i < str.length; i++) { 346 for (off_t i = 0; i < (off_t) str.length; i++) {
347 CX_TEST_ASSERT(cx_strat(str, i) == str.ptr[i]); 347 CX_TEST_ASSERT(cx_strat(str, i) == str.ptr[i]);
348 } 348 }
349 // the entire string backwards 349 // the entire string backwards
350 for (off_t i = 1; i <= (off_t) str.length; i++) { 350 for (off_t i = 1; i <= (off_t) str.length; i++) {
351 CX_TEST_ASSERT(cx_strat(str, -i) == str.ptr[str.length-i]); 351 CX_TEST_ASSERT(cx_strat(str, -i) == str.ptr[str.length-i]);

mercurial