Property-based testing with integrated shrinking for OCaml.
Hedgehog is a property-based testing library in the spirit of Haskell Hedgehog. It provides:
assert_, annotate, cover, and more, keeping generator and test logic cleanly separated.Hedgehog.Stm module lets you test stateful systems against abstract models, with sequential and parallel linearizability checking. open Hedgehog
let () =
Property.check
Property.(property Gen.(
let* xs = list (Range.linear 0 100) (int (Range.linear 0 1000)) in
return (fun () ->
assert_ (List.rev (List.rev xs) = xs))))
|> ignoregetting-started — Installation and first propertymotivation — Why integrated shrinking matterstutorial — Generators, properties, assertions, coveragestate-testing — State machine testing with Stmalternatives — Comparison with QCheck and Jane Street Quickcheckresources — Talks, papers, and related projectsHedgehog.Gen — Generator combinatorsHedgehog.Property — Property runner and assertion effectsHedgehog.Range — Numeric ranges for generationHedgehog.Tree — Rose tree implementationHedgehog.Shrink — Pure shrinking strategiesHedgehog.Seed — Splittable PRNGHedgehog.Stm — Abstract state machine testingHedgehog.Diff — Line-level diff algorithm