mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-26 07:43:36 +00:00
[core] Switch to ankerl::unordered_dense
Signed-off-by: x7z4w <x7z4w@noreply.codeberg.org>
This commit is contained in:
@@ -4,7 +4,8 @@
|
||||
|
||||
#include <list>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "3party/ankerl/unordered_dense.h"
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
@@ -24,7 +25,7 @@ public:
|
||||
FifoCacheTest(size_t capacity, typename FifoCache<Key, Value>::Loader const & loader) : m_cache(capacity, loader) {}
|
||||
|
||||
Value const & GetValue(Key const & key) { return m_cache.GetValue(key); }
|
||||
unordered_map<Key, Value> const & GetMap() const { return m_cache.m_map; }
|
||||
ankerl::unordered_dense::map<Key, Value> const & GetMap() const { return m_cache.m_map; }
|
||||
boost::circular_buffer<Key> const & GetFifo() const { return m_cache.m_fifo; }
|
||||
|
||||
bool IsValid() const
|
||||
@@ -67,7 +68,7 @@ UNIT_TEST(FifoCache)
|
||||
TEST_EQUAL(cache.GetValue(2), 2, ());
|
||||
TEST(cache.IsValid(), ());
|
||||
{
|
||||
unordered_map<Key, Value> expectedMap({{1 /* key */, 1 /* value */}, {2, 2}, {3, 3}});
|
||||
ankerl::unordered_dense::map<Key, Value> expectedMap({{1 /* key */, 1 /* value */}, {2, 2}, {3, 3}});
|
||||
TEST_EQUAL(cache.GetMap(), expectedMap, ());
|
||||
list<Key> expectedList({2, 3, 1});
|
||||
boost::circular_buffer<Key> expectedCB(expectedList.cbegin(), expectedList.cend());
|
||||
@@ -77,7 +78,7 @@ UNIT_TEST(FifoCache)
|
||||
TEST_EQUAL(cache.GetValue(7), 7, ());
|
||||
TEST(cache.IsValid(), ());
|
||||
{
|
||||
unordered_map<Key, Value> expectedMap({{7 /* key */, 7 /* value */}, {2, 2}, {3, 3}});
|
||||
ankerl::unordered_dense::map<Key, Value> expectedMap({{7 /* key */, 7 /* value */}, {2, 2}, {3, 3}});
|
||||
TEST_EQUAL(cache.GetMap(), expectedMap, ());
|
||||
list<Key> expectedList({7, 2, 3});
|
||||
boost::circular_buffer<Key> expectedCB(expectedList.cbegin(), expectedList.cend());
|
||||
|
||||
Reference in New Issue
Block a user