Skip to content

Commit 54b24b9

Browse files
committed
bitstring_test: fix bit_nclear/bit_nset tests for last iteration
Also convert nearby ATF_REQUIRE_MSG to ATF_REQUIRE_INTEQ_MSG. Reported by: GCC -Wint-in-bool-context Reviewed by: asomers, des Differential Revision: https://reviews.freebsd.org/D45893
1 parent c67ea27 commit 54b24b9

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

tests/sys/sys/bitstring_test.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -559,14 +559,13 @@ BITSTRING_TC_DEFINE(bit_nclear)
559559
bit_nclear(bitstr, i, j);
560560

561561
bit_ffc(bitstr, nbits, &found_clear_bit);
562-
ATF_REQUIRE_MSG(
563-
found_clear_bit == i,
562+
ATF_REQUIRE_INTEQ_MSG(i, found_clear_bit,
564563
"bit_nclear_%d_%d_%d%s: Failed with result %d",
565564
nbits, i, j, memloc, found_clear_bit);
566565

567566
bit_ffs_at(bitstr, i, nbits, &found_set_bit);
568-
ATF_REQUIRE_MSG(
569-
(j + 1 < nbits) ? found_set_bit == j + 1 : -1,
567+
ATF_REQUIRE_INTEQ_MSG((j + 1 < nbits) ? j + 1 : -1,
568+
found_set_bit,
570569
"bit_nset_%d_%d_%d%s: Failed with result %d",
571570
nbits, i, j, memloc, found_set_bit);
572571
}
@@ -586,14 +585,13 @@ BITSTRING_TC_DEFINE(bit_nset)
586585
bit_nset(bitstr, i, j);
587586

588587
bit_ffs(bitstr, nbits, &found_set_bit);
589-
ATF_REQUIRE_MSG(
590-
found_set_bit == i,
588+
ATF_REQUIRE_INTEQ_MSG(i, found_set_bit,
591589
"bit_nset_%d_%d_%d%s: Failed with result %d",
592590
nbits, i, j, memloc, found_set_bit);
593591

594592
bit_ffc_at(bitstr, i, nbits, &found_clear_bit);
595-
ATF_REQUIRE_MSG(
596-
(j + 1 < nbits) ? found_clear_bit == j + 1 : -1,
593+
ATF_REQUIRE_INTEQ_MSG((j + 1 < nbits) ? j + 1 : -1,
594+
found_clear_bit,
597595
"bit_nset_%d_%d_%d%s: Failed with result %d",
598596
nbits, i, j, memloc, found_clear_bit);
599597
}

0 commit comments

Comments
 (0)