MCPcopy Create free account
hub / github.com/comaps/comaps / FifoCacheTest

Class FifoCacheTest

libs/base/base_tests/fifo_cache_test.cpp:22–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20
21template <typename Key, typename Value>
22class FifoCacheTest
23{
24public:
25 FifoCacheTest(size_t capacity, typename FifoCache<Key, Value>::Loader const & loader) : m_cache(capacity, loader) {}
26
27 Value const & GetValue(Key const & key) { return m_cache.GetValue(key); }
28 ankerl::unordered_dense::map<Key, Value> const & GetMap() const { return m_cache.m_map; }
29 boost::circular_buffer<Key> const & GetFifo() const { return m_cache.m_fifo; }
30
31 bool IsValid() const
32 {
33 set<Key> listKeys(m_cache.m_fifo.begin(), m_cache.m_fifo.end());
34 set<Key> mapKeys;
35
36 for (auto const & kv : m_cache.m_map)
37 mapKeys.insert(kv.first);
38
39 return listKeys == mapKeys;
40 }
41
42private:
43 FifoCache<Key, Value> m_cache;
44};
45
46UNIT_TEST(FifoCache_Smoke)
47{

Callers

nothing calls this directly

Calls 1

GetValueMethod · 0.45

Tested by

no test coverage detected