Skip to content

TupleArbitrary ​

Rasuvaeff\PropertyTesting\Arbitrary\TupleArbitrary

Class — Package: property-testing-core — Source — Version: v1.0.0-1-g88fdee2

Implements: Enumerable, ArbitraryInterface

Fixed-arity tuple: produces a list with one value per element arbitrary, in order. Useful for generating several correlated parameters as a single value (the property receives the tuple as one array argument and destructures it).

Shrinking keeps the arity fixed and shrinks one position at a time through that position's own shrink tree, so each component shrinks within its domain.

Constructor ​

php
__construct(
    ArbitraryInterface $elements,
)
ParameterTypeDefaultDescription
$elementsArbitraryInterfacerequired

Methods ​

generate() ​

php
generate(Random $random): Shrinkable

Produce 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.

domainSize() ​

php
domainSize(): ?int

The product of the elements' domains, when every element has one.

enumerate() ​

php
enumerate(): iterable

First element varying slowest.