MCPcopy Create free account
hub / github.com/BitVM/BitVM / arbitrary

Method arbitrary

fuzz/fuzz_targets/bigint/bigint_transform.rs:100–113  ·  view source on GitHub ↗
(u: &mut Unstructured<'a>)

Source from the content-addressed store, hash-verified

98
99impl<'a, const TRANSFORM_LIST_SIZE: usize> Arbitrary<'a> for BigIntConfig<TRANSFORM_LIST_SIZE> {
100 fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self> {
101 let bigint_type = BigIntType::from_index(u.int_in_range(0..=BIGINT_TYPE_LAST_INDEX)?);
102 let n_bits = bigint_type.n_bits();
103 let transform_list = std::array::from_fn(|_| u.int_in_range(1..=31).unwrap());
104 let value = (0..(n_bits.div_ceil(bigint_type.limb_size())))
105 .map(|_| u.arbitrary())
106 .collect::<Result<Vec<u32>>>()?;
107
108 Ok(BigIntConfig {
109 value,
110 bigint_type,
111 transform_list,
112 })
113 }
114}
115
116fuzz_target!(|message: BigIntConfig| {

Callers

nothing calls this directly

Calls 2

n_bitsMethod · 0.80
limb_sizeMethod · 0.80

Tested by

no test coverage detected