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:
parent
2ec512f89b
commit
bbd975571c
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue