Skip to content

BytesArbitrary

Rasuvaeff\PropertyTesting\Arbitrary\BytesArbitrary

ClassPackage: property-testing-coreSourceVersion: v0.1.0-12-g86ead85

Implements: ArbitraryInterface

Generates raw byte strings (every byte 0..255, not printable text) and shrinks them by length toward the empty string, then byte-by-byte toward NUL ("\x00"). Useful for parsers, codecs and binary protocols.

Constructor

php
__construct(
    int $minLength = 0,
    int $maxLength = 100,
)
ParameterTypeDefaultDescription
$minLengthint0
$maxLengthint100

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.