Add test for secp256k1_fe_half

This commit is contained in:
Pieter Wuille 2021-12-21 20:39:55 -05:00 committed by Peter Dettman
parent 925f78d55e
commit 9cc5c257ed
1 changed files with 8 additions and 0 deletions

View File

@ -2548,6 +2548,14 @@ void run_field_misc(void) {
secp256k1_fe_add(&q, &x);
CHECK(check_fe_equal(&y, &z));
CHECK(check_fe_equal(&q, &y));
/* Check secp256k1_fe_half. */
z = x;
secp256k1_fe_half(&z);
secp256k1_fe_add(&z, &z);
CHECK(check_fe_equal(&x, &z));
secp256k1_fe_add(&z, &z);
secp256k1_fe_half(&z);
CHECK(check_fe_equal(&x, &z));
}
}