- last = MAX_VALUE + 100; // past the maximum we'll include in the list.
- for (int j = 0; j < list.length(); j++) {
- ASSERT_FALSE(ret[j] > last, "ordering check - list should be ordered at second check");
- last = ret[j];
- }
+void test_sorts::test_quick_sort(int size)
+{
+ FUNCDEF("test_quick_sort");
+
+ int *list = populate_random_c_array(size);
+
+ // check a normal sort.
+ quick_sort(list, size);
+ ASSERT_TRUE(verify_ascending(list, size),
+ "ordering check - list should be ordered at first check");
+
+// LOG(a_sprintf("after quick sort: %s", dump_list(list, size).s()));
+
+ randomize_list(list, size);
+
+ // check a reversed sort.
+ quick_sort(list, size, true);
+ ASSERT_TRUE(verify_descending(list, size),
+ "ordering check - list should be ordered at second check");
+
+ // clean up now.
+ delete[] list;