Property tests for invariants: throw thousands of generated inputs at rules that must never break

minchoi · x · 2026-11-19

Rule 3 of minchoi's thread: write property tests for things that must never break—state a rule you think can't fail, then attack it with thousands of generated inputs. Examples: balance never goes negative, running a migration twice equals once, decode(encode(x))==x. Tools: fast-check (JS/TS), Hypothesis (Python), proptest (Rust).

Original post →

More from coding & agent

coding & agent channel →