proptest/arbitrary/_core/
num.rs1use core::num::*;
13
14use crate::strategy::*;
15
16arbitrary!(ParseFloatError; "".parse::<f32>().unwrap_err());
17arbitrary!(ParseIntError; "".parse::<u32>().unwrap_err());
18
19#[cfg(feature = "unstable")]
20arbitrary!(TryFromIntError; {
21 use core::convert::TryFrom;
22 u8::try_from(-1).unwrap_err()
23});
24
25wrap_ctor!(Wrapping, Wrapping);
26
27wrap_ctor!(Saturating, Saturating);
28
29arbitrary!(FpCategory,
30 TupleUnion<(WA<Just<Self>>, WA<Just<Self>>, WA<Just<Self>>,
31 WA<Just<Self>>, WA<Just<Self>>)>;
32 {
33 use core::num::FpCategory::*;
34 prop_oneof![
35 Just(Nan),
36 Just(Infinite),
37 Just(Zero),
38 Just(Subnormal),
39 Just(Normal),
40 ]
41 }
42);
43
44#[cfg(test)]
45mod test {
46 no_panic_test!(
47 parse_float_error => ParseFloatError,
48 parse_int_error => ParseIntError,
49 wrapping => Wrapping<u8>,
50 saturating => Saturating<u8>,
51 fp_category => FpCategory
52 );
53
54 #[cfg(feature = "unstable")]
55 no_panic_test!(
56 try_from_int_error => TryFromIntError
57 );
58}