mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 20:40:09 +01:00
util/tests: add set bit range test
This simple test validates that it is possible to set bits across word bounary. Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> Reviewed-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11321>
This commit is contained in:
parent
b3b03e33c9
commit
54ea23da51
1 changed files with 20 additions and 0 deletions
|
|
@ -381,3 +381,23 @@ TEST(bitset, test_shl_two_words)
|
|||
EXPECT_EQ(BITSET_TEST_RANGE(r, 0, 31), false);
|
||||
EXPECT_EQ(BITSET_TEST_RANGE(r, 32, 63), true);
|
||||
}
|
||||
|
||||
TEST(bitset, test_setrange_across_word_boundary)
|
||||
{
|
||||
BITSET_DECLARE(r, 128);
|
||||
BITSET_ZERO(r);
|
||||
|
||||
BITSET_SET_RANGE(r, 62, 65);
|
||||
|
||||
EXPECT_EQ(BITSET_TEST_RANGE(r, 0, 31), false);
|
||||
EXPECT_EQ(BITSET_TEST_RANGE(r, 32, 63), true);
|
||||
EXPECT_EQ(BITSET_TEST_RANGE(r, 64, 95), true);
|
||||
EXPECT_EQ(BITSET_TEST_RANGE(r, 96, 127), false);
|
||||
|
||||
EXPECT_EQ(BITSET_TEST(r, 61), false);
|
||||
|
||||
for (int i = 62; i <= 65; i++)
|
||||
EXPECT_EQ(BITSET_TEST(r, i), true);
|
||||
|
||||
EXPECT_EQ(BITSET_TEST(r, 66), false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue