5 #include <gtest/gtest.h>
14 TEST(HeapBasedPoolAllocator, Basic)
17 std::cout <<
">>> HEAP BEFORE:" << std::endl;
71 std::cout <<
">>> HEAP AFTER:" << std::endl;
77 TEST(HeapBasedPoolAllocator, Limits)
111 #if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
124 TEST(HeapBasedPoolAllocator, Concurrency)
127 std::cout <<
">>> HEAP BEFORE:" << std::endl;
136 volatile bool terminate =
false;
141 std::thread threads[3];
143 for (
auto&
x : threads)
145 x = std::thread([&al, &terminate]()
163 std::this_thread::sleep_for(std::chrono::seconds(1));
166 std::cout <<
"Terminating workers..." << std::endl;
168 for (
auto&
x : threads)
172 std::cout <<
"All workers joined" << std::endl;
181 std::cout <<
">>> HEAP BEFORE SHRINK:" << std::endl;
188 std::cout <<
">>> HEAP AFTER SHRINK:" << std::endl;