diff options
| author | Simon BD <simon@server> | 2012-10-22 18:33:28 -0500 |
|---|---|---|
| committer | Simon BD <simon@server> | 2012-10-22 18:33:28 -0500 |
| commit | 9aec7a3e85c5b07923eab05d3ebe9d031bf258f3 (patch) | |
| tree | 648013b1342ed6c5ee7963ab8604d03a9758302d /src | |
| parent | 0e3bec0ced8d781cdd93996e7b8eeedb13f81ba8 (diff) | |
| download | rust-9aec7a3e85c5b07923eab05d3ebe9d031bf258f3.tar.gz rust-9aec7a3e85c5b07923eab05d3ebe9d031bf258f3.zip | |
Fix up tests, export tim_sort
Diffstat (limited to 'src')
| -rw-r--r-- | src/libstd/sort.rs | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs index 7bafb324dad..98f98fe7fce 100644 --- a/src/libstd/sort.rs +++ b/src/libstd/sort.rs @@ -166,7 +166,7 @@ const MIN_MERGE: uint = 64; const MIN_GALLOP: uint = 7; const INITIAL_TMP_STORAGE: uint = 128; -fn tim_sort<T: Ord>(array: &[mut T]) { +pub fn tim_sort<T: Ord>(array: &[mut T]) { let size = array.len(); if size < 2 { return; @@ -977,7 +977,7 @@ mod tests { #[cfg(test)] mod test_tim_sort { - #[legacy_exports]; + // #[legacy_exports]; struct CVal { val: ~float, } @@ -1046,10 +1046,10 @@ mod test_tim_sort { struct DVal { val: ~uint } impl DVal: Ord { - pure fn lt(other: &DVal) -> bool { true } - pure fn le(other: &DVal) -> bool { true } - pure fn gt(other: &DVal) -> bool { true } - pure fn ge(other: &DVal) -> bool { true } + pure fn lt(_x: &DVal) -> bool { true } + pure fn le(_x: &DVal) -> bool { true } + pure fn gt(_x: &DVal) -> bool { true } + pure fn ge(_x: &DVal) -> bool { true } } #[test] @@ -1066,16 +1066,11 @@ mod test_tim_sort { } } -/*fn f<T: Ord>(array: &[mut T]) { array[0] <-> array[0] } - -fn ice_test() { - let _s1 = &fn(arr: &[mut ~float]) { tim_sort(arr); }; -}*/ - -//#[cfg(test)] +/* +#[cfg(test)] mod big_tests { - //#[test] + #[test] fn sorts_test() { let low = 5; let high = 10; @@ -1091,9 +1086,9 @@ mod big_tests { // Run tabulate_unique and tabulate_managed // with the other sorts at some point - //tabulate_unique(low, high); - //tabulate_managed(low, high); - //tabulate_linear(low, high); + tabulate_unique(low, high); + tabulate_managed(low, high); + tabulate_linear(); } fn multiplyVec<T: Copy>(arr: &[const T], num: uint) -> ~[mut T] { @@ -1111,7 +1106,7 @@ mod big_tests { vec::append(two, one) } - /*fn tabulate_unique(lo: uint, hi: uint) { + fn tabulate_unique(lo: uint, hi: uint) { fn isSorted<T: Ord>(arr: &[const T]) { for uint::range(0, arr.len()-1) |i| { if arr[i] > arr[i+1] { @@ -1181,9 +1176,9 @@ mod big_tests { tim_sort(arr); // !sort isSorted(arr); } - }*/ + } - /*fn tabulate_managed(lo: uint, hi: uint) { + fn tabulate_managed(lo: uint, hi: uint) { fn isSorted<T: Ord>(arr: &[const @T], expected_refcount: uint) { for uint::range(0, arr.len()-1) |i| { if arr[i] > arr[i+1] { @@ -1255,8 +1250,7 @@ mod big_tests { isSorted(arr, 2); } } -*/ -/* + struct LVal { val: uint, key: fn(@uint), @@ -1281,8 +1275,8 @@ mod big_tests { pure fn ge(other: &LVal) -> bool { self.val >= other.val } } - fn tabulate_linear(lo: uint, hi: uint) { - fn key(+_x: @uint) { } + fn tabulate_linear() { + fn key(_x: @uint) { } fn isSorted<T: Ord>(arr: &[const T]) { for uint::range(0, arr.len()-1) |i| { if arr[i] > arr[i+1] { @@ -1310,8 +1304,8 @@ mod big_tests { assert n == dropped; } - */ } +*/ // Local Variables: // mode: rust; |
