tests/test_string.c

changeset 1646
85fd3ff8416e
parent 1582
32b82c424252
--- a/tests/test_string.c	Sun Dec 21 11:09:46 2025 +0100
+++ b/tests/test_string.c	Sun Dec 21 23:58:30 2025 +0100
@@ -162,6 +162,12 @@
         CX_TEST_ASSERT(0 == cx_strcmp(dup, "test str"));
         ASSERT_ZERO_TERMINATED(dup);
         cx_strfree_a(alloc, &dup);
+
+        // copy a plain C-string
+        CX_TEST_ASSERT(0 == cx_strcpy_a(alloc, &dup, "a c-string test"));
+        CX_TEST_ASSERT(0 == cx_strcmp(dup, "a c-string test"));
+        ASSERT_ZERO_TERMINATED(dup);
+        cx_strfree_a(alloc, &dup);
     }
     cx_testing_allocator_destroy(&talloc);
 }
@@ -293,14 +299,14 @@
     cxmutstr longstrresult = cx_mutstrn(longstrc+256, longstrlen-256);
 
     CX_TEST_DO {
-        cxstring notfound = cx_strstr(str, cx_str("no match"));
+        cxstring notfound = cx_strstr(str, "no match");
         CX_TEST_ASSERT(notfound.length == 0);
 
-        cxstring result = cx_strstr(str, cx_str("match"));
+        cxstring result = cx_strstr(str, "match");
         CX_TEST_ASSERT(result.length == 20);
         CX_TEST_ASSERT(0 == strcmp(result.ptr, "match in this string"));
 
-        result = cx_strstr(str, cx_str(""));
+        result = cx_strstr(str, "");
         CX_TEST_ASSERT(result.length == str.length);
         CX_TEST_ASSERT(0 == strcmp(result.ptr, str.ptr));
 

mercurial