| 1216 | } |
| 1217 | |
| 1218 | void test_removes() { |
| 1219 | FreeIndex index(largest_free_); |
| 1220 | setup(index, 1024); |
| 1221 | FreeHeader* alloc = free_block(512 + 80); |
| 1222 | FreeHeader* alloc2 = free_block(512 + 180); |
| 1223 | FreeHeader* alloc3 = free_block(512); |
| 1224 | index.add(alloc); |
| 1225 | index.add(alloc2); |
| 1226 | index.add(alloc3); |
| 1227 | EXPECT_TRUE(index.find(512, pool_ptr_) == alloc3); |
| 1228 | list_remove(alloc3); |
| 1229 | index.remove(alloc3, alloc3->larger_free(pool_ptr_)); |
| 1230 | EXPECT_TRUE(index.find(512, pool_ptr_) == alloc); |
| 1231 | list_remove(alloc); |
| 1232 | index.remove(alloc, alloc->larger_free(pool_ptr_)); |
| 1233 | EXPECT_TRUE(index.find(512, pool_ptr_) == alloc2); |
| 1234 | } |
| 1235 | |
| 1236 | // Find should find only alloc |
| 1237 | void test_simple_find() { |