mirror of
https://github.com/golang/go
synced 2024-11-23 23:40:13 -07:00
math/big: fix TestBytes test
Fixes #12231. Change-Id: I1f07c444623cd864667e21b2fee534eacdc193bb Reviewed-on: https://go-review.googlesource.com/13814 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
9538e4e73b
commit
e288271773
@ -387,6 +387,11 @@ func TestSetBytes(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func checkBytes(b []byte) bool {
|
func checkBytes(b []byte) bool {
|
||||||
|
// trim leading zero bytes since Bytes() won't return them
|
||||||
|
// (was issue 12231)
|
||||||
|
for len(b) > 0 && b[0] == 0 {
|
||||||
|
b = b[1:]
|
||||||
|
}
|
||||||
b2 := new(Int).SetBytes(b).Bytes()
|
b2 := new(Int).SetBytes(b).Bytes()
|
||||||
return bytes.Equal(b, b2)
|
return bytes.Equal(b, b2)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user