Repo created

This commit is contained in:
Fr4nz D13trich 2025-11-22 13:58:55 +01:00
parent 4af19165ec
commit 68073add76
12458 changed files with 12350765 additions and 2 deletions

View file

@ -0,0 +1,52 @@
#include "testing/testing.hpp"
#include "base/linked_map.hpp"
#include <map>
#include <string>
UNIT_TEST(LinkedMap_Smoke)
{
base::LinkedMap<int, std::string, std::map> container;
TEST(container.IsEmpty(), ());
TEST(container.Emplace(1, "hello"), ());
TEST(container.Emplace(2, "world"), ());
TEST(container.Emplace(3, "!"), ());
TEST(!container.IsEmpty(), ());
TEST_EQUAL(container.Size(), 3, ());
TEST(!container.Emplace(2, "again"), ());
TEST_EQUAL(container.Size(), 3, ());
TEST(container.Contains(2), ());
auto const getResult = container.Get(2);
TEST_EQUAL(getResult, "world", ());
TEST_EQUAL(container.Front(), "hello", ());
container.PopFront();
TEST_EQUAL(container.Front(), "world", ());
TEST_EQUAL(container.Size(), 2, ());
TEST(!container.Contains(10), ());
TEST(!container.Erase(10), ());
TEST_EQUAL(container.Size(), 2, ());
TEST(container.Contains(3), ());
TEST(container.Erase(3), ());
TEST_EQUAL(container.Size(), 1, ());
TEST_EQUAL(container.Front(), "world", ());
decltype(container) otherContainer;
otherContainer.Swap(container);
TEST(container.IsEmpty(), ());
TEST_EQUAL(container.Size(), 0, ());
TEST(!otherContainer.IsEmpty(), ());
TEST_EQUAL(otherContainer.Size(), 1, ());
TEST_EQUAL(otherContainer.Front(), "world", ());
}