aboutsummaryrefslogtreecommitdiff
path: root/tests/test-bitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-bitmap.c')
-rw-r--r--tests/test-bitmap.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test-bitmap.c b/tests/test-bitmap.c
index 18aa584591..087e02a26c 100644
--- a/tests/test-bitmap.c
+++ b/tests/test-bitmap.c
@@ -67,6 +67,18 @@ static void bitmap_set_case(bmap_set_func set_func)
bmap = bitmap_new(BMAP_SIZE);
+ /* Set one bit at offset in second word */
+ for (offset = 0; offset <= BITS_PER_LONG; offset++) {
+ bitmap_clear(bmap, 0, BMAP_SIZE);
+ set_func(bmap, BITS_PER_LONG + offset, 1);
+ g_assert_cmpint(find_first_bit(bmap, 2 * BITS_PER_LONG),
+ ==, BITS_PER_LONG + offset);
+ g_assert_cmpint(find_next_zero_bit(bmap,
+ 3 * BITS_PER_LONG,
+ BITS_PER_LONG + offset),
+ ==, BITS_PER_LONG + offset + 1);
+ }
+
/* Both Aligned, set bits [BITS_PER_LONG, 3*BITS_PER_LONG] */
set_func(bmap, BITS_PER_LONG, 2 * BITS_PER_LONG);
g_assert_cmpuint(bmap[1], ==, -1ul);