pub struct QuickcheckTree<T> { /* private fields */ }Expand description
Adapts quickcheck’s linear shrink iterator to the seam’s ValueTree.
quickcheck has no complicate step: Arbitrary::shrink is a flat iterator
of smaller candidates. This tree maps that onto the simplify/complicate
protocol the runner drives. accepted is the simplest value seen to still
fail; siblings is its remaining shrink candidates; candidate is the one
handed to the runner but not yet judged.
simplify, called again after the runner adopted acandidate, promotes that candidate toacceptedand shrinks it; then it hands out the next sibling. The runner callingsimplifyagain is the signal that the lastcandidatereproduced the failure.complicate, called when acandidatedid not reproduce the failure, discards it and tries the next sibling instead. This is how every candidate inquickcheck’s flat iterator gets a turn.
Trait Implementations§
Source§impl<T> ValueTree<T> for QuickcheckTree<T>where
T: Arbitrary,
impl<T> ValueTree<T> for QuickcheckTree<T>where
T: Arbitrary,
Source§fn simplify(&mut self) -> bool
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
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.Auto Trait Implementations§
impl<T> Freeze for QuickcheckTree<T>where
T: Freeze,
impl<T> !RefUnwindSafe for QuickcheckTree<T>
impl<T> !Send for QuickcheckTree<T>
impl<T> !Sync for QuickcheckTree<T>
impl<T> Unpin for QuickcheckTree<T>where
T: Unpin,
impl<T> UnsafeUnpin for QuickcheckTree<T>where
T: UnsafeUnpin,
impl<T> !UnwindSafe for QuickcheckTree<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more