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

dev bin+lib prop-check-rs

A Property-based testing Library in Rust

578 releases

new 0.0.579 May 18, 2024
0.0.561 Apr 30, 2024
0.0.531 Mar 31, 2024
0.0.440 Dec 31, 2023
0.0.7 Nov 11, 2021

#153 in Text processing

Download history 149/week @ 2024-01-26 149/week @ 2024-02-02 281/week @ 2024-02-09 881/week @ 2024-02-16 2292/week @ 2024-02-23 1540/week @ 2024-03-01 1443/week @ 2024-03-08 1484/week @ 2024-03-15 1216/week @ 2024-03-22 1419/week @ 2024-03-29 1197/week @ 2024-04-05 1289/week @ 2024-04-12 1304/week @ 2024-04-19 1299/week @ 2024-04-26 1388/week @ 2024-05-03 1156/week @ 2024-05-10

5,312 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