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.
This commit is contained in:
Aram Sargsyan
2023-10-19 08:46:58 +00:00
parent 671e524aef
commit b535843bb7

View File

@@ -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);