test/list_tests.c

changeset 35
fdabd1240b69
parent 33
9c219a62070d
child 36
a9d656e4f7ce
--- a/test/list_tests.c	Fri Jun 01 12:35:30 2012 +0200
+++ b/test/list_tests.c	Wed Aug 15 19:32:29 2012 +0200
@@ -153,3 +153,31 @@
     ucx_list_free(list);
     ucx_list_free(copy);
 }
+
+UCX_TEST_IMPLEMENT(test_ucx_list_qsort) {
+    UcxList *list = ucx_list_append(NULL, "this");
+    list = ucx_list_append(list, "is");
+    list = ucx_list_append(list, "a");
+    list = ucx_list_append(list, "test");
+    list = ucx_list_append(list, "for");
+    list = ucx_list_append(list, "partial");
+    list = ucx_list_append(list, "correctness");
+
+    UcxList *expected = ucx_list_append(NULL, "a");
+    expected = ucx_list_append(expected, "correctness");
+    expected = ucx_list_append(expected, "for");
+    expected = ucx_list_append(expected, "is");
+    expected = ucx_list_append(expected, "partial");
+    expected = ucx_list_append(expected, "test");
+    expected = ucx_list_append(expected, "this");
+
+    list = ucx_list_qsort(list, cmp_string, NULL);
+
+    UCX_TEST_BEGIN
+    UCX_TEST_ASSERT(
+            ucx_list_equals(list, expected, cmp_string, NULL), "failed");
+    UCX_TEST_END
+
+    ucx_list_free(expected);
+    ucx_list_free(list);
+}

mercurial