use efforf instead of fatalf

This commit is contained in:
Sun Yimin 2024-08-23 15:29:36 +08:00 committed by GitHub
parent 223d593817
commit bf891d841e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -47,7 +47,7 @@ func testP256FromMont(v *big.Int, t *testing.T) {
res := new(p256Element) res := new(p256Element)
p256FromMont(res, val) p256FromMont(res, val)
if toBigInt(res).Cmp(v) != 0 { if toBigInt(res).Cmp(v) != 0 {
t.Fatalf("p256FromMont failed for %x", v.Bytes()) t.Errorf("p256FromMont failed for %x", v.Bytes())
} }
} }
@ -66,11 +66,10 @@ func testP256OrderReduce(v, expected *big.Int, t *testing.T) {
fromBig((*[4]uint64)(val), v) fromBig((*[4]uint64)(val), v)
p256OrdReduce(val) p256OrdReduce(val)
if ordElmToBigInt(val).Cmp(expected) != 0 { if ordElmToBigInt(val).Cmp(expected) != 0 {
t.Fatalf("p256OrdReduce failed for %x", v.Bytes()) t.Errorf("p256OrdReduce failed for %x", v.Bytes())
} }
} }
func TestP256OrderReduce(t *testing.T) { func TestP256OrderReduce(t *testing.T) {
p, _ := new(big.Int).SetString("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123", 16) p, _ := new(big.Int).SetString("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123", 16)
for i := 0; i < 20; i++ { for i := 0; i < 20; i++ {