Adds new StringViewDictionary with specialized methods to retrieve values by the hash of the StringView
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2022-05-16 16:36:52 +02:00
parent b9ea517f6e
commit e0c16b772c
2 changed files with 152 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
#ifdef TESTS_BUILD
#include <doctest.h>
#include "../src/Collections/Dictionary.hpp"
#include "../src/Collections/StringViewDictionary.hpp"
using namespace ArbUt;
TEST_CASE("Create Dictionary, insert values") {
@@ -107,4 +108,14 @@ TEST_CASE("Create Dictionary with different types, insert values, iterate over k
CHECK(i == 3);
}
TEST_CASE("Create StringViewDictionary, insert values, get values by hash") {
auto dic = StringViewDictionary<i32>(5);
dic.Insert("foo"_cnc, 5);
dic.Insert("bar"_cnc, 100);
dic.Insert("zet"_cnc, 2000);
CHECK(dic.GetFromHash("bar"_cnc) == 100);
}
#endif