test/list_tests.c

changeset 30
23bb65cbf7a4
parent 27
22644e2572bc
child 33
9c219a62070d
equal deleted inserted replaced
29:bce0d7f2912b 30:23bb65cbf7a4
58 58
59 UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed") 59 UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed")
60 UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed") 60 UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed")
61 UCX_TEST_ASSERT(list->next->next == NULL, "failed") 61 UCX_TEST_ASSERT(list->next->next == NULL, "failed")
62 62
63 ucx_list_free(list2);
64 ucx_list_free(list); 63 ucx_list_free(list);
65 64
66 UCX_TEST_END 65 UCX_TEST_END
67 } 66 }
68 67
138 UcxList *copy = ucx_list_clone(list, copy_string, NULL); 137 UcxList *copy = ucx_list_clone(list, copy_string, NULL);
139 138
140 UCX_TEST_ASSERT(ucx_list_equals(list, copy, cmp_string, NULL), "failed") 139 UCX_TEST_ASSERT(ucx_list_equals(list, copy, cmp_string, NULL), "failed")
141 UCX_TEST_ASSERT(hello != copy->data, "first element is no copy") 140 UCX_TEST_ASSERT(hello != copy->data, "first element is no copy")
142 UCX_TEST_ASSERT(world != copy->next->data, "second element is no copy") 141 UCX_TEST_ASSERT(world != copy->next->data, "second element is no copy")
143 142
144 free(copy->next->data); 143 free(copy->next->data);
145 free(copy->data); 144 free(copy->data);
146 145
147 free(world); 146 free(world);
148 free(hello); 147 free(hello);
149 free(list); 148 ucx_list_free(list);
150 free(copy); 149 ucx_list_free(copy);
151 150
152 UCX_TEST_END 151 UCX_TEST_END
153 } 152 }

mercurial