prop-check-rs 0.0.11

A Property-based testing Library in Rust
Documentation

prop-check-rs

A Rust crate for property-based testing.

Workflow Status crates.io docs.rs dependency status tokei

Install to Cargo.toml

Add this to your Cargo.toml:

[dependencies]
prop-check-rs = "<<version>>"

Usage

#[test]
fn test_one_of() -> Result<()> {
  let gens: Vec<Gen<char>> = vec!['a', 'b', 'c', 'x', 'y', 'z'].into_iter().map(Gens::unit).collect();
  let gen = Gens::one_of(gens);
  let prop = for_all(gen, move |value| {
      log::info!("value = {}", value);
      true
  });
  test_with_prop(prop, 1, 100, new_rng())
}

for example, https://github.com/j5ik2o/uri-rs/blob/main/src/parser/parsers/uri_parsers.rs

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.