#property-based #property-based-testing

dev bin lib prop-check-rs

A Property-based testing Library in Rust

809 releases

new 0.0.810 Jan 5, 2025
0.0.805 Dec 31, 2024
0.0.774 Nov 30, 2024
0.0.653 Jul 31, 2024
0.0.7 Nov 11, 2021

#175 in Text processing

Download history 2323/week @ 2024-09-15 1431/week @ 2024-09-22 1633/week @ 2024-09-29 1455/week @ 2024-10-06 1584/week @ 2024-10-13 1359/week @ 2024-10-20 1131/week @ 2024-10-27 1030/week @ 2024-11-03 1003/week @ 2024-11-10 1227/week @ 2024-11-17 1264/week @ 2024-11-24 1132/week @ 2024-12-01 1234/week @ 2024-12-08 1102/week @ 2024-12-15 1112/week @ 2024-12-22 1278/week @ 2024-12-29

4,877 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
~50K SLoC