Skip to content

Commit 1eb03ce

Browse files
committed
fix tests
1 parent f604156 commit 1eb03ce

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/modules/bulletproofs/tests_impl.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ static void test_bulletproofs_generators_api(void) {
2222

2323
secp256k1_bulletproofs_generators *gens;
2424
secp256k1_bulletproofs_generators *gens_orig;
25-
unsigned char gens_ser[330 - 33];
25+
enum { N_GENS = 10, GENS_SER_SIZE = (N_GENS - 1) * 33 };
26+
unsigned char gens_ser[GENS_SER_SIZE];
2627
size_t len = sizeof(gens_ser);
2728

2829
int32_t ecount = 0;
@@ -31,12 +32,13 @@ static void test_bulletproofs_generators_api(void) {
3132
secp256k1_context_set_illegal_callback(none, counting_illegal_callback_fn, &ecount);
3233

3334
/* Create */
34-
gens = secp256k1_bulletproofs_generators_create(none, 10);
35+
gens = secp256k1_bulletproofs_generators_create(none, N_GENS);
3536
CHECK(gens != NULL && ecount == 0);
3637
gens_orig = gens; /* Preserve for round-trip test */
3738

3839
/* Serialize */
3940
ecount = 0;
41+
CHECK(secp256k1_bulletproofs_generators_serialize(none, gens, gens_ser, &len));
4042
CHECK(!secp256k1_bulletproofs_generators_serialize(none, NULL, gens_ser, &len));
4143
CHECK(ecount == 1);
4244
CHECK(!secp256k1_bulletproofs_generators_serialize(none, gens, NULL, &len));
@@ -50,7 +52,7 @@ static void test_bulletproofs_generators_api(void) {
5052
len = sizeof(gens_ser);
5153
{
5254
/* Output buffer can be greater than minimum needed */
53-
unsigned char gens_ser_tmp[331];
55+
unsigned char gens_ser_tmp[GENS_SER_SIZE + 1];
5456
size_t len_tmp = sizeof(gens_ser_tmp);
5557
CHECK(secp256k1_bulletproofs_generators_serialize(none, gens, gens_ser_tmp, &len_tmp));
5658
CHECK(len_tmp == sizeof(gens_ser_tmp) - 1);

0 commit comments

Comments
 (0)