Skip to content

Commit

Permalink
Merge pull request #302 from jmid/doc-polish
Browse files Browse the repository at this point in the history
Documentation polish
  • Loading branch information
jmid authored Dec 12, 2024
2 parents 7b6e50c + da09a2a commit ce4a500
Show file tree
Hide file tree
Showing 7 changed files with 660 additions and 514 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## NEXT RELEASE

- Clean-up `QCheck` and `QCheck2` documentation pages
- Add `exponential` generator to `QCheck`, `QCheck.Gen`, and `QCheck2.Gen`
- Add `Shrink.bool` and use it in `QCheck.bool`
- Remove unread `fun_gen` field from `QCheck2`'s `fun_repr_tbl` type
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ clean:
@dune clean

doc:
@dune build @doc
@dune build @doc doc/

example-test:
@dune exec example/ounit/QCheck_test.exe
Expand Down
3 changes: 3 additions & 0 deletions doc/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(documentation
(package qcheck-core)
(mld_files index))
31 changes: 31 additions & 0 deletions doc/index.mld
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{0 qcheck-core}

The [qcheck-core] opam package contains two libraries:

- The [qcheck-core] library for defining property-based tests
- The [qcheck-core.runner] library for running property-based tests

{1: The [qcheck-core] library}

The [qcheck-core] library exposes two toplevel modules:

- {!QCheck} is the initial property-based-testing module and
- {!QCheck2} is a newer property-based-testing module supporting integrated shrinking

Of the two, {!QCheck} is the most battle-tested module.
{!QCheck2} on the other hand offers integrated shrinking, thus
removing the need for having to hand-write shrinkers.

{!QCheck} tests can be ported to {!QCheck2} by following the
{{!QCheck2.migration_qcheck2}migration guide}. Please
file an issue if you encounter problems using either of the two
modules.

{1: The [qcheck-core.runner] library}

The entry point of the [qcheck-core.runner] library is the {!QCheck_base_runner} module.

One can run a list of property-based tests by calling either

- {!QCheck_base_runner.run_tests}, which accepts a number of optional arguments, or
- {!QCheck_base_runner.run_tests_main}, which can be controlled via command-line arguments
4 changes: 2 additions & 2 deletions src/core/QCheck.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1042,9 +1042,9 @@ type 'a stat = string * ('a -> int)

type 'a arbitrary = {
gen: 'a Gen.t;
print: ('a -> string) option; (** print values *)
print: ('a Print.t) option; (** print values *)
small: ('a -> int) option; (** size of example *)
shrink: ('a -> 'a Iter.t) option; (** shrink to smaller examples *)
shrink: ('a Shrink.t) option; (** shrink to smaller examples *)
collect: ('a -> string) option; (** map value to tag, and group by tag *)
stats: 'a stat list; (** statistics to collect and print *)
}
Expand Down
Loading

0 comments on commit ce4a500

Please sign in to comment.