closes #146
Этот коммит содержится в:
родитель
65e5acf2eb
коммит
cb8e8cae52
2 изменённых файлов: 10 добавлений и 5 удалений
7
flags.go
7
flags.go
|
@ -196,14 +196,13 @@ type randomSeed struct {
|
|||
|
||||
// Choose randomly assigns a convenient pseudo-random seed value.
|
||||
// The resulting seed will be between `1-99999` for later ease of specification.
|
||||
func (rs *randomSeed) choose() {
|
||||
r := rand.New(rand.NewSource(time.Now().UTC().UnixNano()))
|
||||
*rs.ref = r.Int63n(99998) + 1
|
||||
func makeRandomSeed() int64 {
|
||||
return rand.New(rand.NewSource(time.Now().UTC().UnixNano())).Int63n(99998) + 1
|
||||
}
|
||||
|
||||
func (rs *randomSeed) Set(s string) error {
|
||||
if s == "true" {
|
||||
rs.choose()
|
||||
*rs.ref = makeRandomSeed()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
8
run.go
8
run.go
|
@ -145,11 +145,17 @@ func RunWithOptions(suite string, contextInitializer func(suite *Suite), opt Opt
|
|||
return exitOptionError
|
||||
}
|
||||
|
||||
// user may have specified -1 option to create random seed
|
||||
randomize := opt.Randomize
|
||||
if randomize == -1 {
|
||||
randomize = makeRandomSeed()
|
||||
}
|
||||
|
||||
r := runner{
|
||||
fmt: formatter(suite, output),
|
||||
initializer: contextInitializer,
|
||||
features: features,
|
||||
randomSeed: opt.Randomize,
|
||||
randomSeed: randomize,
|
||||
stopOnFailure: opt.StopOnFailure,
|
||||
strict: opt.Strict,
|
||||
}
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче