src/share/vm/utilities/quickSort.cpp
Print this page
rev 2722 : 7091366: re-enable quicksort tests
Summary: Added extern "C" to make it build with JDK6 compilers
Reviewed-by: jwilhelm
*** 52,71 ****
return -1;
}
return 1;
}
! static int test_stdlib_comparator(const void* a, const void* b) {
int ai = *(int*)a;
int bi = *(int*)b;
if (ai == bi) {
return 0;
}
if (ai < bi) {
return -1;
}
return 1;
}
void QuickSort::print_array(const char* prefix, int* array, int length) {
tty->print("%s:", prefix);
for (int i = 0; i < length; i++) {
--- 52,73 ----
return -1;
}
return 1;
}
! extern "C" {
! static int test_stdlib_comparator(const void* a, const void* b) {
int ai = *(int*)a;
int bi = *(int*)b;
if (ai == bi) {
return 0;
}
if (ai < bi) {
return -1;
}
return 1;
+ }
}
void QuickSort::print_array(const char* prefix, int* array, int length) {
tty->print("%s:", prefix);
for (int i = 0; i < length; i++) {
*** 90,100 ****
sort<int, C>(arrayToSort, length, comparator, idempotent);
return compare_arrays(arrayToSort, expectedResult, length);
}
bool QuickSort::test_quick_sort() {
- #if 0
tty->print_cr("test_quick_sort\n");
{
int* test_array = NULL;
int* expected_array = NULL;
assert(sort_and_compare(test_array, expected_array, 0, test_comparator), "Empty array not handled");
--- 92,101 ----
*** 211,220 ****
assert(compare_arrays(test_array, expected_array, length), "Sorting already sorted array changed order of elements - not idempotent");
delete[] test_array;
delete[] expected_array;
}
- #endif
return true;
}
#endif
--- 212,220 ----