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

Method test_pool_allocs

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

Allocate a several blocks

Source from the content-addressed store, hash-verified

29
30 // Allocate a several blocks
31 void test_pool_allocs() {
32 MemoryPool pool(1024, 8);
33 validate_pool(pool, 0);
34 void* ptr0 = pool.pool_alloc(128);
35 validate_pool(pool, 128);
36 void* ptr1 = pool.pool_alloc(256);
37 validate_pool(pool, 384);
38 void* ptr2 = pool.pool_alloc(128);
39 validate_pool(pool, 512);
40
41 EXPECT_TRUE(ptr0);
42 EXPECT_TRUE(ptr1);
43 EXPECT_TRUE(ptr2);
44 EXPECT_TRUE(ptr0 > ptr1);
45 EXPECT_TRUE(ptr1 > ptr2);
46 }
47
48 // Test allocating sizes which are not multiples of 8
49 void test_pool_alloc_odd_size() {

Callers 1

TESTFunction · 0.80

Calls 1

pool_allocMethod · 0.80

Tested by

no test coverage detected