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
This commit is contained in:
Ryan Libby
2025-10-02 09:40:16 -07:00
parent c67ea2707d
commit 54b24b9da8
+6 -8
View File
@@ -559,14 +559,13 @@ BITSTRING_TC_DEFINE(bit_nclear)
bit_nclear(bitstr, i, j);
bit_ffc(bitstr, nbits, &found_clear_bit);
ATF_REQUIRE_MSG(
found_clear_bit == i,
ATF_REQUIRE_INTEQ_MSG(i, found_clear_bit,
"bit_nclear_%d_%d_%d%s: Failed with result %d",
nbits, i, j, memloc, found_clear_bit);
bit_ffs_at(bitstr, i, nbits, &found_set_bit);
ATF_REQUIRE_MSG(
(j + 1 < nbits) ? found_set_bit == j + 1 : -1,
ATF_REQUIRE_INTEQ_MSG((j + 1 < nbits) ? j + 1 : -1,
found_set_bit,
"bit_nset_%d_%d_%d%s: Failed with result %d",
nbits, i, j, memloc, found_set_bit);
}
@@ -586,14 +585,13 @@ BITSTRING_TC_DEFINE(bit_nset)
bit_nset(bitstr, i, j);
bit_ffs(bitstr, nbits, &found_set_bit);
ATF_REQUIRE_MSG(
found_set_bit == i,
ATF_REQUIRE_INTEQ_MSG(i, found_set_bit,
"bit_nset_%d_%d_%d%s: Failed with result %d",
nbits, i, j, memloc, found_set_bit);
bit_ffc_at(bitstr, i, nbits, &found_clear_bit);
ATF_REQUIRE_MSG(
(j + 1 < nbits) ? found_clear_bit == j + 1 : -1,
ATF_REQUIRE_INTEQ_MSG((j + 1 < nbits) ? j + 1 : -1,
found_clear_bit,
"bit_nset_%d_%d_%d%s: Failed with result %d",
nbits, i, j, memloc, found_clear_bit);
}