BurntSushi / quickcheck

Automated property based testing for Rust (with shrinking).
The Unlicense
2.4k stars 149 forks source link

'Rng.gen_range called with low >= high' #83

Closed twittner closed 9 years ago

twittner commented 9 years ago

This can happen due to invalid casts from quickcheck::Gen::size of type usize to various other integer types with a value range smaller than usize (cf. quickcheck::arbitrary::unsigned_arbitrary).

Test case:

#[test]
fn test() {
    fn prop(_: u8) -> bool { true }

    QuickCheck::new()
        .gen(StdGen::new(rand::thread_rng(), 1024))
        .quickcheck(prop as fn(u8) -> bool)
}
BurntSushi commented 9 years ago

Thanks for the report!