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_shrinkparameters in alcotest interface and expose defaultdebug_shrinking_choicesin test runners - add missing
?handlerparameter toTest.check_cell_exn - add an option
retriesparameter toTest.makeet al. for checking a property repeatedly while shrinking.
This can be useful when testing non-deterministic code. - add
tup2totup9for generators - add
Test.make_negfor negative property-based tests, that are expected not to satisfy the tested property. - add environment variable
QCHECK_LONG_FACTORsimilar toQCHECK_COUNT - rename
Gen.opttoGen.optionbut keep the old binding for compatibility. - shrinker changes
- recursive
listshrinker with better complexity -
stringshrinker reuses improvedlistshrinker and addscharshrinking - function shrinker now shrinks default entry first and benefits from
listshrinker improvements - replacing the linear-time
charshrinker with a faster one reusing the bisectingintshrinker algorithm - add
Shrink.char_numeralandShrink.char_printable - add shrinking for
char arbitraryschar,printable_char, andnumeral_char
- recursive
- add optional
-
bug fixes
- fix function generation affecting reproducability
- fix distribution of
QCheck2.printablewhich would omit certain characters - use
Float.equalfor comparingfloats in theObservablemodule underlying function generators.
-
documentation updates:
- clarify upper bound inclusion in
Gen.int_boundandGen.int_range - clarify
printable_charandGen.printabledistributions - add missing
string_gen_of_sizeandsmall_printable_stringdocumentation - document
QCheck_alcotest.to_alcotest - fix documented size distribution for
arbitrarygeneratorsstring_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.printableandprintable_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-bufferoption ondune runtestto avoid garbling the test output - make test suite run on 32-bit architectures