From de81b0d3ec204e330f6ad45cf1d6abc45387bc5b Mon Sep 17 00:00:00 2001 From: bbrtj Date: Tue, 17 Sep 2024 16:52:25 +0200 Subject: [PATCH] Add some edge case tests for addition and multiplication --- t/edge-cases.t | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/t/edge-cases.t b/t/edge-cases.t index 9d20ea6..cb3628f 100644 --- a/t/edge-cases.t +++ b/t/edge-cases.t @@ -56,5 +56,16 @@ subtest 'should die with invalid digest' => sub { like $ex, qr/requires a 32-byte message hash/, 'exception ok'; }; +subtest 'should die on invalid addition' => sub { + my $negated = $secp->negate_private_key($t{privkey}); + my $ex = dies { $secp->add_private_key($t{privkey}, $negated) }; + like $ex, qr/resulting added privkey is not valid/, 'exception ok'; +}; + +subtest 'should die on invalid multiplication' => sub { + my $ex = dies { $secp->multiply_public_key($t{pubkey}, "\xff" x 32) }; + like $ex, qr/multiplication arguments are not valid/, 'exception ok'; +}; + done_testing;