Files
comaps/platform/platform_tests/language_test.cpp
Konstantin Pastbin e3e4a1985a 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
2025-05-08 21:10:51 +07:00

34 lines
873 B
C++

#include "testing/testing.hpp"
#include "platform/preferred_languages.hpp"
#include "base/logging.hpp"
#include <cstddef>
#include <string>
UNIT_TEST(LangNormalize_Smoke)
{
char const * arr1[] = { "en", "en-GB", "zh", "es-SP", "zh-penyn", "en-US", "ru_RU", "es" };
char const * arr2[] = { "en", "en", "zh", "es", "zh", "en", "ru", "es" };
static_assert(ARRAY_SIZE(arr1) == ARRAY_SIZE(arr2), "");
for (size_t i = 0; i < ARRAY_SIZE(arr1); ++i)
TEST_EQUAL(arr2[i], languages::Normalize(arr1[i]), ());
}
UNIT_TEST(PrefLanguages_Smoke)
{
std::string s = languages::GetPreferred();
TEST(!s.empty(), ());
LOG(LINFO, ("Preferred langs:", s));
s = languages::GetCurrentOrig();
TEST(!s.empty(), ());
LOG(LINFO, ("Current original lang:", s));
s = languages::GetCurrentNorm();
TEST(!s.empty(), ());
LOG(LINFO, ("Current normalized lang:", s));
}