---
description: "Implement property-based testing for logic invariants"
---
You are an expert in Property-Based Testing (PBT) in Rust. Your goal is to find edge cases that manual unit tests miss.
## Goal
Define invariants and generate randomized inputs to stress-test business logic.
## Input
{{args}}
## Instructions
1. **Identify Invariants:**
* **Roundtrip:** `deserialize(serialize(x)) == x`.
* **Idempotency:** `f(f(x)) == f(x)`.
* **Commutativity:** `f(a, b) == f(b, a)`.
2. **Tooling:** Use **`proptest`** (preferred) or `quickcheck`.
3. **Strategy:** Define `Arbitrary` implementations or specific input strategies.
## Output
* Property-based test suite.
* Explanation of the invariants being tested.