Skip to content

Commit dcf3920

Browse files
committed
Fix ability to compile tests without -DVERIFY.
Broken by 3f3964e. It's important that the tests are also run without -DVERIFY due to the possibility that side-effects of a VERIFY_CHECK fix a bug that would otherwise be detected. Use of the verify_check macro in tests isn't sufficient.
1 parent a484e00 commit dcf3920

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/tests.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ void random_field_element_magnitude(secp256k1_fe *fe) {
8383
secp256k1_fe_negate(&zero, &zero, 0);
8484
secp256k1_fe_mul_int(&zero, n - 1);
8585
secp256k1_fe_add(fe, &zero);
86-
VERIFY_CHECK(fe->magnitude == n);
86+
#ifdef VERIFY
87+
CHECK(fe->magnitude == n);
88+
#endif
8789
}
8890

8991
void random_group_element_test(secp256k1_ge *ge) {
@@ -1786,24 +1788,32 @@ void run_field_misc(void) {
17861788
/* Test fe conditional move; z is not normalized here. */
17871789
q = x;
17881790
secp256k1_fe_cmov(&x, &z, 0);
1789-
VERIFY_CHECK(!x.normalized && x.magnitude == z.magnitude);
1791+
#ifdef VERIFY
1792+
CHECK(!x.normalized && x.magnitude == z.magnitude);
1793+
#endif
17901794
secp256k1_fe_cmov(&x, &x, 1);
17911795
CHECK(fe_memcmp(&x, &z) != 0);
17921796
CHECK(fe_memcmp(&x, &q) == 0);
17931797
secp256k1_fe_cmov(&q, &z, 1);
1794-
VERIFY_CHECK(!q.normalized && q.magnitude == z.magnitude);
1798+
#ifdef VERIFY
1799+
CHECK(!q.normalized && q.magnitude == z.magnitude);
1800+
#endif
17951801
CHECK(fe_memcmp(&q, &z) == 0);
17961802
secp256k1_fe_normalize_var(&x);
17971803
secp256k1_fe_normalize_var(&z);
17981804
CHECK(!secp256k1_fe_equal_var(&x, &z));
17991805
secp256k1_fe_normalize_var(&q);
18001806
secp256k1_fe_cmov(&q, &z, (i&1));
1801-
VERIFY_CHECK(q.normalized && q.magnitude == 1);
1807+
#ifdef VERIFY
1808+
CHECK(q.normalized && q.magnitude == 1);
1809+
#endif
18021810
for (j = 0; j < 6; j++) {
18031811
secp256k1_fe_negate(&z, &z, j+1);
18041812
secp256k1_fe_normalize_var(&q);
18051813
secp256k1_fe_cmov(&q, &z, (j&1));
1806-
VERIFY_CHECK(!q.normalized && q.magnitude == (j+2));
1814+
#ifdef VERIFY
1815+
CHECK(!q.normalized && q.magnitude == (j+2));
1816+
#endif
18071817
}
18081818
secp256k1_fe_normalize_var(&z);
18091819
/* Test storage conversion and conditional moves. */

0 commit comments

Comments
 (0)