#testing #property-based

dev bin+lib prop-check-rs

A Property-based testing Library in Rust

53 releases

new 0.0.54 Dec 10, 2022
0.0.53 Dec 9, 2022
0.0.44 Nov 30, 2022
0.0.13 Oct 31, 2022
0.0.4 Aug 31, 2021

#89 in Testing

Download history 27/week @ 2022-08-20 14/week @ 2022-08-27 27/week @ 2022-09-03 160/week @ 2022-09-10 66/week @ 2022-09-17 48/week @ 2022-09-24 43/week @ 2022-10-01 151/week @ 2022-10-08 41/week @ 2022-10-15 33/week @ 2022-10-22 206/week @ 2022-10-29 216/week @ 2022-11-05 274/week @ 2022-11-12 306/week @ 2022-11-19 244/week @ 2022-11-26 285/week @ 2022-12-03

1,152 downloads per month
Used in 4 crates

MIT/Apache

45KB
1.5K SLoC

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

Choose one value from a list

#[test]
fn test_one_of() -> Result<()> {
  let gen = Gens::one_of_values(['a', 'b', 'c', 'x', 'y', 'z']);
  let prop = for_all_gen(gen, move |value| {
      log::info!("value = {}", value);
      true
  });
  test_with_prop(prop, 1, 100, new_rng())
}

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.

Dependencies

~2MB
~42K SLoC