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
__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,
)| Parameter | Type | Default | Description |
|---|---|---|---|
$attempts | int | required | Bodies executed in the random phase, discarded ones included. |
$discards | int | required | Runs discarded via Assume::that(). |
$checks | int | required | Successful (non-discarded, non-failing) runs — the label denominator. |
$labels | list<\Runner\LabelShare> | required | Every label recorded or required, most frequent first and alphabetical within a count, so two runs of the same property compare line by line. |
$coverageAssessed | bool | required | Whether 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. |
$skips | int | 0 | Runs 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. |
$tables | array<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. |
$intersections | array<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 | ?int | NULL | The parameter domain enumerated instead of sampled; null when sampled. |
$exhaustiveDeclined | ?string | NULL | Why an exhaustive run sampled after all; null otherwise. |
Methods
of()
static of(\Runner\RunStatistics $statistics, bool $coverageAssessed): selfThe report for one set of counters.
$statistics— The phase's accumulated counters andcover()requirements.$coverageAssessed— Whether the run reached the coverage assessment at all.
discardPercent()
discardPercent(): floatDiscarded 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()
label(string $label): ?Runner\LabelShareOne 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()
unmetRequirements(): arrayThe 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()
toArray(): arrayMachine-readable representation suitable for telemetry and serialization.