PropertyTestable

Trait PropertyTestable 

Source
pub trait PropertyTestable {
    type Operation: Debug + Clone;

    // Required methods
    fn generate_operation(&self, rng: &mut DeterministicRng) -> Self::Operation;
    fn apply_operation(&mut self, op: &Self::Operation, clock: &SimClock);
    fn check_invariants(&self) -> Result<(), String>;

    // Provided method
    fn describe_state(&self) -> String { ... }
}
Expand description

Trait for systems that can be property-tested.

TigerStyle: Explicit operation generation and invariant checking.

Required Associated Types§

Source

type Operation: Debug + Clone

The type of operations that can be performed.

Required Methods§

Source

fn generate_operation(&self, rng: &mut DeterministicRng) -> Self::Operation

Generate a random operation based on current state.

The operation should be valid for the current state.

Source

fn apply_operation(&mut self, op: &Self::Operation, clock: &SimClock)

Apply an operation to the state.

May use the clock for time-dependent operations.

Source

fn check_invariants(&self) -> Result<(), String>

Check that all invariants hold.

Returns Ok(()) if all invariants pass, Err(message) otherwise.

Provided Methods§

Source

fn describe_state(&self) -> String

Optional: Describe the current state for debugging.

Implementors§