test/list_tests.c

changeset 94
57ea041df22f
parent 90
ef3163857e88
child 103
08018864fb91
equal deleted inserted replaced
93:a6a99e721660 94:57ea041df22f
1 /* 1 /*
2 * tests of list implementation 2 * tests of list implementation
3 */ 3 */
4 4
5 #include "list_tests.h" 5 #include "list_tests.h"
6 #include "ucx/comparator.h" 6 #include "ucx/utils.h"
7 7
8 UCX_TEST_IMPLEMENT(test_ucx_list_append) { 8 UCX_TEST_IMPLEMENT(test_ucx_list_append) {
9 UcxList *list = ucx_list_append(NULL, (void*)"Hello"); 9 UcxList *list = ucx_list_append(NULL, (void*)"Hello");
10 UCX_TEST_BEGIN 10 UCX_TEST_BEGIN
11 UCX_TEST_ASSERT(strncmp((const char*)list->data, "Hello", 5) == 0, 11 UCX_TEST_ASSERT(strncmp((const char*)list->data, "Hello", 5) == 0,
157 memcpy(world, " World!", 8); 157 memcpy(world, " World!", 8);
158 158
159 UcxList *list = ucx_list_append(NULL, hello); 159 UcxList *list = ucx_list_append(NULL, hello);
160 list = ucx_list_append(list, world); 160 list = ucx_list_append(list, world);
161 161
162 UcxList *copy = ucx_list_clone(list, copy_string, NULL); 162 UcxList *copy = ucx_list_clone(list, ucx_strcpy, NULL);
163 UCX_TEST_BEGIN 163 UCX_TEST_BEGIN
164 164
165 UCX_TEST_ASSERT(ucx_list_equals(list, copy, ucx_strcmp, NULL), "failed"); 165 UCX_TEST_ASSERT(ucx_list_equals(list, copy, ucx_strcmp, NULL), "failed");
166 UCX_TEST_ASSERT(hello != copy->data, "first element is no copy"); 166 UCX_TEST_ASSERT(hello != copy->data, "first element is no copy");
167 UCX_TEST_ASSERT(world != copy->next->data, "second element is no copy"); 167 UCX_TEST_ASSERT(world != copy->next->data, "second element is no copy");

mercurial