Commit e2882717 authored by Robert Griesemer's avatar Robert Griesemer

math/big: fix TestBytes test

Fixes #12231.

Change-Id: I1f07c444623cd864667e21b2fee534eacdc193bb
Reviewed-on: https://go-review.googlesource.com/13814Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 9538e4e7
......@@ -387,6 +387,11 @@ func TestSetBytes(t *testing.T) {
}
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()
return bytes.Equal(b, b2)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment