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,33 @@
#include "testing/testing.hpp"
#include "generator/osm_element_helpers.hpp"
#include "geometry/point2d.hpp"
namespace
{
using namespace generator::osm_element;
OsmElement CreateOsmElement(std::string const & populationStr)
{
OsmElement element;
element.m_tags.emplace_back("population", populationStr);
return element;
}
UNIT_TEST(ParsePopulation)
{
TEST_EQUAL(GetPopulation(CreateOsmElement("123")), 123, ());
TEST_EQUAL(GetPopulation(CreateOsmElement("123 123")), 123123, ());
TEST_EQUAL(GetPopulation(CreateOsmElement("12,300")), 12300, ());
TEST_EQUAL(GetPopulation(CreateOsmElement("000")), 0, ());
TEST_EQUAL(GetPopulation(CreateOsmElement("123.321")), 123321, ());
TEST_EQUAL(GetPopulation(CreateOsmElement("123 000 000 (Moscow Info)")), 123000000, ());
TEST_EQUAL(GetPopulation(CreateOsmElement("123 000 000 (123)")), 123000000, ());
TEST_EQUAL(GetPopulation(CreateOsmElement("")), 0, ());
TEST_EQUAL(GetPopulation(CreateOsmElement(" ")), 0, ());
TEST_EQUAL(GetPopulation(CreateOsmElement("asd")), 0, ());
TEST_EQUAL(GetPopulation(CreateOsmElement("sfa843r")), 0, ());
TEST_EQUAL(GetPopulation(OsmElement()), 0, ());
}
} // namespace