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