Skip to content

Commit

Permalink
Make Run() execute a variable number of actions
Browse files Browse the repository at this point in the history
  • Loading branch information
flyingmutant committed Jun 10, 2023
1 parent b23ed95 commit e0500eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type cmdline struct {

func init() {
flag.IntVar(&flags.checks, "rapid.checks", 100, "rapid: number of checks to perform")
flag.IntVar(&flags.steps, "rapid.steps", 100, "rapid: number of state machine steps to perform")
flag.IntVar(&flags.steps, "rapid.steps", 30, "rapid: average number of Run actions to execute")
flag.StringVar(&flags.failfile, "rapid.failfile", "", "rapid: fail file to use to reproduce test failure")
flag.BoolVar(&flags.nofailfile, "rapid.nofailfile", false, "rapid: do not write fail files on test failures")
flag.Uint64Var(&flags.seed, "rapid.seed", 0, "rapid: PRNG seed to start with (0 to use a random one)")
Expand Down
5 changes: 2 additions & 3 deletions statemachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package rapid

import (
"math"
"reflect"
"sort"
"testing"
Expand Down Expand Up @@ -46,10 +45,10 @@ func (t *T) Run(actions map[string]func(*T)) {

steps := flags.steps
if testing.Short() {
steps /= 5
steps /= 2
}

repeat := newRepeat(0, steps, math.MaxInt, "Run")
repeat := newRepeat(-1, -1, float64(steps), "Run")
sm := stateMachine{
check: check,
actionKeys: SampledFrom(actionKeys),
Expand Down

0 comments on commit e0500eb

Please sign in to comment.