test/string_tests.c

changeset 213
fa8b745be7b5
parent 198
b0f4fb043b47
child 214
2bc19726c340
equal deleted inserted replaced
212:c766c423dee6 213:fa8b745be7b5
291 "subs, original has been modified"); 291 "subs, original has been modified");
292 for(int i=0;i<n;i++) { 292 for(int i=0;i<n;i++) {
293 free(list[i].ptr); 293 free(list[i].ptr);
294 } 294 }
295 free(list); 295 free(list);
296
297 /* double encounter delimiter (ded) */
298 n = 0;
299 list = sstrsplit(test, S("is,"), &n);
300 UCX_TEST_ASSERT(n == 3, "ded, list length must be 3");
301 UCX_TEST_ASSERT(strcmp(list[0].ptr, "th") == 0, "ded, item 0 mismatch");
302 UCX_TEST_ASSERT(list[1].length == 0, "ded, item 1 not empty!");
303 UCX_TEST_ASSERT(strcmp(list[2].ptr, "a,csv,string") == 0,
304 "ded, item 2 mismatch");
305 for(int i=0;i<n;i++) {
306 free(list[i].ptr);
307 }
308 free(list);
296 309
297 UCX_TEST_END 310 UCX_TEST_END
298 } 311 }
299 312
300 UCX_TEST(test_sstrtrim) { 313 UCX_TEST(test_sstrtrim) {

mercurial