Skip to content

Commit bbd9755

Browse files
committed
tests: fix for 32 bit platforms
On 32 bits the tests would fail with an out of bounds error (in the tests).
1 parent 2ec512f commit bbd9755

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

parse_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func GenerateDomain(r *rand.Rand, size int) []byte {
148148
}
149149
lLen := max
150150
if lLen != 0 {
151-
lLen = int(r.Uint32()) % max
151+
lLen = int(r.Int31()) % max
152152
}
153153
done = lLen == 0
154154
if done {
@@ -157,7 +157,7 @@ func GenerateDomain(r *rand.Rand, size int) []byte {
157157
l := make([]byte, lLen+1)
158158
l[0] = byte(lLen)
159159
for j := 0; j < lLen; j++ {
160-
l[j+1] = byte(rand.Uint32())
160+
l[j+1] = byte(rand.Int31())
161161
}
162162
dn = append(dn, l...)
163163
i += 1 + lLen
@@ -205,12 +205,12 @@ func GenerateTXT(r *rand.Rand, size int) []byte {
205205
}
206206
sLen := max
207207
if max != 0 {
208-
sLen = int(r.Uint32()) % max
208+
sLen = int(r.Int31()) % max
209209
}
210210
s := make([]byte, sLen+1)
211211
s[0] = byte(sLen)
212212
for j := 0; j < sLen; j++ {
213-
s[j+1] = byte(rand.Uint32())
213+
s[j+1] = byte(rand.Int31())
214214
}
215215
rd = append(rd, s...)
216216
i += 1 + sLen

0 commit comments

Comments
 (0)