1package gopter 2 3import ( 4 "math/rand" 5 "time" 6) 7 8// TestParameters to run property tests 9type TestParameters struct { 10 MinSuccessfulTests int 11 // MinSize is an (inclusive) lower limit on the size of the parameters 12 MinSize int 13 // MaxSize is an (exclusive) upper limit on the size of the parameters 14 MaxSize int 15 MaxShrinkCount int 16 Seed int64 17 Rng *rand.Rand 18 Workers int 19 MaxDiscardRatio float64 20} 21 22// DefaultTestParameterWithSeeds creates reasonable default Parameters for most cases based on a fixed RNG-seed 23func DefaultTestParametersWithSeed(seed int64) *TestParameters { 24 return &TestParameters{ 25 MinSuccessfulTests: 100, 26 MinSize: 0, 27 MaxSize: 100, 28 MaxShrinkCount: 1000, 29 Seed: seed, 30 Rng: rand.New(NewLockedSource(seed)), 31 Workers: 1, 32 MaxDiscardRatio: 5, 33 } 34} 35 36// DefaultTestParameterWithSeeds creates reasonable default Parameters for most cases with an undefined RNG-seed 37func DefaultTestParameters() *TestParameters { 38 return DefaultTestParametersWithSeed(time.Now().UnixNano()) 39} 40