Skip to content

Commit

Permalink
Add some edge case tests for addition and multiplication
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrtj committed Sep 17, 2024
1 parent a08d65b commit de81b0d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions t/edge-cases.t
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit de81b0d

Please sign in to comment.