#testing #property-based #value #choose #property-based-testing

dev bin+lib prop-check-rs

A Property-based testing Library in Rust

555 releases

new 0.0.556 Apr 25, 2024
0.0.531 Mar 31, 2024
0.0.440 Dec 31, 2023
0.0.409 Nov 30, 2023
0.0.7 Nov 11, 2021

#169 in Text processing

Download history 163/week @ 2024-01-03 156/week @ 2024-01-10 164/week @ 2024-01-17 138/week @ 2024-01-24 165/week @ 2024-01-31 160/week @ 2024-02-07 819/week @ 2024-02-14 1685/week @ 2024-02-21 2019/week @ 2024-02-28 1345/week @ 2024-03-06 1545/week @ 2024-03-13 1311/week @ 2024-03-20 1244/week @ 2024-03-27 1310/week @ 2024-04-03 1276/week @ 2024-04-10 1144/week @ 2024-04-17

5,137 downloads per month
Used in 4 crates

MIT/Apache

57KB
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
~48K SLoC