pub struct Kit { /* private fields */ }Expand description
The resolver test kit: the fixtures and the checks. See the module documentation.
Implementations§
Source§impl Kit
impl Kit
Sourcepub fn new() -> Kit
pub fn new() -> Kit
The kit, for a resolver that is not time-aware, with the default AnswerRule
(TxAndAsof) for when it is declared time-aware.
Sourcepub fn slices(self, yes: bool) -> Kit
pub fn slices(self, yes: bool) -> Kit
Declares whether the resolver under test supplies manifests (Resolver::manifest)
and is loaded with Fixtures::slices: then check and
run include check_slices. Off by default, so a
resolver loaded as for 0.3.3 passes as before.
Sourcepub fn time_aware(self, yes: bool) -> Kit
pub fn time_aware(self, yes: bool) -> Kit
Declares whether the resolver under test is time-aware: whether
evaluate gives, for a cell with several versions, the value of
the latest version that answers as of asof under the kit’s
answer_rule (by default TxAndAsof: tx <= asof and the
receipt’s asof at or before it). Time-aware resolvers (a store) are held to it;
others (MapResolver) are not.
Sourcepub fn answer_rule(self, rule: AnswerRule) -> Kit
pub fn answer_rule(self, rule: AnswerRule) -> Kit
Sets the AnswerRule a time-aware resolver is held to (default TxAndAsof). It
can be set before or after time_aware, and changes nothing for
a resolver that is not time-aware.
Sourcepub fn run<R: Resolver, F: FnOnce(&Fixtures) -> R>(
&self,
load: F,
) -> Result<(), Report>
pub fn run<R: Resolver, F: FnOnce(&Fixtures) -> R>( &self, load: F, ) -> Result<(), Report>
Calls load with the fixtures, then runs every check on the resolver it returns.
Sourcepub fn check(&self, resolver: &dyn Resolver) -> Result<(), Report>
pub fn check(&self, resolver: &dyn Resolver) -> Result<(), Report>
Runs every check on a resolver loaded with fixtures.
Sourcepub fn check_slices(&self, resolver: &dyn Resolver) -> Result<(), Report>
pub fn check_slices(&self, resolver: &dyn Resolver) -> Result<(), Report>
Receipts citing slices verify through the resolver’s manifests and members, which it returns exactly as loaded; see the module documentation. A resolver that supplies no manifests fails it.
Sourcepub fn check_lazy_calls(&self, resolver: &dyn Resolver) -> Result<(), Report>
pub fn check_lazy_calls(&self, resolver: &dyn Resolver) -> Result<(), Report>
Step 7 asks the resolver only for what it reaches, and nothing when the receipt fails before step 7.
What the resolver does not have is unavailable, never a panic.
Sourcepub fn check_bytes(&self, resolver: &dyn Resolver) -> Result<(), Report>
pub fn check_bytes(&self, resolver: &dyn Resolver) -> Result<(), Report>
descriptor and receipt return exactly the bytes loaded.
Sourcepub fn check_asof(&self, resolver: &dyn Resolver) -> Result<(), Report>
pub fn check_asof(&self, resolver: &dyn Resolver) -> Result<(), Report>
evaluate receives the receipt’s asof; for a time-aware resolver, a cell’s value is
that of its latest version that answers under the kit’s AnswerRule.