tests: fix for 32 bit platforms

On 32 bits the tests would fail with an out of bounds error (in the
tests).
This commit is contained in:
Miek Gieben 2014-04-10 13:40:37 +00:00
parent 2ec512f89b
commit bbd975571c
1 changed files with 4 additions and 4 deletions

View File

@ -148,7 +148,7 @@ func GenerateDomain(r *rand.Rand, size int) []byte {
} }
lLen := max lLen := max
if lLen != 0 { if lLen != 0 {
lLen = int(r.Uint32()) % max lLen = int(r.Int31()) % max
} }
done = lLen == 0 done = lLen == 0
if done { if done {
@ -157,7 +157,7 @@ func GenerateDomain(r *rand.Rand, size int) []byte {
l := make([]byte, lLen+1) l := make([]byte, lLen+1)
l[0] = byte(lLen) l[0] = byte(lLen)
for j := 0; j < lLen; j++ { for j := 0; j < lLen; j++ {
l[j+1] = byte(rand.Uint32()) l[j+1] = byte(rand.Int31())
} }
dn = append(dn, l...) dn = append(dn, l...)
i += 1 + lLen i += 1 + lLen
@ -205,12 +205,12 @@ func GenerateTXT(r *rand.Rand, size int) []byte {
} }
sLen := max sLen := max
if max != 0 { if max != 0 {
sLen = int(r.Uint32()) % max sLen = int(r.Int31()) % max
} }
s := make([]byte, sLen+1) s := make([]byte, sLen+1)
s[0] = byte(sLen) s[0] = byte(sLen)
for j := 0; j < sLen; j++ { for j := 0; j < sLen; j++ {
s[j+1] = byte(rand.Uint32()) s[j+1] = byte(rand.Int31())
} }
rd = append(rd, s...) rd = append(rd, s...)
i += 1 + sLen i += 1 + sLen