out_of_bounds/
out_of_bounds.rs

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