1 /* |
1 /* |
2 * tests of dlist implementation |
2 * tests of dlist implementation |
3 */ |
3 */ |
4 |
4 |
5 #include "dlist_tests.h" |
5 #include "dlist_tests.h" |
6 #include "ucx/comparator.h" |
6 #include "ucx/utils.h" |
7 |
7 |
8 UCX_TEST_IMPLEMENT(test_ucx_dlist_append) { |
8 UCX_TEST_IMPLEMENT(test_ucx_dlist_append) { |
9 UcxDlist *list = ucx_dlist_append(NULL, (void*)"Hello"); |
9 UcxDlist *list = ucx_dlist_append(NULL, (void*)"Hello"); |
10 UCX_TEST_BEGIN |
10 UCX_TEST_BEGIN |
11 |
11 |
169 memcpy(world, " World!", 8); |
169 memcpy(world, " World!", 8); |
170 |
170 |
171 UcxDlist *list = ucx_dlist_append(NULL, hello); |
171 UcxDlist *list = ucx_dlist_append(NULL, hello); |
172 list = ucx_dlist_append(list, world); |
172 list = ucx_dlist_append(list, world); |
173 |
173 |
174 UcxDlist *copy = ucx_dlist_clone(list, copy_string, NULL); |
174 UcxDlist *copy = ucx_dlist_clone(list, ucx_strcpy, NULL); |
175 UCX_TEST_BEGIN |
175 UCX_TEST_BEGIN |
176 |
176 |
177 UCX_TEST_ASSERT(ucx_dlist_equals(list, copy, ucx_strcmp, NULL), "failed"); |
177 UCX_TEST_ASSERT(ucx_dlist_equals(list, copy, ucx_strcmp, NULL), "failed"); |
178 UCX_TEST_ASSERT(hello != copy->data, "first element is no copy"); |
178 UCX_TEST_ASSERT(hello != copy->data, "first element is no copy"); |
179 UCX_TEST_ASSERT(world != copy->next->data, "second element is no copy"); |
179 UCX_TEST_ASSERT(world != copy->next->data, "second element is no copy"); |