MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / test_removes

Method test_removes

tests/unit-tests/dds/DCPS/MemoryPool.cpp:1218–1234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1216}
1217
1218void 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
1237void test_simple_find() {

Callers 1

TESTFunction · 0.80

Calls 5

larger_freeMethod · 0.80
setupFunction · 0.50
addMethod · 0.45
findMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected