Skip to main content

ValueTree

Trait ValueTree 

Source
pub trait ValueTree<T> {
    // Required methods
    fn current(&self) -> T;
    fn simplify(&mut self) -> bool;
    fn complicate(&mut self) -> bool;
}
Expand description

A single generated value that can be shrunk toward a simpler one.

After a failing case the runner calls simplify to get a smaller candidate; if a candidate shrank so far it stopped failing, the runner calls complicate to walk back. Together they binary-search toward a minimal counterexample.

Required Methods§

Source

fn current(&self) -> T

The current value.

Source

fn simplify(&mut self) -> bool

Replaces the current value with a simpler one. Returns true if it moved, false if the value is already as simple as the tree can make it.

Source

fn complicate(&mut self) -> bool

Walks back toward the last value that still failed, undoing a simplify that shrank past the failure. Returns true if it moved.

Implementors§

Source§

impl<T> ValueTree<T> for QuickcheckTree<T>
where T: Arbitrary,

Source§

impl<VT, T> ValueTree<T> for ProptestTree<VT>
where VT: ValueTree<Value = T>,