Skip to content
This repository was archived by the owner on Jun 18, 2021. It is now read-only.
This repository was archived by the owner on Jun 18, 2021. It is now read-only.

shrinking optimizations #321

Description

@kderme

I'm working on a pr which tries to capture information from the execution of a list of Commands, in order to make shrinking faster. Note that QuickCheck does not support this very well, so it is a bit experimental. It is based on 2 ideas:

  • if the execution failed on the n-th command of the list, we should first try to shrink the prefix up to the nth command.
  • if the execution failed on the n-th command of the list, there is no reason to test a prefix smaller than n.

Using these ideas the shrink list can be pruned. I have implemented the first part for the non-monadic case and I think the second is also easy to implement. However implementing the monadic case seems tricky.

For some examples which support this idea: Say we have a list of commands [1..20] and execution fails on the 8th command. The shrinker should try to shrink [1..8]. Also
shrinkListS' [1,2,3,4,5,6,7,8] returns

[Shrunk {wasShrunk = True, shrunk = []},Shrunk {wasShrunk = True, shrunk = [5,6,7,8]},Shrunk
 {wasShrunk = True, shrunk = [1,2,3,4]},Shrunk {wasShrunk = True, shrunk = 
[3,4,5,6,7,8]},Shrunk {wasShrunk = True, shrunk = [1,2,5,6,7,8]},Shrunk {wasShrunk = True, 
shrunk = [1,2,3,4,7,8]},Shrunk {wasShrunk = True, shrunk = [1,2,3,4,5,6]},Shrunk {wasShrunk = 
True, shrunk = [2,3,4,5,6,7,8]},Shrunk {wasShrunk = True, shrunk = [1,3,4,5,6,7,8]},Shrunk 
{wasShrunk = True, shrunk = [1,2,4,5,6,7,8]},Shrunk {wasShrunk = True, shrunk = 
[1,2,3,5,6,7,8]},Shrunk {wasShrunk = True, shrunk = [1,2,3,4,6,7,8]},Shrunk {wasShrunk = True, 
shrunk = [1,2,3,4,5,7,8]},Shrunk {wasShrunk = True, shrunk = [1,2,3,4,5,6,8]},Shrunk {wasShrunk 
= True, shrunk = [1,2,3,4,5,6,7]},Shrunk {wasShrunk = False, shrunk = [1,2,3,4,5,6,7,8]}]

All prefixes, like [1,2,3,4], [1,2,3,4,5,6], [1,2,3,4,5,6,7] can be safely pruned.

Thoughts on this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions