Skip to content

Commit

Permalink
quickcheck for DoubleEndedIterator on Zip
Browse files Browse the repository at this point in the history
  • Loading branch information
jswrenn committed Sep 4, 2020
1 parent 594c27a commit da719ad
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
28 changes: 28 additions & 0 deletions tests/quick.rs
Expand Up @@ -1209,3 +1209,31 @@ quickcheck! {
TestResult::passed()
}
}

quickcheck! {
fn test_double_ended_zip_2(a: Vec<u8>, b: Vec<u8>) -> TestResult {
let mut x =
multizip((a.clone().into_iter(), b.clone().into_iter()))
.collect_vec();
x.reverse();

let y =
multizip((a.into_iter(), b.into_iter()))
.rfold(Vec::new(), |mut vec, e| { vec.push(e); vec });

TestResult::from_bool(itertools::equal(x, y))
}

fn test_double_ended_zip_3(a: Vec<u8>, b: Vec<u8>, c: Vec<u8>) -> TestResult {
let mut x =
multizip((a.clone().into_iter(), b.clone().into_iter(), c.clone().into_iter()))
.collect_vec();
x.reverse();

let y =
multizip((a.into_iter(), b.into_iter(), c.into_iter()))
.rfold(Vec::new(), |mut vec, e| { vec.push(e); vec });

TestResult::from_bool(itertools::equal(x, y))
}
}
2 changes: 0 additions & 2 deletions tests/zip.rs
Expand Up @@ -75,5 +75,3 @@ fn zip_eq_panic2()

zip_eq(&a, &b).count();
}


0 comments on commit da719ad

Please sign in to comment.