test/string_tests.c

changeset 104
9d3dea320d8e
parent 103
08018864fb91
child 116
234920008754
--- a/test/string_tests.c	Thu Feb 28 08:50:24 2013 +0100
+++ b/test/string_tests.c	Fri Jun 21 10:27:03 2013 +0200
@@ -194,10 +194,18 @@
 }
 
 UCX_TEST_IMPLEMENT(test_sstrtrim) {
-    sstr_t test = sstrtrim(sstr((char*)"  ein test   "));
+    sstr_t t1 = sstrtrim(sstr((char*)"  ein test   "));
+    sstr_t t2 = sstrtrim(sstr((char*)"abc"));
+    sstr_t t3 = sstrtrim(sstr((char*)" 123"));
+    sstr_t t4 = sstrtrim(sstr((char*)"xyz "));
+    sstr_t t5 = sstrtrim(sstr((char*)"   "));
     sstr_t empty = sstrtrim(sstr((char*)""));
     UCX_TEST_BEGIN
-    UCX_TEST_ASSERT(strncmp(test.ptr, "ein test", test.length) == 0, "failed");
+    UCX_TEST_ASSERT(strncmp(t1.ptr, "ein test", t1.length) == 0, "failed");
+    UCX_TEST_ASSERT(strncmp(t2.ptr, "abc", t2.length) == 0, "failed");
+    UCX_TEST_ASSERT(strncmp(t3.ptr, "123", t3.length) == 0, "failed");
+    UCX_TEST_ASSERT(strncmp(t4.ptr, "xyz", t4.length) == 0, "failed");
+    UCX_TEST_ASSERT(t5.length == 0, "string t5 not empty");
     UCX_TEST_ASSERT(empty.length == 0, "empty string failed");
     UCX_TEST_END
 }

mercurial