MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_bitmap_set_get_clear

Function test_bitmap_set_get_clear

dpdk/app/test/test_bitmap.c:133–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133static int
134test_bitmap_set_get_clear(struct rte_bitmap *bmp)
135{
136 uint64_t val;
137 int i;
138
139 rte_bitmap_reset(bmp);
140 for (i = 0; i < MAX_BITS; i++)
141 rte_bitmap_set(bmp, i);
142
143 for (i = 0; i < MAX_BITS; i++) {
144 if (!rte_bitmap_get(bmp, i)) {
145 printf("Failed to get set bit.\n");
146 return TEST_FAILED;
147 }
148 }
149
150 for (i = 0; i < MAX_BITS; i++)
151 rte_bitmap_clear(bmp, i);
152
153 for (i = 0; i < MAX_BITS; i++) {
154 if (rte_bitmap_get(bmp, i)) {
155 printf("Failed to clear set bit.\n");
156 return TEST_FAILED;
157 }
158 }
159
160 rte_bitmap_reset(bmp);
161
162 /* Alternate slab set test */
163 for (i = 0; i < MAX_BITS; i++) {
164 if (i % RTE_BITMAP_SLAB_BIT_SIZE)
165 rte_bitmap_set(bmp, i);
166 }
167
168 for (i = 0; i < MAX_BITS; i++) {
169 val = rte_bitmap_get(bmp, i);
170 if (((i % RTE_BITMAP_SLAB_BIT_SIZE) && !val) ||
171 (!(i % RTE_BITMAP_SLAB_BIT_SIZE) && val)) {
172 printf("Failed to get set bit.\n");
173 return TEST_FAILED;
174 }
175 }
176
177 return TEST_SUCCESS;
178}
179
180static int
181test_bitmap_all_clear(void)

Callers 1

test_bitmap_all_clearFunction · 0.85

Calls 5

rte_bitmap_resetFunction · 0.85
rte_bitmap_setFunction · 0.85
rte_bitmap_getFunction · 0.85
rte_bitmap_clearFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected