Skip to content

Commit 19a59cb

Browse files
committed
Fix tests for Copy bound
1 parent fb61f91 commit 19a59cb

File tree

1 file changed

+9
-45
lines changed

1 file changed

+9
-45
lines changed

src/libstd/sort.rs

Lines changed: 9 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,11 +1032,6 @@ mod big_tests {
10321032
tabulate_managed(low, high);
10331033
}
10341034

1035-
#[test]
1036-
fn test_linear() {
1037-
tabulate_linear();
1038-
}
1039-
10401035
fn multiplyVec<T: Copy>(arr: &[const T], num: uint) -> ~[mut T] {
10411036
let size = arr.len();
10421037
let res = do vec::from_fn(num) |i| {
@@ -1125,12 +1120,11 @@ mod big_tests {
11251120
}
11261121

11271122
fn tabulate_managed(lo: uint, hi: uint) {
1128-
fn isSorted<T: Ord>(arr: &[const @T], expected_refcount: uint) {
1123+
fn isSorted<T: Ord>(arr: &[const @T]) {
11291124
for uint::range(0, arr.len()-1) |i| {
11301125
if arr[i] > arr[i+1] {
11311126
fail ~"Array not sorted";
11321127
}
1133-
assert sys::refcount(arr[i]) == expected_refcount;
11341128
}
11351129
}
11361130

@@ -1144,22 +1138,22 @@ mod big_tests {
11441138
let arr = vec::to_mut(move arr);
11451139

11461140
tim_sort(arr); // *sort
1147-
isSorted(arr, 1);
1141+
isSorted(arr);
11481142

11491143
vec::reverse(arr);
11501144
tim_sort(arr); // \sort
1151-
isSorted(arr, 1);
1145+
isSorted(arr);
11521146

11531147
tim_sort(arr); // /sort
1154-
isSorted(arr, 1);
1148+
isSorted(arr);
11551149

11561150
for 3.times {
11571151
let i1 = rng.gen_uint_range(0, n);
11581152
let i2 = rng.gen_uint_range(0, n);
11591153
arr[i1] <-> arr[i2];
11601154
}
11611155
tim_sort(arr); // 3sort
1162-
isSorted(arr, 1);
1156+
isSorted(arr);
11631157

11641158
if n >= 10 {
11651159
let size = arr.len();
@@ -1170,7 +1164,7 @@ mod big_tests {
11701164
}
11711165
}
11721166
tim_sort(arr); // +sort
1173-
isSorted(arr, 1);
1167+
isSorted(arr);
11741168

11751169
for (n/100).times {
11761170
let idx = rng.gen_uint_range(0, n);
@@ -1184,16 +1178,16 @@ mod big_tests {
11841178
multiplyVec(part, n)
11851179
} else { move arr };
11861180
tim_sort(arr); // ~sort
1187-
isSorted(arr, n/4+1);
1181+
isSorted(arr);
11881182

11891183
let mut arr = vec::from_elem(n, @(-0.5));
11901184
tim_sort(arr); // =sort
1191-
isSorted(arr, n);
1185+
isSorted(arr);
11921186

11931187
let half = n / 2;
11941188
let mut arr = makeRange(half).map(|i| @(*i as float));
11951189
tim_sort(arr); // !sort
1196-
isSorted(arr, 1);
1190+
isSorted(arr);
11971191
}
11981192
}
11991193

@@ -1220,36 +1214,6 @@ mod big_tests {
12201214
pure fn gt(other: &LVal) -> bool { self.val > other.val }
12211215
pure fn ge(other: &LVal) -> bool { self.val >= other.val }
12221216
}
1223-
1224-
fn tabulate_linear() {
1225-
fn key(_x: @uint) { }
1226-
fn isSorted<T: Ord>(arr: &[const T]) {
1227-
for uint::range(0, arr.len()-1) |i| {
1228-
if arr[i] > arr[i+1] {
1229-
fail ~"Array not sorted";
1230-
}
1231-
}
1232-
}
1233-
1234-
let n = 1000;
1235-
unsafe {
1236-
task::local_data::local_data_set(key, @0u);
1237-
}
1238-
1239-
{
1240-
let mut arr = do vec::from_fn(n) |i| {
1241-
LVal { val: i, key: key }
1242-
};
1243-
tim_sort(arr);
1244-
isSorted(arr);
1245-
}
1246-
1247-
let @dropped = unsafe {
1248-
task::local_data::local_data_get(key).get()
1249-
};
1250-
1251-
assert n == dropped;
1252-
}
12531217
}
12541218

12551219
// Local Variables:

0 commit comments

Comments
 (0)