Expand description
Pointwise-claim accumulator API: Verdict, ClaimBuilder,
SetClaim, SeqClaim, and the claim! macro.
Verdict is the per-test claim accumulator. Assert holds threshold
config and stays Copy; Verdict carries the per-test claim records
(which include Vec/String allocations) and is built via
Assert::default_checks().verdict() or Verdict::new.
Test authors reach for one of two compile-mechanical labelers:
-
Typed field accessors generated by
#[derive(Claim)]on stats structs — e.g.stats.claim_max_gap_ms(&mut verdict).at_most(100). The label"max_gap_ms"comes fromstringify!(max_gap_ms)in the generated method body; renaming the field updates both the method name AND the rendered label. -
The
claim!macro on a local binding or expression — e.g.claim!(verdict, iter_delta).at_least(100). The label comes fromstringify!(<token tree>)over the expression tokens.
There is NO third recommended “manual string” path. The
string-taking entry points on Verdict (claim / claim_set /
claim_seq / claim_present) are #[doc(hidden)] and expected to
be fed only by stringify! via the derive or the claim! macro.
Comparator surface for ClaimBuilder<T>:
T: PartialOrd + Display->at_least/at_most/lt/gt/betweenT: PartialEq + Display->eq/neT = f64->is_finite/near
Container claims (set / sequence) bypass scalar comparators and offer
empty / nonempty / contains / len_eq / len_at_most /
len_at_least / subset_of / disjoint_from instead.
Structs§
- Claim
Builder - Per-claim builder for scalar values. Produced by
Verdict::claim(and the typedclaim_<field>accessors generated by#[derive(Claim)]). Chain a comparator (at_least,at_most,lt,gt,between,eq,ne,is_finite,near) to record the outcome. - Present
Claim - Per-claim builder for a possibly-absent (
Option-valued) metric. Produced byVerdict::claim_presentand theclaim_present!macro. OnSome(v)every comparator delegates to the value-boundClaimBuilder, so a present metric behaves EXACTLY likeclaim!. OnNonethe metric is absent — there is nothing to compare, so every comparator records a LOUDFail(<name>: metric absent) rather than silently passing. This mirrors the no-guessed-value discipline ofMetricId::defreturningNonefor an unregistered key: an absent signal fails the gate, it does not vacuously satisfy it (the hazard ofmetric.unwrap_or(0.0), where a missing metric becomes a sentinel that can pass a bound). - SeqClaim
- Per-claim builder for slice /
Vec<T>values. Same modifier surface asSetClaim; comparator surface is sequence-specific. - SetClaim
- Per-claim builder for
BTreeSet<T>values. Samekind/becausemodifiers asClaimBuilder; comparator surface is set-specific. - Verdict
- Pointwise-claim accumulator.