Registry / testing / proptest

proptest

JSON →
library1.11.0rscratesunverified

Hypothesis-like property-based testing and shrinking for Rust, generating random test cases and minimizing failures.

# Cargo.toml [dependencies] proptest = "1.11.0"
INSTALL
IMPORT
SIG · PROPTEST
P
proptest
testingrustv1.11.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

proptest
use proptest::prelude::*;

Defines a property-based test that checks addition properties with random inputs.

use proptest::prelude::*; proptest! { #[test] fn test_addition(a: i32, b: i32) { let result = a + b; assert!(result >= a + b.min(0) || result >= b + a.min(0)); } }
Debug
Known issues
gotchaProptest can generate many test cases, potentially slowing down test suites if not configured properly.
fix
Use the proptest! macro with a config block to limit cases, e.g., #![proptest_config = ProptestConfig::with_cases(100)].
affects: >=0.0.0
Upgrade
Version history
1.11.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
proptest — cargo add proptest · libregistry