Skip to content

DistributionReport ​

Rasuvaeff\PropertyTesting\Runner\DistributionReport

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

What the random phase actually generated, as data: every Classify label with its share, every cover() threshold beside the share it is compared against, and the discard tally with its own share.

The engine has always counted these; until now it handed over raw counters for an adapter to format into a line of text, which left everything that is not a human parsing that line back — a CI job collecting distributions, or a test asserting that a property really reaches a branch often enough. This is that line's contents before it becomes a line. Printing remains the adapter's job.

A projection of counters already accumulated, computed once when the run finishes: Classify::label() runs in the property body on every run, this does not.

Two denominators, deliberately different and named so a consumer cannot mix them up: label shares are over the successful $checks, the discard share is over the $attempts.

Constructor ​

php
__construct(
    int $attempts,
    int $discards,
    int $checks,
    list<\Runner\LabelShare> $labels,
    bool $coverageAssessed,
    int $skips = 0,
    array<string,list<\Runner\LabelShare>> $tables = [],
    array<string,list<\Runner\LabelShare>> $intersections = [],
    ?int $domainSize = NULL,
    ?string $exhaustiveDeclined = NULL,
)
ParameterTypeDefaultDescription
$attemptsintrequiredBodies executed in the random phase, discarded ones included.
$discardsintrequiredRuns discarded via Assume::that().
$checksintrequiredSuccessful (non-discarded, non-failing) runs — the label denominator.
$labelslist<\Runner\LabelShare>requiredEvery label recorded or required, most frequent first and alphabetical within a count, so two runs of the same property compare line by line.
$coverageAssessedboolrequiredWhether the engine judged the cover() requirements. False when the run ended before the check loop completed (it gave up on discards, or ran out of its time budget): the shares below are still what happened, but nothing enforced them.
$skipsint0Runs the environment refused. Counted inside $attempts like discards are, and apart from $discards for the same reason the engine separates the two budgets: a distribution that is mostly skips says nothing about the generators.
$tablesarray<string,list<\Runner\LabelShare>>[]The Classify::tabulate() tables, by name: one share per tag, ordered like $labels. Never carries a requirement — a table is observation, not a gate.
$intersectionsarray<string,list<\Runner\LabelShare>>[]Per table, the share of checks that hit each pair of its tags together, the pair rendered tagA & tagB in sorted order. Only pairs that occurred at least once; a table whose runs never hit two tags at once has an empty list here.
$domainSize?intNULLThe parameter domain enumerated instead of sampled; null when sampled.
$exhaustiveDeclined?stringNULLWhy an exhaustive run sampled after all; null otherwise.

Methods ​

of() ​

php
static of(\Runner\RunStatistics $statistics, bool $coverageAssessed): self

The report for one set of counters.

  • $statistics — The phase's accumulated counters and cover() requirements.
  • $coverageAssessed — Whether the run reached the coverage assessment at all.

discardPercent() ​

php
discardPercent(): float

Discarded runs as a percentage of the attempts — the one share whose denominator is not $checks, because a discard is precisely an attempt that never became a check. A phase that executed nothing reports 0.0 rather than a division by zero.

label() ​

php
label(string $label): ?Runner\LabelShare

One label's share, or null when the property never recorded or required it — which is the answer to "is this branch reached at all".

  • $label — The label as the property body would record it.

unmetRequirements() ​

php
unmetRequirements(): array

The labels whose cover() threshold the recorded share does not reach.

Empty when every requirement held — and, on a run that never reached the assessment, still only arithmetic (see $coverageAssessed).

toArray() ​

php
toArray(): array

Machine-readable representation suitable for telemetry and serialization.