package tezt-bam
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=1b12aab13fb56d275a1f495a45a106e4b18137f2873f7f1c63875dc4149867bc
sha512=93081f70872db99e50c16703cc4a9a900f121a2cacd2f210bd5b0b55ad9139d187bbe06e748ea8c45475fa84d1e7767d82d5b3adb505bc1250f454fa09e140e2
Description
Provides a way to register PBT tests with Tezt
README
Bam - Property-Based Testing Library for OCaml
Overview
Bam is an OCaml library designed for writing property-based tests. It simplifies the process of defining and using generators for tests, offering a monad-like structure that integrates seamlessly with shrinking strategies. This design aims to make shrinking both predictable and effective, thereby enhancing the debugging experience.
Key Features
Standard Module: The {!module:Std} module provides some basic generators with predefined shrinking strategies
Monad-like Generators: The library enables easy creation of new generators, following a monad-like pattern that works harmoniously with shrinking mechanisms.
Shrinking Strategies: Various default shrinking strategies are available, aiding in the efficient identification of minimal counter-examples.
Custom Shrinkers: The {!Gen} module allows for the definition of ad-hoc shrinkers.
Documentation on Shrinking: For those interested in understanding the intricacies of shrinking within this library, a detailed primer is available here.
Installation
With opam
opam install bam tezt-bam
Usage
A simple test can be run as follows:
open Tezt_bam
let register () =
let gen = Std.int () in
let property _x = Ok () in
Pbt.register ~__FILE__ ~title:"Simple example of bam" ~tags:["bam"; "simple"]
~gen ~property ()
More examples can be found here.