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
27arbitrary!(FpCategory,
28 TupleUnion<(WA<Just<Self>>, WA<Just<Self>>, WA<Just<Self>>,
29 WA<Just<Self>>, WA<Just<Self>>)>;
30 {
31 use core::num::FpCategory::*;
32 prop_oneof![
33 Just(Nan),
34 Just(Infinite),
35 Just(Zero),
36 Just(Subnormal),
37 Just(Normal),
38 ]
39 }
40);
41
42#[cfg(test)]
43mod test {
44 no_panic_test!(
45 parse_float_error => ParseFloatError,
46 parse_int_error => ParseIntError,
47 wrapping => Wrapping<u8>,
48 fp_category => FpCategory
49 );
50
51 #[cfg(feature = "unstable")]
52 no_panic_test!(
53 try_from_int_error => TryFromIntError
54 );
55}