mirror of
https://github.com/golang/go
synced 2024-11-24 23:07:56 -07:00
crypto/internal/bigmod: fix test
This commit is contained in:
parent
570721ddf5
commit
082ff9ee4e
@ -131,9 +131,12 @@ func TestModulusAndNatSizes(t *testing.T) {
|
||||
// modulus strips leading zeroes and nat does not.
|
||||
m := modulusFromBytes([]byte{
|
||||
0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff})
|
||||
xb := []byte{0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe}
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
})
|
||||
xb := []byte{
|
||||
0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe,
|
||||
}
|
||||
natFromBytes(xb).ExpandFor(m) // must not panic for shrinking
|
||||
NewNat().SetBytes(xb, m)
|
||||
}
|
||||
@ -502,7 +505,7 @@ func TestNatCmp(t *testing.T) {
|
||||
b := new(big.Int).SetInt64(tc[1])
|
||||
na := natFromBytes(a.Bytes())
|
||||
nb := natFromBytes(b.Bytes())
|
||||
if res, _ := na.Cmp(nb); res != int(tc[2]) {
|
||||
if res := na.Cmp(nb); res != int(tc[2]) {
|
||||
t.Errorf("expected %d got %d for (%d).cmp(%d)", tc[2], res, tc[0], tc[1])
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user