This commit is contained in:
Siarhei Fedartsou
2024-07-10 22:01:25 +02:00
parent 1037256a30
commit 6f04aa9587
2 changed files with 73 additions and 50 deletions
+15
View File
@@ -57,6 +57,21 @@ BOOST_AUTO_TEST_CASE(copy)
pool2.deallocate(ptr, 1);
}
BOOST_AUTO_TEST_CASE(move)
{
PoolAllocator<int> pool;
auto ptr = pool.allocate(1);
*ptr = 42;
BOOST_CHECK_NE(ptr, nullptr);
pool.deallocate(ptr, 1);
PoolAllocator<int> pool2(std::move(pool));
ptr = pool2.allocate(1);
*ptr = 42;
BOOST_CHECK_NE(ptr, nullptr);
pool2.deallocate(ptr, 1);
}
BOOST_AUTO_TEST_CASE(unordered_map)
{
std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, PoolAllocator<std::pair<const int, int>>> map;