diff options
Diffstat (limited to 'crypto/openssl/test/priority_queue_test.c')
| -rw-r--r-- | crypto/openssl/test/priority_queue_test.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/crypto/openssl/test/priority_queue_test.c b/crypto/openssl/test/priority_queue_test.c index d8cafc943c43..e90d5b330afc 100644 --- a/crypto/openssl/test/priority_queue_test.c +++ b/crypto/openssl/test/priority_queue_test.c @@ -49,7 +49,7 @@ static void free_checker(ossl_unused size_t *p) } static int test_size_t_priority_queue_int(int reserve, int order, int count, - int remove, int random, int popfree) + int remove, int random, int popfree) { PRIORITY_QUEUE_OF(size_t) *pq = NULL; static size_t values[MAX_SAMPLES], sorted[MAX_SAMPLES], ref[MAX_SAMPLES]; @@ -58,9 +58,9 @@ static int test_size_t_priority_queue_int(int reserve, int order, int count, static const char *orders[3] = { "unordered", "ascending", "descending" }; TEST_info("testing count %d, %s, %s, values %s, remove %d, %sfree", - count, orders[order], reserve ? "reserve" : "grow", - random ? "random" : "deterministic", remove, - popfree ? "pop " : ""); + count, orders[order], reserve ? "reserve" : "grow", + random ? "random" : "deterministic", remove, + popfree ? "pop " : ""); if (!TEST_size_t_le(count, MAX_SAMPLES)) return 0; @@ -80,7 +80,7 @@ static int test_size_t_priority_queue_int(int reserve, int order, int count, qsort(values, count, sizeof(*values), &qsort_size_t_compare_rev); if (!TEST_ptr(pq = ossl_pqueue_size_t_new(&size_t_compare)) - || !TEST_size_t_eq(ossl_pqueue_size_t_num(pq), 0)) + || !TEST_size_t_eq(ossl_pqueue_size_t_num(pq), 0)) goto err; if (reserve && !TEST_true(ossl_pqueue_size_t_reserve(pq, count))) @@ -91,7 +91,7 @@ static int test_size_t_priority_queue_int(int reserve, int order, int count, goto err; if (!TEST_size_t_eq(*ossl_pqueue_size_t_peek(pq), *sorted) - || !TEST_size_t_eq(ossl_pqueue_size_t_num(pq), count)) + || !TEST_size_t_eq(ossl_pqueue_size_t_num(pq), count)) goto err; if (remove) { @@ -99,7 +99,7 @@ static int test_size_t_priority_queue_int(int reserve, int order, int count, i = test_random() % count; if (values[i] != SIZE_MAX) { if (!TEST_ptr_eq(ossl_pqueue_size_t_remove(pq, ref[i]), - values + i)) + values + i)) goto err; values[i] = SIZE_MAX; } @@ -109,8 +109,8 @@ static int test_size_t_priority_queue_int(int reserve, int order, int count, } for (i = 0; ossl_pqueue_size_t_peek(pq) != NULL; i++) if (!TEST_size_t_eq(*ossl_pqueue_size_t_peek(pq), sorted[i]) - || !TEST_size_t_eq(*ossl_pqueue_size_t_pop(pq), sorted[i])) - goto err; + || !TEST_size_t_eq(*ossl_pqueue_size_t_pop(pq), sorted[i])) + goto err; if (popfree) { num_rec_freed = 0; @@ -121,7 +121,7 @@ static int test_size_t_priority_queue_int(int reserve, int order, int count, goto err; } res = 1; - err: +err: ossl_pqueue_size_t_free(pq); return res; } @@ -148,18 +148,18 @@ static int test_size_t_priority_queue(int n) count = test_size_t_priority_counts[count]; return test_size_t_priority_queue_int(reserve, order, count, remove, - random, popfree); + random, popfree); } static int test_large_priority_queue(void) { return test_size_t_priority_queue_int(0, 0, MAX_SAMPLES, MAX_SAMPLES / 100, - 1, 1); + 1, 1); } typedef struct info_st { uint64_t seq_num, sub_seq; - size_t idx; + size_t idx; } INFO; DEFINE_PRIORITY_QUEUE_OF(INFO); @@ -190,57 +190,57 @@ static int test_22644(void) infos[0].seq_num = 70650219160667140; if (!TEST_true(ossl_pqueue_INFO_push(pq, &infos[0], &infos[0].idx)) - || !TEST_size_t_eq(infos[0].idx, 7) - || !TEST_ptr(ossl_pqueue_INFO_remove(pq, infos[0].idx))) + || !TEST_size_t_eq(infos[0].idx, 7) + || !TEST_ptr(ossl_pqueue_INFO_remove(pq, infos[0].idx))) goto err; infos[1].seq_num = 289360691352306692; if (!TEST_true(ossl_pqueue_INFO_push(pq, &infos[1], &infos[1].idx)) - || !TEST_size_t_eq(infos[1].idx, 7) - || !TEST_ptr(ossl_pqueue_INFO_remove(pq, infos[1].idx))) + || !TEST_size_t_eq(infos[1].idx, 7) + || !TEST_ptr(ossl_pqueue_INFO_remove(pq, infos[1].idx))) goto err; - + infos[2].seq_num = 289360691352306692; if (!TEST_true(ossl_pqueue_INFO_push(pq, &infos[2], &infos[2].idx)) - || !TEST_size_t_eq(infos[2].idx, 7)) + || !TEST_size_t_eq(infos[2].idx, 7)) goto err; infos[3].seq_num = 289360691352306692; if (!TEST_true(ossl_pqueue_INFO_push(pq, &infos[3], &infos[3].idx)) - || !TEST_size_t_eq(infos[3].idx, 6)) + || !TEST_size_t_eq(infos[3].idx, 6)) goto err; infos[4].seq_num = 289360691352306692; if (!TEST_true(ossl_pqueue_INFO_push(pq, &infos[4], &infos[4].idx)) - || !TEST_size_t_eq(infos[4].idx, 5)) + || !TEST_size_t_eq(infos[4].idx, 5)) goto err; infos[5].seq_num = 289360691352306692; if (!TEST_true(ossl_pqueue_INFO_push(pq, &infos[5], &infos[5].idx)) - || !TEST_size_t_eq(infos[5].idx, 4)) + || !TEST_size_t_eq(infos[5].idx, 4)) goto err; infos[6].seq_num = 289360691352306692; if (!TEST_true(ossl_pqueue_INFO_push(pq, &infos[6], &infos[6].idx)) - || !TEST_size_t_eq(infos[6].idx, 3)) + || !TEST_size_t_eq(infos[6].idx, 3)) goto err; infos[7].seq_num = 289360691352306692; if (!TEST_true(ossl_pqueue_INFO_push(pq, &infos[7], &infos[7].idx)) - || !TEST_size_t_eq(infos[7].idx, 2)) + || !TEST_size_t_eq(infos[7].idx, 2)) goto err; infos[8].seq_num = 289360691352306692; if (!TEST_true(ossl_pqueue_INFO_push(pq, &infos[8], &infos[8].idx)) - || !TEST_size_t_eq(infos[8].idx, 1)) + || !TEST_size_t_eq(infos[8].idx, 1)) goto err; if (!TEST_ptr(ossl_pqueue_INFO_pop(pq)) - || !TEST_ptr(ossl_pqueue_INFO_pop(pq))) /* crash if bug present */ + || !TEST_ptr(ossl_pqueue_INFO_pop(pq))) /* crash if bug present */ goto err; res = 1; - err: +err: ossl_pqueue_INFO_free(pq); return res; } @@ -248,12 +248,12 @@ static int test_22644(void) int setup_tests(void) { ADD_ALL_TESTS(test_size_t_priority_queue, - OSSL_NELEM(test_size_t_priority_counts) /* count */ - * 3 /* order */ - * 2 /* random */ - * 2 /* reserve */ - * 6 /* remove */ - * 2); /* pop & free */ + OSSL_NELEM(test_size_t_priority_counts) /* count */ + * 3 /* order */ + * 2 /* random */ + * 2 /* reserve */ + * 6 /* remove */ + * 2); /* pop & free */ ADD_TEST(test_large_priority_queue); ADD_TEST(test_22644); return 1; |
