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