nw-pbt-rust

Solid

Rust property-based testing with proptest, quickcheck, and bolero frameworks

Testing & QA 526 stars 55 forks Updated 1 weeks ago MIT

Install

View on GitHub

Quality Score: 95/100

Stars 20%
91
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# PBT Rust -- proptest, quickcheck, bolero ## Framework Selection | Framework | Shrinking | Stateful | Choose When | |-----------|-----------|----------|-------------| | proptest | Integrated | No | Default choice. Most features, best shrinking. | | quickcheck | Type-based | No | Simple properties, one generator per type sufficient | | bolero | Engine-dependent | No | Want to switch between PBT and fuzzing engines | **Default**: proptest. Supports multiple strategies per type without newtype wrappers, better shrinking. ## Quick Start (proptest) ```rust use proptest::prelude::*; proptest! { #[test] fn sort_preserves_length(ref v in prop::collection::vec(any::<i32>(), 0..100)) { let mut sorted = v.clone(); sorted.sort(); prop_assert_eq!(sorted.len(), v.len()); } } // Run: cargo test ``` ## Generator (Strategy) Cheat Sheet (proptest) ### Primitives ```rust any::<i32>() // any i32 0..100i32 // range (implements Strategy) any::<f64>() any::<String>() any::<bool>() any::<Vec<u8>>() // bytes Just(42) // constant ``` ### Collections ```rust prop::collection::vec(any::<i32>(), 0..50) prop::collection::vec(any::<i32>(), 1..=10) // non-empty, max 10 prop::collection::hash_set(any::<i32>(), 0..20) prop::collection::hash_map(any::<String>(), any::<i32>(), 0..20) (any::<i32>(), any::<String>()) // tuple ``` ### Combinators ```rust // ...

Details

Author
nWave-ai
Repository
nWave-ai/nWave
Created
3 months ago
Last Updated
1 weeks ago
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category