tests/test_string.c

changeset 1693
c2d05cf1a062
parent 1685
0344372c7115
child 1694
a2757c6427cc
equal deleted inserted replaced
1692:56731bb98508 1693:c2d05cf1a062
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 (size_t i = 0; i < str.length; i++) { 346 for (off_t i = 0; i < 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