Skip to main content

shrink_sequence_by_removing

Function shrink_sequence_by_removing 

Source
pub fn shrink_sequence_by_removing<P, S, A>(
    calls_len: usize,
    run: &mut ShrinkRun,
    drop_blocks: bool,
    should_stop: S,
    on_attempt: A,
    predicate: P,
) -> SequenceShrink
where P: FnMut(&SequenceShrink) -> Option<bool>, S: FnMut() -> bool, A: FnMut(),
Expand description

Shared sequence shrinker. Tries to drop each call; predicate decides whether the candidate should be accepted, rejected, or skipped without spending a replay attempt.

With drop_blocks, first tries to drop blocks of kept calls, halving the block size down to two calls, then drops single calls. Stops when every kept call was tried once since the last accepted removal: the sequence is then a fixpoint and further passes would replay the same rejected candidates.