Document how Zebra does cross-crate proptests

This commit is contained in:
teor 2021-04-26 22:13:54 +10:00 committed by Deirdre Connolly
parent 9ac0319602
commit 3377a486c6
1 changed files with 9 additions and 0 deletions

View File

@ -0,0 +1,9 @@
# Randomised Property Testing in Zebra
Zebra uses the [proptest](https://docs.rs/proptest/) crate for randomised property testing.
Most types in `zebra-chain` have an `Arbitrary` implementation, which generates randomised test cases.
When we want to use those `Arbitrary` impls in proptests in other crates, we use the `proptest-impl` feature as a dev dependency:
* in `zebra-chain`: make the `Arbitrary` impl depend on `#[cfg(any(test, feature = "proptest-impl"))]`
* in the other crate: add zebra-chain as a dev dependency: `zebra-chain = { path = "../zebra-chain", features = ["proptest-impl"] }`