summaryrefslogtreecommitdiffstats
path: root/o3tl/qa/test-lru_map.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'o3tl/qa/test-lru_map.cxx')
-rw-r--r--o3tl/qa/test-lru_map.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/o3tl/qa/test-lru_map.cxx b/o3tl/qa/test-lru_map.cxx
index 7a4886d3be3e..a7f9777e2c5f 100644
--- a/o3tl/qa/test-lru_map.cxx
+++ b/o3tl/qa/test-lru_map.cxx
@@ -28,6 +28,7 @@ public:
void testLruRemoval();
void testCustomHash();
void testRemoveIf();
+ void testNoAutoCleanup();
CPPUNIT_TEST_SUITE(lru_map_test);
CPPUNIT_TEST(testBaseUsage);
@@ -36,6 +37,7 @@ public:
CPPUNIT_TEST(testLruRemoval);
CPPUNIT_TEST(testCustomHash);
CPPUNIT_TEST(testRemoveIf);
+ CPPUNIT_TEST(testNoAutoCleanup);
CPPUNIT_TEST_SUITE_END();
};
@@ -289,6 +291,24 @@ void lru_map_test::testRemoveIf()
CPPUNIT_ASSERT_EQUAL(size_t(0), lru.size());
}
+void lru_map_test::testNoAutoCleanup()
+{
+ o3tl::lru_map<int, int> lru(0);
+ CPPUNIT_ASSERT_EQUAL(size_t(0), lru.size());
+ lru.insert({0,0});
+ lru.insert({1,1});
+ CPPUNIT_ASSERT_EQUAL(size_t(2), lru.size());
+ lru.insert({0,0});
+ CPPUNIT_ASSERT_EQUAL(size_t(2), lru.size());
+
+ int i = 0;
+ for (auto &rPair : lru)
+ {
+ CPPUNIT_ASSERT_EQUAL(i, rPair.first);
+ ++i;
+ }
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(lru_map_test);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */