Add more tests for random_idx_where

This commit is contained in:
Jim Newsome 2023-06-22 19:44:37 -05:00
parent 03960b5048
commit 35e6cc285b
1 changed files with 10 additions and 0 deletions

View File

@ -193,4 +193,14 @@ mod test {
let idx = random_idx_where(&mut rng, &[], |_: &i32| panic!());
assert_eq!(idx, None);
}
#[test]
fn random_idx_none() {
let mut rng = testing_rng();
let numbers: Vec<i32> = vec![1, 3, 4, 8, 11, 19, 12, 6, 27];
assert_eq!(
random_idx_where(&mut rng, &numbers[..], |_: &i32| false),
None
);
}
}