Skip to content

Commit

Permalink
Keep track of command sieve (issue #81)
Browse files Browse the repository at this point in the history
  • Loading branch information
untoldwind committed May 3, 2021
1 parent e9fde4d commit f350002
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions commands/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ import (
)

type shrinkableCommand struct {
command Command
shrinker gopter.Shrinker
command Command
commandSieve func(v interface{}) bool
shrinker gopter.Shrinker
}

func (s shrinkableCommand) shrink() gopter.Shrink {
return s.shrinker(s.command).Map(func(command Command) shrinkableCommand {
return s.shrinker(s.command).Filter(s.commandSieve).Map(func(command Command) shrinkableCommand {
return shrinkableCommand{
command: command,
shrinker: s.shrinker,
Expand Down Expand Up @@ -126,8 +127,9 @@ func genSizedCommands(commands Commands, initialStateProvider func() State) gopt
sizedCommands{
state: command.NextState(prev.state),
commands: append(prev.commands, shrinkableCommand{
command: command,
shrinker: result.Shrinker,
command: command,
commandSieve: result.Sieve,
shrinker: result.Shrinker,
}),
},
gopter.NoShrinker,
Expand Down

0 comments on commit f350002

Please sign in to comment.