QuickCheck Arbitrary Derive
A #[derive(QuickCheck)] macro to automatically implement QuickCheck’s Arbitrary (with arbitrary + shrink) for your types.
Dual-licensed under MIT or UNLICENSE
Installation
Add to your Cargo.toml:
= "1.0" # quickcheck runtime
= "0.1" # this derive macro
Example usage
You should see that the test fails, and that the minimal example produced is just (1, 0). The derive macro automatically implements both arbitrary and shrink so that the sample failing test cases are as simple as possible.
Features
- Implements both
arbitraryandshrink - Works on:
- Named Structs
- Unnamed Structs
- Enums
- Supports generic type paramaters
- Supports linear and recursive types via
#[quickcheck(recursive = Exponential)]enum variant attribute
Limitations
- Does not support union types
- Does not support lifetime parameters