I’m happy to share the release of QCheck 0.19 - a library for property-based testing in OCaml in the style of Haskell’s QuickCheck.
GitHub repo: GitHub - c-cube/qcheck: QuickCheck inspired property-based testing for OCaml.
Documentation: index
The 0.19 release brings a range of new features and improvements detailed below and combines the effort of several individual contributors.
It is now available on opam.
Release notes:
-
new features and feature extensions
- add optional
debug_shrink
parameters in alcotest interface and expose defaultdebug_shrinking_choices
in test runners - add missing
?handler
parameter toTest.check_cell_exn
- add an option
retries
parameter toTest.make
et al. for checking a property repeatedly while shrinking.
This can be useful when testing non-deterministic code. - add
tup2
totup9
for generators - add
Test.make_neg
for negative property-based tests, that are expected not to satisfy the tested property. - add environment variable
QCHECK_LONG_FACTOR
similar toQCHECK_COUNT
- rename
Gen.opt
toGen.option
but keep the old binding for compatibility. - shrinker changes
- recursive
list
shrinker with better complexity -
string
shrinker reuses improvedlist
shrinker and addschar
shrinking - function shrinker now shrinks default entry first and benefits from
list
shrinker improvements - replacing the linear-time
char
shrinker with a faster one reusing the bisectingint
shrinker algorithm - add
Shrink.char_numeral
andShrink.char_printable
- add shrinking for
char arbitrary
schar
,printable_char
, andnumeral_char
- recursive
- add optional
-
bug fixes
- fix function generation affecting reproducability
- fix distribution of
QCheck2.printable
which would omit certain characters - use
Float.equal
for comparingfloat
s in theObservable
module underlying function generators.
-
documentation updates:
- clarify upper bound inclusion in
Gen.int_bound
andGen.int_range
- clarify
printable_char
andGen.printable
distributions - add missing
string_gen_of_size
andsmall_printable_string
documentation - document
QCheck_alcotest.to_alcotest
- fix documented size distribution for
arbitrary
generatorsstring_gen
,string
,printable_string
,numeral_string
,list
, andarray
- fix exception documentation for
check_result
,check_cell_exn
, andcheck_exn
- fix documentation for the distribution of
Gen.printable
andprintable_char
- fix documentation for the shrinking behaviour of
QCheck2.printable
- clarify upper bound inclusion in
-
internal and test suite changes
- add additional expect and unit tests and refactor expect test suite
- add a shrinker performance benchmark
- remove
--no-buffer
option ondune runtest
to avoid garbling the test output - make test suite run on 32-bit architectures