From f350002bbbe39b70831aee637da7229546fc145b Mon Sep 17 00:00:00 2001 From: Bodo Junglas Date: Mon, 3 May 2021 10:42:52 +0200 Subject: [PATCH] Keep track of command sieve (issue #81) --- commands/actions.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/commands/actions.go b/commands/actions.go index 1b47f78..28e2ff3 100644 --- a/commands/actions.go +++ b/commands/actions.go @@ -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, @@ -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,