Skip to content

Commit

Permalink
quickcheck for DoubleEndedIterator on multizip
Browse files Browse the repository at this point in the history
  • Loading branch information
jswrenn committed Sep 4, 2020
1 parent 053f26d commit c2f4530
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/quick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1025,3 +1025,31 @@ quickcheck! {
}
}
}

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))
}
}

0 comments on commit c2f4530

Please sign in to comment.