Random number is too large for 32 bit archs (fixes #1894)

This commit is contained in:
Jakob Borg 2015-06-01 09:33:08 +02:00
parent 36d4c69fd6
commit c23a601cc6

View File

@ -7,6 +7,7 @@
package main
import (
"runtime"
"sync"
"testing"
)
@ -14,10 +15,13 @@ import (
var predictableRandomTest sync.Once
func TestPredictableRandom(t *testing.T) {
if runtime.GOARCH != "amd64" {
t.Skip("Test only for 64 bit platforms; but if it works there, it should work on 32 bit")
}
predictableRandomTest.Do(func() {
// predictable random sequence is predictable
e := 3440579354231278675
if v := predictableRandom.Int(); v != e {
e := int64(3440579354231278675)
if v := int64(predictableRandom.Int()); v != e {
t.Errorf("Unexpected random value %d != %d", v, e)
}
})