Rust TDD Workflow Three Laws of TDD 1. Do NOT write production code without a failing test 2. Write only enough test to fail (including compilation failure) 3. Write only enough production code to pass the failing test Cycle: RED (test fails) - GREEN (minimum to pass) - REFACTOR (cleanup, cargo test) Red-Green-Refactor Steps Never skip step 2. If the test passes immediately, it tests nothing. Idiomatic Rust Test Patterns | Pattern | Usage | When | |---------|-------|------| | Arrange-Act-Assert | Base structure for every test | Always | | / | Direct comparison / booleans | Deterministic value…