fixed utils tests

Wed, 14 Aug 2013 16:07:49 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Wed, 14 Aug 2013 16:07:49 +0200
changeset 145
e974640ec4e0
parent 144
b6dcc9d112eb
child 146
aa376dba1ba8

fixed utils tests

test/utils_tests.c file | annotate | diff | comparison | revisions
     1.1 --- a/test/utils_tests.c	Wed Aug 14 15:54:22 2013 +0200
     1.2 +++ b/test/utils_tests.c	Wed Aug 14 16:07:49 2013 +0200
     1.3 @@ -47,12 +47,16 @@
     1.4              "wrong content in b1 after second fprintf");
     1.5      
     1.6      ucx_fprintf(b2, (write_func)ucx_buffer_write, "%s%s", teststr1, teststr2);
     1.7 +    UCX_TEST_ASSERT(b2->pos == 2046, "wrong length");
     1.8      UCX_TEST_ASSERT(!memcmp(b2->space, teststr1, 1023),
     1.9              "wrong first half in b2");
    1.10      UCX_TEST_ASSERT(!memcmp(b2->space+1023, teststr2, 1023),
    1.11              "wrong second half in b2");
    1.12      
    1.13      UCX_TEST_END
    1.14 +    
    1.15 +    ucx_buffer_free(b1);
    1.16 +    ucx_buffer_free(b2);
    1.17  }
    1.18  
    1.19  UCX_TEST(test_ucx_asprintf) {
    1.20 @@ -71,10 +75,13 @@
    1.21      free(s1.ptr);
    1.22      
    1.23      sstr_t s2 = ucx_asprintf(a, "%s%s", teststr1, teststr2);
    1.24 +    UCX_TEST_ASSERT(s2.ptr, "s2.ptr is NULL");
    1.25 +    UCX_TEST_ASSERT(s2.length == 2046, "wrong length");
    1.26      UCX_TEST_ASSERT(!memcmp(s2.ptr, teststr1, 1023),
    1.27              "wrong first half in s2");
    1.28      UCX_TEST_ASSERT(!memcmp(s2.ptr+1023, teststr2, 1023),
    1.29              "wrong second half in s2");
    1.30 +    free(s2.ptr);
    1.31      
    1.32      UCX_TEST_END
    1.33  }

mercurial