Skip to content

Commit 5be2e8d

Browse files
kinto-bPhilippe-Cholet
authored andcommitted
Replace custom zip_eq test with quick test
1 parent 37c54d1 commit 5be2e8d

File tree

2 files changed

+8
-19
lines changed

2 files changed

+8
-19
lines changed

Diff for: tests/quick.rs

+8
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,14 @@ quickcheck! {
571571
let b = &b[..len];
572572
itertools::equal(zip_eq(a, b), zip(a, b))
573573
}
574+
575+
#[should_panic]
576+
fn zip_eq_panics(a: Vec<u8>, b: Vec<u8>) -> TestResult {
577+
if a.len() == b.len() { return TestResult::discard(); }
578+
zip_eq(a.iter(), b.iter()).for_each(|_| {});
579+
TestResult::passed() // won't come here
580+
}
581+
574582
fn equal_positions(a: Vec<i32>) -> bool {
575583
let with_pos = a.iter().positions(|v| v % 2 == 0);
576584
let without = a.iter().enumerate().filter(|(_, v)| *v % 2 == 0).map(|(i, _)| i);

Diff for: tests/zip.rs

-19
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use itertools::free::zip_eq;
21
use itertools::multizip;
32
use itertools::EitherOrBoth::{Both, Left, Right};
43
use itertools::Itertools;
@@ -55,21 +54,3 @@ fn test_double_ended_zip() {
5554
assert_eq!(it.next_back(), Some((1, 1)));
5655
assert_eq!(it.next_back(), None);
5756
}
58-
59-
#[should_panic]
60-
#[test]
61-
fn zip_eq_panic1() {
62-
let a = [1, 2];
63-
let b = [1, 2, 3];
64-
65-
zip_eq(&a, &b).count();
66-
}
67-
68-
#[should_panic]
69-
#[test]
70-
fn zip_eq_panic2() {
71-
let a: [i32; 0] = [];
72-
let b = [1, 2, 3];
73-
74-
zip_eq(&a, &b).count();
75-
}

0 commit comments

Comments
 (0)