Zebra/zebra-chain/src/notes/arbitrary.rs

20 lines
492 B
Rust

use crate::notes::memo::Memo;
use proptest::{arbitrary::any, collection::vec, prelude::*};
impl Arbitrary for Memo {
type Parameters = ();
fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
(vec(any::<u8>(), 512))
.prop_map(|v| {
let mut bytes = [0; 512];
bytes.copy_from_slice(v.as_slice());
Memo(Box::new(bytes))
})
.boxed()
}
type Strategy = BoxedStrategy<Self>;
}