test/list_tests.c

changeset 35
fdabd1240b69
parent 33
9c219a62070d
child 36
a9d656e4f7ce
equal deleted inserted replaced
34:0dcd2ca2a223 35:fdabd1240b69
151 free(world); 151 free(world);
152 free(hello); 152 free(hello);
153 ucx_list_free(list); 153 ucx_list_free(list);
154 ucx_list_free(copy); 154 ucx_list_free(copy);
155 } 155 }
156
157 UCX_TEST_IMPLEMENT(test_ucx_list_qsort) {
158 UcxList *list = ucx_list_append(NULL, "this");
159 list = ucx_list_append(list, "is");
160 list = ucx_list_append(list, "a");
161 list = ucx_list_append(list, "test");
162 list = ucx_list_append(list, "for");
163 list = ucx_list_append(list, "partial");
164 list = ucx_list_append(list, "correctness");
165
166 UcxList *expected = ucx_list_append(NULL, "a");
167 expected = ucx_list_append(expected, "correctness");
168 expected = ucx_list_append(expected, "for");
169 expected = ucx_list_append(expected, "is");
170 expected = ucx_list_append(expected, "partial");
171 expected = ucx_list_append(expected, "test");
172 expected = ucx_list_append(expected, "this");
173
174 list = ucx_list_qsort(list, cmp_string, NULL);
175
176 UCX_TEST_BEGIN
177 UCX_TEST_ASSERT(
178 ucx_list_equals(list, expected, cmp_string, NULL), "failed");
179 UCX_TEST_END
180
181 ucx_list_free(expected);
182 ucx_list_free(list);
183 }

mercurial