1
0
mirror of https://github.com/golang/go synced 2024-11-23 23:20:08 -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:
Robert Griesemer 2015-08-21 11:30:19 -07:00
parent 9538e4e73b
commit e288271773

View File

@ -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)
} }