test/string_tests.c

changeset 213
fa8b745be7b5
parent 198
b0f4fb043b47
child 214
2bc19726c340
--- a/test/string_tests.c	Thu Oct 22 11:35:40 2015 +0200
+++ b/test/string_tests.c	Mon Oct 26 14:09:45 2015 +0100
@@ -293,6 +293,19 @@
         free(list[i].ptr);
     }
     free(list);
+    
+    /* double encounter delimiter (ded) */
+    n = 0;
+    list = sstrsplit(test, S("is,"), &n);
+    UCX_TEST_ASSERT(n == 3, "ded, list length must be 3");
+    UCX_TEST_ASSERT(strcmp(list[0].ptr, "th") == 0, "ded, item 0 mismatch");
+    UCX_TEST_ASSERT(list[1].length == 0, "ded, item 1 not empty!");
+    UCX_TEST_ASSERT(strcmp(list[2].ptr, "a,csv,string") == 0,
+        "ded, item 2 mismatch");
+    for(int i=0;i<n;i++) {
+        free(list[i].ptr);
+    }
+    free(list);
 
     UCX_TEST_END
 }

mercurial