mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 21:33:59 +00:00
Format all C++ and Java code via clang-format
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
@@ -13,8 +13,8 @@
|
||||
|
||||
#include "geometry/latlon.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -43,27 +43,24 @@ UNIT_TEST(AddDataPointsTest)
|
||||
stats.AddDataPoints("mwm2", "country1", 5);
|
||||
stats.AddDataPoints("mwm3", "country3", 7);
|
||||
|
||||
Stats const expected = {
|
||||
{{"mwm1", 4}, {"mwm2", 5}, {"mwm3", 7} /* Mwm to number */},
|
||||
{{"country1", 9}, {"country3", 7} /* Country to number */}};
|
||||
Stats const expected = {{{"mwm1", 4}, {"mwm2", 5}, {"mwm3", 7} /* Mwm to number */},
|
||||
{{"country1", 9}, {"country3", 7} /* Country to number */}};
|
||||
|
||||
TEST_EQUAL(stats, expected, ());
|
||||
}
|
||||
|
||||
UNIT_TEST(AddStatTest)
|
||||
{
|
||||
Stats stats1 = {
|
||||
{{"Belarus_Minsk Region", 1}, {"Uzbekistan", 7}, {"Russia_Moscow", 5} /* Mwm to number */},
|
||||
{{"Russian Federation", 10}, {"Poland", 5} /* Country to number */}};
|
||||
Stats stats1 = {{{"Belarus_Minsk Region", 1}, {"Uzbekistan", 7}, {"Russia_Moscow", 5} /* Mwm to number */},
|
||||
{{"Russian Federation", 10}, {"Poland", 5} /* Country to number */}};
|
||||
|
||||
Stats const stats2 = {{{"Belarus_Minsk Region", 2} /* Mwm to number */},
|
||||
{{"Russian Federation", 1}, {"Belarus", 8} /* Country to number */}};
|
||||
|
||||
stats1.Add(stats2);
|
||||
|
||||
Stats const expected = {
|
||||
{{"Belarus_Minsk Region", 3}, {"Uzbekistan", 7}, {"Russia_Moscow", 5} /* Mwm to number */},
|
||||
{{"Russian Federation", 11}, {"Poland", 5}, {"Belarus", 8} /* Country to number */}};
|
||||
Stats const expected = {{{"Belarus_Minsk Region", 3}, {"Uzbekistan", 7}, {"Russia_Moscow", 5} /* Mwm to number */},
|
||||
{{"Russian Federation", 11}, {"Poland", 5}, {"Belarus", 8} /* Country to number */}};
|
||||
|
||||
TEST_EQUAL(stats1, expected, ());
|
||||
}
|
||||
@@ -101,8 +98,7 @@ UNIT_TEST(AddTracksStatsTest)
|
||||
|
||||
UNIT_TEST(MappingToCsvTest)
|
||||
{
|
||||
Stats::NameToCountMapping const mapping = {
|
||||
{{"Belarus_Minsk Region", 2}, {"Uzbekistan", 5}, {"Russia_Moscow", 3}}};
|
||||
Stats::NameToCountMapping const mapping = {{{"Belarus_Minsk Region", 2}, {"Uzbekistan", 5}, {"Russia_Moscow", 3}}};
|
||||
{
|
||||
std::ostringstream ss;
|
||||
MappingToCsv("mwm", mapping, true /* printPercentage */, ss);
|
||||
@@ -127,8 +123,7 @@ Belarus_Minsk Region,2
|
||||
|
||||
UNIT_TEST(MappingToCsvUint64Test)
|
||||
{
|
||||
Stats::NameToCountMapping const mapping = {{"Belarus_Minsk Region", 5'000'000'000},
|
||||
{"Uzbekistan", 15'000'000'000}};
|
||||
Stats::NameToCountMapping const mapping = {{"Belarus_Minsk Region", 5'000'000'000}, {"Uzbekistan", 15'000'000'000}};
|
||||
std::stringstream ss;
|
||||
MappingToCsv("mwm", mapping, true /* printPercentage */, ss);
|
||||
std::string const expected = R"(mwm,number,percent
|
||||
@@ -140,21 +135,17 @@ Belarus_Minsk Region,5000000000,25
|
||||
|
||||
UNIT_TEST(SerializationToCsvTest)
|
||||
{
|
||||
Stats::NameToCountMapping const mapping1 = {{"Belarus_Minsk Region", 2},
|
||||
{"Uzbekistan", 5},
|
||||
{"Russia_Moscow", 1},
|
||||
{"Russia_Moscow Oblast_East", 2}};
|
||||
Stats::NameToCountMapping const mapping1 = {
|
||||
{"Belarus_Minsk Region", 2}, {"Uzbekistan", 5}, {"Russia_Moscow", 1}, {"Russia_Moscow Oblast_East", 2}};
|
||||
TestSerializationToCsv(mapping1);
|
||||
|
||||
Stats::NameToCountMapping const mapping2 = {
|
||||
{{"Belarus_Minsk Region", 2}, {"Uzbekistan", 5}, {"Russia_Moscow", 3}}};
|
||||
Stats::NameToCountMapping const mapping2 = {{{"Belarus_Minsk Region", 2}, {"Uzbekistan", 5}, {"Russia_Moscow", 3}}};
|
||||
TestSerializationToCsv(mapping2);
|
||||
}
|
||||
|
||||
UNIT_TEST(SerializationToCsvWithZeroValueTest)
|
||||
{
|
||||
Stats::NameToCountMapping const mapping = {{"Russia_Moscow Oblast_East", 2},
|
||||
{"Poland_Lesser Poland Voivodeship", 0}};
|
||||
Stats::NameToCountMapping const mapping = {{"Russia_Moscow Oblast_East", 2}, {"Poland_Lesser Poland Voivodeship", 0}};
|
||||
Stats::NameToCountMapping const expected = {{"Russia_Moscow Oblast_East", 2}};
|
||||
|
||||
std::stringstream ss;
|
||||
@@ -168,9 +159,8 @@ UNIT_TEST(SerializationToCsvWithZeroValueTest)
|
||||
|
||||
UNIT_TEST(SerializationToCsvUint64Test)
|
||||
{
|
||||
Stats::NameToCountMapping const mapping = {{"Belarus_Minsk Region", 20'000'000'000},
|
||||
{"Uzbekistan", 5},
|
||||
{"Russia_Moscow", 7'000'000'000}};
|
||||
Stats::NameToCountMapping const mapping = {
|
||||
{"Belarus_Minsk Region", 20'000'000'000}, {"Uzbekistan", 5}, {"Russia_Moscow", 7'000'000'000}};
|
||||
TestSerializationToCsv(mapping);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user