| 1629 | |
| 1630 | template <typename Factory> |
| 1631 | void test_pmr_destructor_deallocates() { |
| 1632 | tracking_memory_resource mr; |
| 1633 | { |
| 1634 | typename Factory::container_type c = Factory::create(mr); |
| 1635 | for (int i = 0; i < kPmrInsertCount; ++i) { |
| 1636 | Factory::insert(c, i); |
| 1637 | } |
| 1638 | FL_CHECK(mr.allocate_count > 0); |
| 1639 | } |
| 1640 | // After destruction, deallocate should have been called |
| 1641 | FL_CHECK(mr.deallocate_count > 0); |
| 1642 | } |
| 1643 | |
| 1644 | FL_TEST_CASE("PMR allocation - insert causes allocations through memory_resource") { |
| 1645 | FL_SUBCASE("fl::vector") { test_pmr_insert_allocates<PmrVectorFactory>(); } |