package hedgehog
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
Property-based testing with integrated shrinking for OCaml
Install
dune-project
Dependency
Authors
Maintainers
Sources
hedgehog-0.1.tbz
sha256=336e7547dd1e41b3e4839a11aaec56d4e2fe14b7dc82a9caa560dbd24f2614f7
sha512=5f040fc5e41b4571b75c460622becd98c54a1d5cb36574a9d2ed6d06e71a5b31673b8ea69d9bb5972af9c71dff58fba2b9d33932a6bffc04c6dcd757583895cb
Description
Hedgehog is a property-based testing library with integrated shrinking, using OCaml 5 effects for assertions and logging.
Added to opam-repository:
README
Hedgehog
Property-based testing with integrated shrinking for OCaml.
Hedgehog is a property-based testing library in the spirit of Haskell Hedgehog. It provides:
- Integrated shrinking — generators produce a rose tree of outcomes, so every generator shrinks for free. No manual shrink functions needed.
- Range-controlled generation — numeric ranges separate the concept of bounds from the origin, giving you precise control over value distribution and shrink direction.
- Algebraic effects for assertions — test bodies use OCaml 5 effects for
assert_,annotate,cover, and more, keeping generator and test logic cleanly separated. - State machine testing — the
Hedgehog.Stmmodule lets you test stateful systems against abstract models, with sequential and parallel linearizability checking.
Quick example
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))))
|> ignoreGuides
getting-started— Installation and first propertymotivation— Why integrated shrinking matterstutorial— Generators, properties, assertions, coveragestate-testing— State machine testing withStmalternatives— Comparison with QCheck and Jane Street Quickcheckresources— Talks, papers, and related projects
API reference
Hedgehog.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
Dependencies (3)
-
domainslib
>= "0.5" -
ocaml
>= "5.1" -
dune
>= "3.2"
Dev Dependencies (3)
-
mdx
with-test -
odoc
>= "3.2.1" & with-doc -
ocamlformat
= "0.29.0" & with-dev-setup
Used by (1)
Conflicts
None
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page