void allocator_ref() { if(count_allocators == 0) { count_allocations = 0; count_constructions = 0; allocated_memory.clear(); } ++count_allocators; }
void allocator_unref() { BOOST_TEST(count_allocators > 0); if(count_allocators > 0) { --count_allocators; if(count_allocators == 0) { bool no_allocations_left = (count_allocations == 0); bool no_constructions_left = (count_constructions == 0); bool allocated_memory_empty = allocated_memory.empty(); // Clearing the data before the checks terminate the tests. count_allocations = 0; count_constructions = 0; allocated_memory.clear(); BOOST_TEST(no_allocations_left); BOOST_TEST(no_constructions_left); BOOST_TEST(allocated_memory_empty); } } }