QCheck2.Tree
A tree represents a generated value and its successive shrunk values.
Conceptually a pseudo-randomly generated value is packaged with its shrunk values. This coupling - called "integrated shrinking" - in a single type has a major benefit: most generators get shrinking "for free" by composing from smaller generators, and shrinking does not break invariants (e.g. shrinks of a positive number are always positive).
A tree of random generated values, where the root contains the value used for the test, and the sub-trees contain shrunk values (as trees, to be able to shrink several times a value) used if the test fails.
val root : 'a t -> 'a
root tree
returns the root value of the tree of generated values t
.
children tree
returns the direct sub-trees of the tree of generated values t
.
val pp :
?depth:int ->
(Stdlib.Format.formatter -> 'a -> unit) ->
Stdlib.Format.formatter ->
'a t ->
unit
pp ?depth pp_a ppf tree
pretty-prints the tree of generated values tree
using the pretty-print formatter ppf
. Values of type 'a
will be printed using the given pretty-printer pp_a
.
As a tree t
can be potentially huge when fully evaluated, you can control the maximum depth the printer goes with depth
.
None
means "everything"0
means "only the root"1
means "the root and its direct shrinks"2
means "the root, its direct shrinks, and the shrinks of its shrinks"