spec loves data structures
summary
Shows that Clojure spec plus test.check are used to build white‑box invariant tests and custom generators that find subtle persistent data structure bugs (hashmap transient errors from 2013, a split bug reported 2016, AVL rebalancing omissions). Converts trees to a map representation, generates reachable and unreachable instances, runs generative checks (about 50 property runs, 14 invariant checks), fixes defects and raises confidence that the rebuilt implementations actually obey structural and performance contracts.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 9:10data.avl Aug 2016 (DAVL-8)
- 11:05data.avi Oct 2016 (new invariant tests)
- 16:12The final black box
- 20:36Enter spec cont'd
- 26:24data.avl leaf specs
- 27:22data.avl :: node spec
- 28:49data.avl :: avl-map spec
- 29:52data.avl invariant test
- 31:35data.avl spec'd cont'd
- 36:51s/fdef as test specification cont'd
- 39:41No parameterized specs
- 41:31Next steps
related talks
38mLiving with Spec
24mSpeculative Development
32mGenerative Testing: Properties, State and Beyond
25mPowerful Testing with test.check
38mAbove and beyond type systems with clojure.spec
31mTesting Made Simple
48mContracts & Clojure: The Best-Yet Compromise of Types and Tests
47mTesting the Hard Stuff and Staying Sane
