From 3377a486c62419867c3b3bb8ba1c9c4b4339ce87 Mon Sep 17 00:00:00 2001 From: teor Date: Mon, 26 Apr 2021 22:13:54 +1000 Subject: [PATCH] Document how Zebra does cross-crate proptests --- book/src/dev/proptests.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 book/src/dev/proptests.md diff --git a/book/src/dev/proptests.md b/book/src/dev/proptests.md new file mode 100644 index 00000000..035a5864 --- /dev/null +++ b/book/src/dev/proptests.md @@ -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"] }`