diff options
Diffstat (limited to 'lib/test_bitmap.c')
-rw-r--r-- | lib/test_bitmap.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c index 9734af711816..6889fcc0e1f4 100644 --- a/lib/test_bitmap.c +++ b/lib/test_bitmap.c | |||
@@ -134,6 +134,35 @@ static void __init test_zero_clear(void) | |||
134 | expect_eq_pbl("", bmap, 1024); | 134 | expect_eq_pbl("", bmap, 1024); |
135 | } | 135 | } |
136 | 136 | ||
137 | static void __init test_fill_set(void) | ||
138 | { | ||
139 | DECLARE_BITMAP(bmap, 1024); | ||
140 | |||
141 | /* Known way to clear all bits */ | ||
142 | memset(bmap, 0x00, 128); | ||
143 | |||
144 | expect_eq_pbl("", bmap, 23); | ||
145 | expect_eq_pbl("", bmap, 1024); | ||
146 | |||
147 | /* single-word bitmaps */ | ||
148 | bitmap_set(bmap, 0, 9); | ||
149 | expect_eq_pbl("0-8", bmap, 1024); | ||
150 | |||
151 | bitmap_fill(bmap, 35); | ||
152 | expect_eq_pbl("0-63", bmap, 1024); | ||
153 | |||
154 | /* cross boundaries operations */ | ||
155 | bitmap_set(bmap, 79, 19); | ||
156 | expect_eq_pbl("0-63,79-97", bmap, 1024); | ||
157 | |||
158 | bitmap_fill(bmap, 115); | ||
159 | expect_eq_pbl("0-127", bmap, 1024); | ||
160 | |||
161 | /* Zeroing entire area */ | ||
162 | bitmap_fill(bmap, 1024); | ||
163 | expect_eq_pbl("0-1023", bmap, 1024); | ||
164 | } | ||
165 | |||
137 | static void __init test_zero_fill_copy(void) | 166 | static void __init test_zero_fill_copy(void) |
138 | { | 167 | { |
139 | DECLARE_BITMAP(bmap1, 1024); | 168 | DECLARE_BITMAP(bmap1, 1024); |
@@ -339,6 +368,7 @@ static void noinline __init test_mem_optimisations(void) | |||
339 | static int __init test_bitmap_init(void) | 368 | static int __init test_bitmap_init(void) |
340 | { | 369 | { |
341 | test_zero_clear(); | 370 | test_zero_clear(); |
371 | test_fill_set(); | ||
342 | test_zero_fill_copy(); | 372 | test_zero_fill_copy(); |
343 | test_bitmap_arr32(); | 373 | test_bitmap_arr32(); |
344 | test_bitmap_parselist(); | 374 | test_bitmap_parselist(); |