@reason-native/qcheck-rely

1.0.2 • Public • Published

qcheck-rely

qcheck-rely contains custom Rely matchers that allow for easily using QCheck with Rely. QCheck is a "QuickCheck inspired property-based testing for OCaml, and combinators to generate random values to run tests on."

Installation (assuming esy for package management and dune for building)

You will want to add both @opam/qcheck and @reason-native/qcheck-rely to your package.json or esy.json file and qcheck-core and qcheck-rely to your dune file.

Usage

For writing QCheck tests, see QCheck. Integration with Rely can be done as below:

open TestFramework;
open QCheckRely;

let {describe, _} = extendDescribe(QCheckRely.Matchers.matchers);

describe("qcheck-rely", ({test, _}) => {
  test("qcheck tests", ({expect}) => {
    let myQCheckTest = ...
    expect.ext.qCheckTest(myQCheckTest);
    ();
  });
  test("qcheck cells", ({expect}) => {
    let myQCheckCell = ...
    expect.ext.qCheckCell(myQCheckCell);
    ();
  });
  test("qcheck tests with custom random seed", ({expect}) => {
    let myQCheckTest = ...
    /* can also be specified by the QCHECK_SEED environment variable */
    let customRandomSeed = Random.State.make([|42|]);
    expect.ext.qCheckTest(~rand=customRandomSeed, myQCheckTest);
    ();
  });

Package Sidebar

Install

npm i @reason-native/qcheck-rely

Weekly Downloads

4

Version

1.0.2

License

MIT

Unpacked Size

2.27 MB

Total Files

439

Last publish

Collaborators

  • andreypopp
  • benderson
  • jordwalke
  • rickyvetter