Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)

To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
This commit is contained in:
Konstantin Pastbin
2025-04-13 16:37:30 +07:00
commit e3e4a1985a
12931 changed files with 13195100 additions and 0 deletions

View File

@@ -0,0 +1,96 @@
#include "testing/testing.hpp"
#include "base/bidirectional_map.hpp"
#include "base/macros.hpp"
#include <map>
#include <string>
#include <unordered_map>
using namespace base;
using namespace std;
UNIT_TEST(BidirectionalMap_Smoke)
{
BidirectionalMap<int, string> m;
m.Add(1, "a");
{
string value;
TEST(m.GetValue(1, value), ());
TEST_EQUAL(value, "a", ());
}
{
int key;
TEST(m.GetKey("a", key), ());
TEST_EQUAL(key, 1, ());
}
TEST(!m.Add(1, "b"), ());
TEST(!m.Add(2, "a"), ());
TEST(m.Add(2, "b"), ());
TEST(!m.Add(2, "b"), ());
}
UNIT_TEST(BidirectionalMap_Remove)
{
{
BidirectionalMap<int, string> m;
TEST(m.Add(1, "a"), ());
TEST(m.Add(2, "b"), ());
TEST_EQUAL(m.Size(), 2, ());
TEST(!m.RemoveKey(3), ());
TEST_EQUAL(m.Size(), 2, ());
TEST(m.RemoveKey(1), ());
TEST_EQUAL(m.Size(), 1, ());
TEST(!m.RemoveValue("a"), ());
TEST_EQUAL(m.Size(), 1, ());
TEST(m.RemoveValue("b"), ());
TEST(m.IsEmpty(), ());
}
{
BidirectionalMap<int, int> m;
TEST(m.Add(1, 1), ());
TEST(m.Add(2, 2), ());
TEST_EQUAL(m.Size(), 2, ());
TEST(!m.RemoveKey(3), ());
TEST_EQUAL(m.Size(), 2, ());
TEST(m.RemoveKey(1), ());
TEST_EQUAL(m.Size(), 1, ());
TEST(!m.RemoveValue(1), ());
TEST_EQUAL(m.Size(), 1, ());
TEST(m.RemoveValue(2), ());
TEST(m.IsEmpty(), ());
}
{
BidirectionalMap<int, int> m;
TEST(m.Add(1, 2), ());
TEST(m.Add(2, 1), ());
TEST_EQUAL(m.Size(), 2, ());
TEST(!m.RemoveKey(3), ());
TEST_EQUAL(m.Size(), 2, ());
TEST(m.RemoveKey(1), ());
TEST_EQUAL(m.Size(), 1, ());
TEST(!m.RemoveValue(2), ());
TEST_EQUAL(m.Size(), 1, ());
TEST(m.RemoveValue(1), ());
TEST(m.IsEmpty(), ());
}
}