#219 array list: implement sort

Thu, 17 Nov 2022 18:55:14 +0100

author
Mike Becker <universe@uap-core.de>
date
Thu, 17 Nov 2022 18:55:14 +0100
changeset 615
b52b66dcd44b
parent 614
7aaec630cf15
child 616
af7d8a29fbc5

#219 array list: implement sort

src/array_list.c file | annotate | diff | comparison | revisions
test/test_list.cpp file | annotate | diff | comparison | revisions
--- a/src/array_list.c	Thu Nov 17 18:46:55 2022 +0100
+++ b/src/array_list.c	Thu Nov 17 18:55:14 2022 +0100
@@ -245,7 +245,11 @@
 }
 
 static void cx_arl_sort(struct cx_list_s *list) {
-
+    qsort(((cx_array_list *) list)->data,
+          list->size,
+          list->itemsize,
+          list->cmpfunc
+    );
 }
 
 static int cx_arl_compare(
--- a/test/test_list.cpp	Thu Nov 17 18:46:55 2022 +0100
+++ b/test/test_list.cpp	Thu Nov 17 18:55:14 2022 +0100
@@ -888,7 +888,6 @@
 }
 
 TEST_F(ArrayList, cxListSort) {
-    ASSERT_EQ(1,0); // TODO: remove when implemented
     verifySort(arrayListFromTestData());
 }
 

mercurial