From 082ff9ee4e1db553d80829c7a2987a05e47ced4f Mon Sep 17 00:00:00 2001 From: Derek Parker Date: Mon, 11 Nov 2024 13:33:22 -0800 Subject: [PATCH] crypto/internal/bigmod: fix test --- src/crypto/internal/bigmod/nat_test.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/crypto/internal/bigmod/nat_test.go b/src/crypto/internal/bigmod/nat_test.go index d3ac157762d..de058d26852 100644 --- a/src/crypto/internal/bigmod/nat_test.go +++ b/src/crypto/internal/bigmod/nat_test.go @@ -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]) } }