Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation polish #302

Merged
merged 15 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading