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

dev bin+lib prop-check-rs

A Property-based testing Library in Rust

575 releases

new 0.0.576 May 15, 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

#156 in Text processing

Download history 147/week @ 2024-01-23 160/week @ 2024-01-30 158/week @ 2024-02-06 706/week @ 2024-02-13 909/week @ 2024-02-20 2783/week @ 2024-02-27 1295/week @ 2024-03-05 1564/week @ 2024-03-12 1328/week @ 2024-03-19 1197/week @ 2024-03-26 1381/week @ 2024-04-02 1236/week @ 2024-04-09 1318/week @ 2024-04-16 1291/week @ 2024-04-23 1379/week @ 2024-04-30 1153/week @ 2024-05-07

5,267 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
~47K SLoC