The predictableRandom test can only run once successfully (fixes #1184)
This commit is contained in:
@@ -15,14 +15,21 @@
|
|||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "testing"
|
import (
|
||||||
|
"sync"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
var predictableRandomTest sync.Once
|
||||||
|
|
||||||
func TestPredictableRandom(t *testing.T) {
|
func TestPredictableRandom(t *testing.T) {
|
||||||
|
predictableRandomTest.Do(func() {
|
||||||
// predictable random sequence is predictable
|
// predictable random sequence is predictable
|
||||||
e := 3440579354231278675
|
e := 3440579354231278675
|
||||||
if v := predictableRandom.Int(); v != e {
|
if v := predictableRandom.Int(); v != e {
|
||||||
t.Errorf("Unexpected random value %d != %d", v, e)
|
t.Errorf("Unexpected random value %d != %d", v, e)
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSeedFromBytes(t *testing.T) {
|
func TestSeedFromBytes(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user