Rust Bitcoin Proptest Strategies

Rust Bitcoin Proptest Strategies
Login

Rust Bitcoin Proptest Strategies

Proptest strategies for Bitcoin-related code.

This collection of generators (called strategies in proptest's terminology) helps developers of Bitcoin-related software written in Rust supply random data – both valid and invalid – to their property-based tests.

Visit documentation for details.

Example

#[cfg(test)]
mod tests {
  proptest! {
     #[test]
     // generates valid hex-encoded public keys, both compressed and uncompressed
     fn pubkey_parsing(s in prop::secp256k1::public_key::valid::hex()) {
        prop_assert!(s.len() == 66 || s.len() == 130);
        prop_assert!(my_parser(s).is_ok());
     }
  }
}