2020-07-27 16:02:33 -07:00
|
|
|
use proptest::{arbitrary::any, collection::vec, prelude::*};
|
2020-07-15 01:50:05 -07:00
|
|
|
|
2020-07-14 01:56:53 -07:00
|
|
|
use crate::notes::sapling;
|
|
|
|
|
2020-07-15 01:50:05 -07:00
|
|
|
impl Arbitrary for sapling::EncryptedCiphertext {
|
|
|
|
type Parameters = ();
|
|
|
|
|
|
|
|
fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
|
|
|
|
(vec(any::<u8>(), 580))
|
|
|
|
.prop_map(|v| {
|
|
|
|
let mut bytes = [0; 580];
|
|
|
|
bytes.copy_from_slice(v.as_slice());
|
|
|
|
Self(bytes)
|
|
|
|
})
|
|
|
|
.boxed()
|
|
|
|
}
|
|
|
|
|
|
|
|
type Strategy = BoxedStrategy<Self>;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Arbitrary for sapling::OutCiphertext {
|
|
|
|
type Parameters = ();
|
|
|
|
|
|
|
|
fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
|
|
|
|
(vec(any::<u8>(), 80))
|
|
|
|
.prop_map(|v| {
|
|
|
|
let mut bytes = [0; 80];
|
|
|
|
bytes.copy_from_slice(v.as_slice());
|
|
|
|
Self(bytes)
|
|
|
|
})
|
|
|
|
.boxed()
|
|
|
|
}
|
|
|
|
|
|
|
|
type Strategy = BoxedStrategy<Self>;
|
|
|
|
}
|