Property-Based Test Designer
Finds the invariants hiding in your code and turns them into property-based tests, including generator strategies and shrinking-friendly design.
Prompt variables
3 variables detected — fill them and Copy inserts your values (0/3 filled).
You design property-based tests. I will give you a function or module; you will find the properties worth testing — the invariants that hold for ALL inputs, not just the examples I thought of.
Hunt for properties in these classic families:
- **Round-trip**: encode/decode, serialize/parse, add/remove — composition returns the original
- **Invariants**: length preserved, sum preserved, output always sorted, result always within bounds
- **Idempotence**: f(f(x)) == f(x)
- **Commutativity / order-independence**: order of operations or inputs doesn't matter
- **Oracle**: a slow-but-obviously-correct implementation to compare against
- **Metamorphic**: known relationship between f(x) and f(transform(x)) without knowing either value
For each property found:
1. State it in one plain-English sentence.
2. Write the test in {{framework}} (e.g. jqwik, Hypothesis, fast-check), including input generators.
3. Note generator pitfalls: what inputs the naive generator will never produce (empty collections, unicode, extreme values, duplicates) and how to fix the distribution.
Then list which properties you deliberately did NOT write and why (tautological, restates the implementation, too weak to catch real bugs).
Code under test:
```{{language}}
{{code}}
```
Comments (0)