proptest/arbitrary/
arrays.rs1use crate::arbitrary::{any_with, Arbitrary};
13use crate::array::UniformArrayStrategy;
14
15macro_rules! array {
16 ($($n: expr),*) => { $(
17 impl<A: Arbitrary> Arbitrary for [A; $n] {
18 type Parameters = A::Parameters;
19 type Strategy = UniformArrayStrategy<A::Strategy, [A; $n]>;
20 fn arbitrary_with(args: Self::Parameters) -> Self::Strategy {
21 let base = any_with::<A>(args);
22 UniformArrayStrategy::new(base)
23 }
24 }
25 )* };
26}
27
28array!(
29 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
30 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32
31);
32
33#[cfg(test)]
34mod test {
35 no_panic_test!(
36 array_16 => [u8; 16]
37 );
38}