How to use proptest crate in Rust property testing

Use proptest by adding it as a dev-dependency and writing #[test] functions with proptest! macros to automatically verify logic against random inputs.

Add proptest as a dev-dependency in Cargo.toml, then use #[test] functions with proptest! macros to define strategies and assertions.

[dev-dependencies]
proptest = { version = "0.10", default-features = false, features = ["alloc"] }
use proptest::prelude::*;

#[test]
fn test_addition() {
    proptest!(|(a in any::<i32>(), b in any::<i32>())| {
        prop_assert_eq!(a + b, b + a);
    });
}

Set PROPTEST_CASES in your environment to control test iterations, as shown in CI configurations.