generate large uint arbitrary values with a lower probability
this is necessary to avoid generating a lot of test values that will overflow
the tested expression and will therefore be discard as a test case (making the
tests slower).
@@ -2539,8 +2539,20 @@ mod tests {
impl ::quickcheck::Arbitrary for $uint {
fn arbitrary<G: ::quickcheck::Gen>(g: &mut G) -> Self {
let mut res = [0u8; $n_bytes];
- let size = g.gen_range(0, $n_bytes);
+
+ let p = g.next_f64();
+ let range =
+ if p < 0.1 {
+ $n_bytes
+ } else if p < 0.2 {
+ $n_bytes / 2
+ } else {
+ $n_bytes / 5
+ };
+
+ let size = g.gen_range(0, range);
g.fill_bytes(&mut res[..size]);
+
Self::from(res)
}
}
