Debian Codegraph @

third_party/rust/rust_decimal/src/fuzz.rs

raw
1 use crate::Decimal;
2
3 use arbitrary::{Arbitrary, Result as ArbitraryResult, Unstructured};
4
5 impl Arbitrary<'_> for crate::Decimal {
6 fn arbitrary(u: &mut Unstructured<'_>) -> ArbitraryResult<Self> {
7 let lo = u32::arbitrary(u)?;
8 let mid = u32::arbitrary(u)?;
9 let hi = u32::arbitrary(u)?;
10 let negative = bool::arbitrary(u)?;
11 let scale = u32::arbitrary(u)?;
12 Ok(Decimal::from_parts(lo, mid, hi, negative, scale))
13 }
14 }