Skip to content

Commit

Permalink
tests: add checks for scalar constants secp256k1_scalar_{zero,one}
Browse files Browse the repository at this point in the history
  • Loading branch information
theStack committed May 30, 2023
1 parent 654246c commit ade5b36
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/tests.c
Expand Up @@ -2351,6 +2351,20 @@ static void run_scalar_tests(void) {
run_scalar_set_b32_seckey_tests();
}

{
/* Check that the scalar constants secp256k1_scalar_zero and
secp256k1_scalar_one contain the expected values. */
secp256k1_scalar zero, one;

CHECK(secp256k1_scalar_is_zero(&secp256k1_scalar_zero));
secp256k1_scalar_set_int(&zero, 0);
CHECK(secp256k1_scalar_eq(&zero, &secp256k1_scalar_zero));

CHECK(secp256k1_scalar_is_one(&secp256k1_scalar_one));
secp256k1_scalar_set_int(&one, 1);
CHECK(secp256k1_scalar_eq(&one, &secp256k1_scalar_one));
}

{
/* (-1)+1 should be zero. */
secp256k1_scalar o;
Expand Down

0 comments on commit ade5b36

Please sign in to comment.