ArrayArbitrary
Rasuvaeff\PropertyTesting\Arbitrary\ArrayArbitrary
Class — Package: property-testing-core — Source — Version: v0.1.0-12-g86ead85
Implements: ArbitraryInterface
Type parameters:
TElement of mixed = mixed
Generates lists whose elements come from a delegate arbitrary and shrinks them by length toward the empty array, then element-by-element through each element's own shrink tree.
Element shrink trees are captured at generation time, so elements produced by transformed arbitraries (Gen::map(), Gen::flatMap()) shrink correctly.
Constructor
__construct(
\ArbitraryInterface<\Arbitrary\TElement> $element,
int $minSize = 0,
int $maxSize = 100,
)| Parameter | Type | Default | Description |
|---|---|---|---|
$element | \ArbitraryInterface<\Arbitrary\TElement> | required | |
$minSize | int | 0 | |
$maxSize | int | 100 |
Methods
generate()
generate(Random $random): ShrinkableProduce one random value from this arbitrary's space, together with its shrink tree. Candidates must be ordered most aggressive first (typically toward a zero/empty/identity element) and every branch of the tree must be finite, so shrinking terminates.
Documentation inherited from ArbitraryInterface.