91 bool QuickSort::sort_and_compare(int* arrayToSort, int* expectedResult, int length, C comparator, bool idempotent) { |
91 bool QuickSort::sort_and_compare(int* arrayToSort, int* expectedResult, int length, C comparator, bool idempotent) { |
92 sort<int, C>(arrayToSort, length, comparator, idempotent); |
92 sort<int, C>(arrayToSort, length, comparator, idempotent); |
93 return compare_arrays(arrayToSort, expectedResult, length); |
93 return compare_arrays(arrayToSort, expectedResult, length); |
94 } |
94 } |
95 |
95 |
96 bool QuickSort::test_quick_sort() { |
96 void QuickSort::test_quick_sort() { |
97 tty->print_cr("test_quick_sort"); |
|
98 { |
97 { |
99 int* test_array = NULL; |
98 int* test_array = NULL; |
100 int* expected_array = NULL; |
99 int* expected_array = NULL; |
101 assert(sort_and_compare(test_array, expected_array, 0, test_comparator), "Empty array not handled"); |
100 assert(sort_and_compare(test_array, expected_array, 0, test_comparator), "Empty array not handled"); |
102 } |
101 } |