package bam

  1. Overview
  2. Docs
A property-based testing library with internal shrinking

Install

Dune Dependency

Authors

Maintainers

Sources

bam-0.1.tbz
sha256=1b12aab13fb56d275a1f495a45a106e4b18137f2873f7f1c63875dc4149867bc
sha512=93081f70872db99e50c16703cc4a9a900f121a2cacd2f210bd5b0b55ad9139d187bbe06e748ea8c45475fa84d1e7767d82d5b3adb505bc1250f454fa09e140e2

Description

A property-based testing allowing to define generators with internal shrinking easily

Tags

test pbt shrinking internal

Published: 19 Feb 2024

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.

License

Dependencies (4)

  1. zarith >= "1.13"
  2. pringo
  3. dune >= "3.7" & >= "3.7"
  4. ocaml >= "4.14"

Dev Dependencies (2)

  1. tezt with-test
  2. odoc with-doc

Used by (1)

  1. tezt-bam < "0.3"

Conflicts

None

OCaml

Innovation. Community. Security.