Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.9.0 with backports from master #231

Merged
merged 19 commits into from
Jun 17, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use u8 test indices so quickcheck is less likely to go out of bounds.
(cherry picked from commit d110067)
  • Loading branch information
cuviper committed Jun 16, 2022
commit 8d0216043db7aa81bf5dc5a41f9b60c140bcb247
12 changes: 10 additions & 2 deletions tests/quick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,12 @@ quickcheck_limit! {
})
}

fn swap_indices(vec: Vec<u8>, a: usize, b: usize) -> TestResult {
// Use `u8` test indices so quickcheck is less likely to go out of bounds.
fn swap_indices(vec: Vec<u8>, a: u8, b: u8) -> TestResult {
let mut set = IndexSet::<u8>::from_iter(vec);
let a = usize::from(a);
let b = usize::from(b);

if a >= set.len() || b >= set.len() {
return TestResult::discard();
}
Expand All @@ -236,8 +240,12 @@ quickcheck_limit! {
TestResult::passed()
}

fn move_index(vec: Vec<u8>, from: usize, to: usize) -> TestResult {
// Use `u8` test indices so quickcheck is less likely to go out of bounds.
fn move_index(vec: Vec<u8>, from: u8, to: u8) -> TestResult {
let mut set = IndexSet::<u8>::from_iter(vec);
let from = usize::from(from);
let to = usize::from(to);

if from >= set.len() || to >= set.len() {
return TestResult::discard();
}
Expand Down