Move partition/partitioned/concat/connect tests back into slice
There was no reason to remove them from slice. They're testing methods defined in slice, so that's where they belong. Leave vec with copies of the partition/partitioned tests because it has its own implementation of those methods.
This commit is contained in:
parent
f582150159
commit
dc30c48381
@ -1368,6 +1368,42 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_partition() {
|
||||
assert_eq!((box []).partition(|x: &int| *x < 3), (vec![], vec![]));
|
||||
assert_eq!((box [1, 2, 3]).partition(|x: &int| *x < 4), (vec![1, 2, 3], vec![]));
|
||||
assert_eq!((box [1, 2, 3]).partition(|x: &int| *x < 2), (vec![1], vec![2, 3]));
|
||||
assert_eq!((box [1, 2, 3]).partition(|x: &int| *x < 0), (vec![], vec![1, 2, 3]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_partitioned() {
|
||||
assert_eq!(([]).partitioned(|x: &int| *x < 3), (vec![], vec![]));
|
||||
assert_eq!(([1, 2, 3]).partitioned(|x: &int| *x < 4), (vec![1, 2, 3], vec![]));
|
||||
assert_eq!(([1, 2, 3]).partitioned(|x: &int| *x < 2), (vec![1], vec![2, 3]));
|
||||
assert_eq!(([1, 2, 3]).partitioned(|x: &int| *x < 0), (vec![], vec![1, 2, 3]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_concat() {
|
||||
let v: [~[int], ..0] = [];
|
||||
assert_eq!(v.concat_vec(), vec![]);
|
||||
assert_eq!([box [1], box [2,3]].concat_vec(), vec![1, 2, 3]);
|
||||
|
||||
assert_eq!([&[1], &[2,3]].concat_vec(), vec![1, 2, 3]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_connect() {
|
||||
let v: [~[int], ..0] = [];
|
||||
assert_eq!(v.connect_vec(&0), vec![]);
|
||||
assert_eq!([box [1], box [2, 3]].connect_vec(&0), vec![1, 0, 2, 3]);
|
||||
assert_eq!([box [1], box [2], box [3]].connect_vec(&0), vec![1, 0, 2, 0, 3]);
|
||||
|
||||
assert_eq!([&[1], &[2, 3]].connect_vec(&0), vec![1, 0, 2, 3]);
|
||||
assert_eq!([&[1], &[2], &[3]].connect_vec(&0), vec![1, 0, 2, 0, 3]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_shift() {
|
||||
let mut x = vec![1, 2, 3];
|
||||
|
@ -1755,32 +1755,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_partitioned() {
|
||||
assert_eq!(([]).partitioned(|x: &int| *x < 3), (vec![], vec![]))
|
||||
assert_eq!(([1, 2, 3]).partitioned(|x: &int| *x < 4), (vec![1, 2, 3], vec![]));
|
||||
assert_eq!(([1, 2, 3]).partitioned(|x: &int| *x < 2), (vec![1], vec![2, 3]));
|
||||
assert_eq!(([1, 2, 3]).partitioned(|x: &int| *x < 0), (vec![], vec![1, 2, 3]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_concat() {
|
||||
let v: [Vec<int>, ..0] = [];
|
||||
assert_eq!(v.concat_vec(), vec![]);
|
||||
assert_eq!([vec![1], vec![2,3]].concat_vec(), vec![1, 2, 3]);
|
||||
|
||||
assert_eq!([&[1], &[2,3]].concat_vec(), vec![1, 2, 3]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_connect() {
|
||||
let v: [~[int], ..0] = [];
|
||||
assert_eq!(v.connect_vec(&0), vec![]);
|
||||
assert_eq!([vec![1], vec![2, 3]].connect_vec(&0), vec![1, 0, 2, 3]);
|
||||
assert_eq!([vec![1], vec![2], vec![3]].connect_vec(&0), vec![1, 0, 2, 0, 3]);
|
||||
|
||||
let v: [&[int], ..0] = [];
|
||||
assert_eq!(v.connect_vec(&0), vec![]);
|
||||
assert_eq!([&[1], &[2, 3]].connect_vec(&0), vec![1, 0, 2, 3]);
|
||||
assert_eq!([&[1], &[2], &[3]].connect_vec(&0), vec![1, 0, 2, 0, 3]);
|
||||
assert_eq!(vec![].partitioned(|x: &int| *x < 3), (vec![], vec![]))
|
||||
assert_eq!(vec![1, 2, 3].partitioned(|x: &int| *x < 4), (vec![1, 2, 3], vec![]));
|
||||
assert_eq!(vec![1, 2, 3].partitioned(|x: &int| *x < 2), (vec![1], vec![2, 3]));
|
||||
assert_eq!(vec![1, 2, 3].partitioned(|x: &int| *x < 0), (vec![], vec![1, 2, 3]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
Reference in New Issue
Block a user