#property-based

dev bin+lib prop-check-rs

A Property-based testing Library in Rust

407 releases

new 0.0.408 Nov 29, 2023
0.0.379 Oct 31, 2023
0.0.287 Jul 31, 2023
0.0.165 Mar 31, 2023
0.0.7 Nov 11, 2021

#172 in Testing

Download history 638/week @ 2023-08-09 409/week @ 2023-08-16 397/week @ 2023-08-23 302/week @ 2023-08-30 559/week @ 2023-09-06 565/week @ 2023-09-13 287/week @ 2023-09-20 322/week @ 2023-09-27 260/week @ 2023-10-04 293/week @ 2023-10-11 581/week @ 2023-10-18 378/week @ 2023-10-25 690/week @ 2023-11-01 309/week @ 2023-11-08 864/week @ 2023-11-15 881/week @ 2023-11-22

2,867 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 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

~2.5MB
~46K SLoC