Function suppositions::data::minimize [] [src]

pub fn minimize<F: Fn(InfoReplay) -> bool>(
    p: &InfoPool,
    pred: &F
) -> Option<InfoPool>

Try to find the smallest pool p such that the predicate pred returns true. Given that our generators tend to generate smaller outputs from smaller inputs, by minimizing the source pool we can find the smallest value that provokes a failure.

If we do not find any smaller pool that satisifies pred; we return None.

Currently, we have two heuristics for shrinking: removing slices, and reducing individual values.

Removing slices tries to remove as much of the pool as it can whilst still having the predicate hold. At present, we do this by removing each half and testing, then each quarter, eighths, and so on. Eventually, we plan to track the regions of data that each generator draws from, and use that to optimise the shrinking process.

Reducing individual values basically goes through each position in the pool, and then tries reducing it to zero, then half, thn three quarters, seven eighths, and so on.