-
Notifications
You must be signed in to change notification settings - Fork 157
Closed
Description
I have a type which wraps an i32
, and wrote an Arbitrary
impl like so:
trait Arbitrary<PgDate> {
fn arbitrary<G: Gen>() -> Self {
PgDate(i32::arbitrary())
}
}
When I actually output what it's running with, the values are only ranging from 100
to -100
, instead of 100 completely random numbers as I'd expect. Additionally, shrink
appears to be flawed on these types. My understanding was that quickcheck would test for known problematic values for a given type. For i32
I'd expect that to at minimum be 1
, 0
, -1
, i32::MAX
and i32::MIN
, but when I add the shrink
like so:
fn shrink(&self) -> Box<Iterator<Item=Self>> {
Box::new(self.0.shrink().map(PgDate))
I just see the same range of -100 to 100. This caused a critical bug that occurs for any values less than -2451545
to go unnoticed.
jasonwhite
Metadata
Metadata
Assignees
Labels
No labels