test/utils_tests.c

changeset 145
e974640ec4e0
parent 142
ee8cb27d8b8e
child 147
1aa598f36872
--- a/test/utils_tests.c	Wed Aug 14 15:54:22 2013 +0200
+++ b/test/utils_tests.c	Wed Aug 14 16:07:49 2013 +0200
@@ -47,12 +47,16 @@
             "wrong content in b1 after second fprintf");
     
     ucx_fprintf(b2, (write_func)ucx_buffer_write, "%s%s", teststr1, teststr2);
+    UCX_TEST_ASSERT(b2->pos == 2046, "wrong length");
     UCX_TEST_ASSERT(!memcmp(b2->space, teststr1, 1023),
             "wrong first half in b2");
     UCX_TEST_ASSERT(!memcmp(b2->space+1023, teststr2, 1023),
             "wrong second half in b2");
     
     UCX_TEST_END
+    
+    ucx_buffer_free(b1);
+    ucx_buffer_free(b2);
 }
 
 UCX_TEST(test_ucx_asprintf) {
@@ -71,10 +75,13 @@
     free(s1.ptr);
     
     sstr_t s2 = ucx_asprintf(a, "%s%s", teststr1, teststr2);
+    UCX_TEST_ASSERT(s2.ptr, "s2.ptr is NULL");
+    UCX_TEST_ASSERT(s2.length == 2046, "wrong length");
     UCX_TEST_ASSERT(!memcmp(s2.ptr, teststr1, 1023),
             "wrong first half in s2");
     UCX_TEST_ASSERT(!memcmp(s2.ptr+1023, teststr2, 1023),
             "wrong second half in s2");
+    free(s2.ptr);
     
     UCX_TEST_END
 }

mercurial