Mercurial > hg > truffle
comparison src/share/vm/utilities/quickSort.cpp @ 4708:3c648b9ad052
7121373: Clean up CollectedHeap::is_in
Summary: Fixed G1CollectedHeap::is_in, added tests, cleaned up comments and made Space::is_in pure virtual.
Reviewed-by: brutisso, tonyp, jcoomes
author | stefank |
---|---|
date | Wed, 14 Dec 2011 12:15:26 +0100 |
parents | 6fd81579526f |
children | f2aebc22372a 6f817ce50129 |
comparison
equal
deleted
inserted
replaced
4132:6d7d0790074d | 4708:3c648b9ad052 |
---|---|
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 } |
212 assert(compare_arrays(test_array, expected_array, length), "Sorting already sorted array changed order of elements - not idempotent"); | 211 assert(compare_arrays(test_array, expected_array, length), "Sorting already sorted array changed order of elements - not idempotent"); |
213 | 212 |
214 delete[] test_array; | 213 delete[] test_array; |
215 delete[] expected_array; | 214 delete[] expected_array; |
216 } | 215 } |
217 return true; | |
218 } | 216 } |
219 | 217 |
220 #endif | 218 #endif |