out_of_bounds/
out_of_bounds.rs

1use quickcheck::{quickcheck, TestResult};
2
3fn main() {
4    fn prop(length: usize, index: usize) -> TestResult {
5        let v: Vec<_> = (0..length).collect();
6        if index < length {
7            TestResult::discard()
8        } else {
9            TestResult::must_fail(move || v[index])
10        }
11    }
12    quickcheck(prop as fn(usize, usize) -> TestResult);
13}