test/string_tests.c

changeset 116
234920008754
parent 104
9d3dea320d8e
child 123
7fb0f74517c5
--- a/test/string_tests.c	Wed Jul 17 12:32:03 2013 +0200
+++ b/test/string_tests.c	Wed Jul 17 15:56:01 2013 +0200
@@ -41,9 +41,9 @@
 }
 
 UCX_TEST_IMPLEMENT(test_sstr_len_cat) {
-    sstr_t s1 = S("1234");
-    sstr_t s2 = S(".:.:.");
-    sstr_t s3 = S("X");
+    sstr_t s1 = ST("1234");
+    sstr_t s2 = ST(".:.:.");
+    sstr_t s3 = ST("X");
     
     size_t len = sstrnlen(3, s1, s2, s3);
     sstr_t cat;
@@ -72,7 +72,7 @@
 UCX_TEST_IMPLEMENT(test_sstrsplit) {
 
     const char *original = "this,is,a,csv,string";
-    sstr_t test = S("this,is,a,csv,string"); /* use copy of original here */
+    sstr_t test = ST("this,is,a,csv,string"); /* use copy of original here */
     size_t n;
     sstr_t *list;
 
@@ -80,12 +80,12 @@
 
     /* Nullpointer check */
     n = 0;
-    UCX_TEST_ASSERT(sstrsplit(test, ST(""), &n) == NULL,
+    UCX_TEST_ASSERT(sstrsplit(test, S(""), &n) == NULL,
             "empty delimiter must return NULL");
 
     /* no delimiter occurence (ndo) */
     n = 0;
-    list = sstrsplit(test, ST("z"), &n);
+    list = sstrsplit(test, S("z"), &n);
     UCX_TEST_ASSERT(n == 1, "ndo, list length must be 1");
     UCX_TEST_ASSERT(strcmp(list[0].ptr, original) == 0, "ndo, "
             "original string shall be returned as single list element");
@@ -95,7 +95,7 @@
 
     /* partially matching delimiter (pmd) */
     n = 0;
-    list = sstrsplit(test, ST("stringbuilder"), &n);
+    list = sstrsplit(test, S("stringbuilder"), &n);
     UCX_TEST_ASSERT(n == 1, "pmd, list length must be 1");
     UCX_TEST_ASSERT(strcmp(list[0].ptr, original) == 0, "pmd, "
             "original string shall be returned as single list element");
@@ -105,7 +105,7 @@
 
     /* matching single-char delimiter (mscd) */
     n = 0;
-    list = sstrsplit(test, ST(","), &n);
+    list = sstrsplit(test, S(","), &n);
     UCX_TEST_ASSERT(n == 5, "mscd, list length must be 5");
     UCX_TEST_ASSERT(strcmp(list[0].ptr, "this") == 0, "mscd, item 0 mismatch");
     UCX_TEST_ASSERT(strcmp(list[1].ptr, "is") == 0, "mscd, item 1 mismatch");
@@ -118,7 +118,7 @@
 
     /* matching multi-char delimiter (mmcd) */
     n = 0;
-    list = sstrsplit(test, ST("is"), &n);
+    list = sstrsplit(test, S("is"), &n);
     UCX_TEST_ASSERT(n == 3, "mscd, list length must be 3");
     UCX_TEST_ASSERT(strcmp(list[0].ptr, "th") == 0, "mmcd, item 0 mismatch");
     UCX_TEST_ASSERT(strcmp(list[1].ptr, ",") == 0, "mmcd, item 1 mismatch");
@@ -130,7 +130,7 @@
 
     /* bounded list using single-char delimiter (blsc) */
     n = 3;
-    list = sstrsplit(test, ST(","), &n);
+    list = sstrsplit(test, S(","), &n);
     UCX_TEST_ASSERT(n == 3, "blsc, list length must be 3");
     UCX_TEST_ASSERT(strcmp(list[0].ptr, "this") == 0, "blsc, item 0 mismatch");
     UCX_TEST_ASSERT(strcmp(list[1].ptr, "is") == 0, "blsc, item 1 mismatch");
@@ -142,7 +142,7 @@
 
     /* bounded list using multi-char delimiter (blmc) */
     n = 2;
-    list = sstrsplit(test, ST("is"), &n);
+    list = sstrsplit(test, S("is"), &n);
     UCX_TEST_ASSERT(n == 2, "blmc, list length must be 2");
     UCX_TEST_ASSERT(strcmp(list[0].ptr, "th") == 0, "blmc, item 0 mismatch");
     UCX_TEST_ASSERT(strcmp(list[1].ptr, ",is,a,csv,string") == 0,
@@ -153,7 +153,7 @@
 
     /* start with delimiter (swd) */
     n = 0;
-    list = sstrsplit(test, ST("this"), &n);
+    list = sstrsplit(test, S("this"), &n);
     UCX_TEST_ASSERT(n == 2, "swd, list length must be 2");
     UCX_TEST_ASSERT(list[0].length == 0, "swd, first item must be empty");
     UCX_TEST_ASSERT(strcmp(list[1].ptr, ",is,a,csv,string") == 0,
@@ -164,7 +164,7 @@
 
     /* end with delimiter (ewd) */
     n = 0;
-    list = sstrsplit(test, ST("string"), &n);
+    list = sstrsplit(test, S("string"), &n);
     UCX_TEST_ASSERT(n == 2, "ewd, list length must be 2");
     UCX_TEST_ASSERT(strcmp(list[0].ptr, "this,is,a,csv,") == 0,
             "swd, first item corrupt");
@@ -175,14 +175,14 @@
 
     /* exact match (exm) */
     n = 0;
-    list = sstrsplit(test, ST("this,is,a,csv,string"), &n);
+    list = sstrsplit(test, S("this,is,a,csv,string"), &n);
     UCX_TEST_ASSERT(n == 0, "exm, list length must be 0");
     UCX_TEST_ASSERT(list == NULL, "exm, list must be NULL");
     free(list);
 
     /* substring (subs) */
     n = 0;
-    list = sstrsplit(test, ST("this,is,a,csv,string,with,extension"), &n);
+    list = sstrsplit(test, S("this,is,a,csv,string,with,extension"), &n);
     UCX_TEST_ASSERT(n == 1, "subs, list length must be 1");
     UCX_TEST_ASSERT(strcmp(list[0].ptr, original) == 0,
             "subs, single item must be the original string");

mercurial