@@ -166,7 +166,7 @@ const MIN_MERGE: uint = 64;
166
166
const MIN_GALLOP : uint = 7 ;
167
167
const INITIAL_TMP_STORAGE : uint = 128 ;
168
168
169
- fn tim_sort < T : Ord > ( array : & [ mut T ] ) {
169
+ pub fn tim_sort < T : Ord > ( array : & [ mut T ] ) {
170
170
let size = array. len ( ) ;
171
171
if size < 2 {
172
172
return ;
@@ -977,7 +977,7 @@ mod tests {
977
977
978
978
#[ cfg( test) ]
979
979
mod test_tim_sort {
980
- #[ legacy_exports] ;
980
+ // #[legacy_exports];
981
981
struct CVal {
982
982
val : ~float ,
983
983
}
@@ -1046,10 +1046,10 @@ mod test_tim_sort {
1046
1046
1047
1047
struct DVal { val : ~uint }
1048
1048
impl DVal : Ord {
1049
- pure fn lt ( other : & DVal ) -> bool { true }
1050
- pure fn le ( other : & DVal ) -> bool { true }
1051
- pure fn gt ( other : & DVal ) -> bool { true }
1052
- pure fn ge ( other : & DVal ) -> bool { true }
1049
+ pure fn lt ( _x : & DVal ) -> bool { true }
1050
+ pure fn le ( _x : & DVal ) -> bool { true }
1051
+ pure fn gt ( _x : & DVal ) -> bool { true }
1052
+ pure fn ge ( _x : & DVal ) -> bool { true }
1053
1053
}
1054
1054
1055
1055
#[ test]
@@ -1066,16 +1066,11 @@ mod test_tim_sort {
1066
1066
}
1067
1067
}
1068
1068
1069
- /*fn f<T: Ord>(array: &[mut T]) { array[0] <-> array[0] }
1070
-
1071
- fn ice_test() {
1072
- let _s1 = &fn(arr: &[mut ~float]) { tim_sort(arr); };
1073
- }*/
1074
-
1075
- //#[cfg(test)]
1069
+ /*
1070
+ #[cfg(test)]
1076
1071
mod big_tests {
1077
1072
1078
- // #[test]
1073
+ #[test]
1079
1074
fn sorts_test() {
1080
1075
let low = 5;
1081
1076
let high = 10;
@@ -1091,9 +1086,9 @@ mod big_tests {
1091
1086
1092
1087
// Run tabulate_unique and tabulate_managed
1093
1088
// with the other sorts at some point
1094
- // tabulate_unique(low, high);
1095
- // tabulate_managed(low, high);
1096
- // tabulate_linear(low, high );
1089
+ tabulate_unique(low, high);
1090
+ tabulate_managed(low, high);
1091
+ tabulate_linear();
1097
1092
}
1098
1093
1099
1094
fn multiplyVec<T: Copy>(arr: &[const T], num: uint) -> ~[mut T] {
@@ -1111,7 +1106,7 @@ mod big_tests {
1111
1106
vec::append(two, one)
1112
1107
}
1113
1108
1114
- /* fn tabulate_unique(lo: uint, hi: uint) {
1109
+ fn tabulate_unique(lo: uint, hi: uint) {
1115
1110
fn isSorted<T: Ord>(arr: &[const T]) {
1116
1111
for uint::range(0, arr.len()-1) |i| {
1117
1112
if arr[i] > arr[i+1] {
@@ -1181,9 +1176,9 @@ mod big_tests {
1181
1176
tim_sort(arr); // !sort
1182
1177
isSorted(arr);
1183
1178
}
1184
- }*/
1179
+ }
1185
1180
1186
- /* fn tabulate_managed(lo: uint, hi: uint) {
1181
+ fn tabulate_managed(lo: uint, hi: uint) {
1187
1182
fn isSorted<T: Ord>(arr: &[const @T], expected_refcount: uint) {
1188
1183
for uint::range(0, arr.len()-1) |i| {
1189
1184
if arr[i] > arr[i+1] {
@@ -1255,8 +1250,7 @@ mod big_tests {
1255
1250
isSorted(arr, 2);
1256
1251
}
1257
1252
}
1258
- */
1259
- /*
1253
+
1260
1254
struct LVal {
1261
1255
val: uint,
1262
1256
key: fn(@uint),
@@ -1281,8 +1275,8 @@ mod big_tests {
1281
1275
pure fn ge(other: &LVal) -> bool { self.val >= other.val }
1282
1276
}
1283
1277
1284
- fn tabulate_linear(lo: uint, hi: uint ) {
1285
- fn key(+ _x: @uint) { }
1278
+ fn tabulate_linear() {
1279
+ fn key(_x: @uint) { }
1286
1280
fn isSorted<T: Ord>(arr: &[const T]) {
1287
1281
for uint::range(0, arr.len()-1) |i| {
1288
1282
if arr[i] > arr[i+1] {
@@ -1310,8 +1304,8 @@ mod big_tests {
1310
1304
1311
1305
assert n == dropped;
1312
1306
}
1313
- */
1314
1307
}
1308
+ */
1315
1309
1316
1310
// Local Variables:
1317
1311
// mode: rust;
0 commit comments