From b535843bb7cf59b43197e91e8221ecab2a39d779 Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Thu, 19 Oct 2023 08:46:58 +0000 Subject: [PATCH] Fix an error in the qp_test.c unit test In order to check whether there are enough inserted values the code uses the 'tests' variable (loop counter), which is unreliable, because the loop sometimes removes an item instead of inserting one (when the randomly generated item already exists). Instead of the loop counter, use the existing variable 'inserted', which should indicate the correct number of the inserted items. --- tests/dns/qp_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/dns/qp_test.c b/tests/dns/qp_test.c index f15022618f..39c9b688b5 100644 --- a/tests/dns/qp_test.c +++ b/tests/dns/qp_test.c @@ -271,7 +271,7 @@ ISC_RUN_TEST_IMPL(qpiter) { * forward a few steps, then back to the start, * to confirm we can change directions while iterating. */ - if (tests > 3) { + if (inserted > 3) { assert_int_equal( dns_qpiter_next(&qpi, NULL, NULL, &ival), ISC_R_SUCCESS);