Skip to content

Commit

Permalink
Macedonia location data updated
Browse files Browse the repository at this point in the history
  • Loading branch information
mayakost committed Dec 9, 2024
1 parent 1f76b3d commit 735347f
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 0 deletions.
1 change: 1 addition & 0 deletions Testing/Temporary/CTestCostData.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---
3 changes: 3 additions & 0 deletions Testing/Temporary/LastTest.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Start testing: Dec 08 19:03 EST
----------------------------------------------------------
End testing: Dec 08 19:03 EST
2 changes: 2 additions & 0 deletions src/modules/location.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ CountryAddressesInfo getAddresses(const Locale& locale)
return palestineAddresses;
case Locale::es_MX:
return mexicoAddresses;
case Locale::mk_MK:
return macedoniaAddresses;
default:
return usaAddresses;
}
Expand Down
131 changes: 131 additions & 0 deletions src/modules/location_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -8471,6 +8471,137 @@ const CountryAddressesInfo mexicoAddresses{
{},
(mexicoStates),
};

// North Macedonia
const auto macedoniaCities = std::to_array<std::string_view>({
"Berovo",
"Delčevo",
"Kočani",
"Makedonska Kamenica",
"Pehčevo",
"Probištip",
"Štip",
"Vinica",
"Kratovo",
"Kriva Palanka",
"Kumanovo",
"Bitola",
"Demir Hisar",
"Kruševo",
"Prilep",
"Resen",
"Gotovo",
"Tetovo",
"Skopje",
"Bogdanci",
"Gevgelija",
"Radoviš",
"Strumica",
"Valandovo",
"Debar",
"Kičevo",
"Makedonski Brod",
"Ohrid",
"Struga",
"Demir Kapija",
"Kavadarci",
"Negotino",
"Sveti Nikole",
"Veles",
"Dobrošte",
"Belojšte",
"Miletino",
"Raotince",
"Dračevo",
"Gostivar",
"Časka",
"Gazi Baba"
});


const auto macedoniaStates = std::to_array<std::string_view>({
"Skopje",
"Pelagonia",
"Polog",
"Vardar",
"Eastern",
"Southeastern",
"Northeastern",
"Southwestern"
});


const auto macedoniaStreetNames = std::to_array<std::string_view>({
"Kozle",
"Partizanski Odredi",
"Ilindenska",
"Makedonija",
"Goce Delčev",
"Marshal Tito",
"Sv. Kiril i Metodij",
"Boris Trajkovski",
"Koco Racin",
"Vladimir Komarov",
"Nikola Karev",
"Kliment Ohridski",
"Skupi",
"Mokra"
});


const auto macedoniaStreetPrefixes = std::to_array<std::string_view>({
"ulica",
"bulevar"
});


const std::string_view macedoniaZipCodeFormat{"#####"};


const auto macedoniaAddressFormats = std::to_array<std::string_view>({
"{streetPrefix} {street} {buildingNumber} {secondaryAddress}",
"{street} {buildingNumber})"
});


const auto macedoniaSecondaryAddressFormats = std::to_array<std::string_view>({
"Stan. #"
});


const auto macedoniaBuildingNumberFormats = std::to_array<std::string_view>({
"#",
"##",
"###"
});


const auto macedoniaStreetFormats = std::to_array<std::string_view>({
"{streetPrefix} {streetName}"
});


const auto macedoniaCityFormats = std::to_array<std::string_view>({
"{cityName}"
});


const CountryAddressesInfo macedoniaAddresses{
{macedoniaZipCodeFormat},
(macedoniaAddressFormats),
(macedoniaSecondaryAddressFormats),
(macedoniaStreetFormats),
{},
{macedoniaStreetNames},
(macedoniaStreetPrefixes),
(macedoniaBuildingNumberFormats),
(macedoniaCityFormats),
{},
(macedoniaCities),
{},
(macedoniaStates)
};

// palestine
const auto palestineCities = std::to_array<std::string_view>(

Expand Down
20 changes: 20 additions & 0 deletions tests/modules/location_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ CountryAddressesInfo getAddresses(const Locale& locale)
return israelAddresses;
case Locale::es_MX:
return mexicoAddresses;
case Locale::mk_MK:
return macedoniaAddresses;
case Locale::ar_PS:
return palestineAddresses;
default:
Expand Down Expand Up @@ -1202,6 +1204,24 @@ TEST_F(LocationTest, shouldGenerateMexicoStreetAddress)
{ return generatedStreetAddress.find(streetName) != std::string::npos; }));
}

TEST_F(LocationTest, shouldGenerateMacedoniaStreet)
{
const auto generatedStreet = street(Locale::mk_MK);

ASSERT_TRUE(std::ranges::any_of(macedoniaStreetNames, [&generatedStreet](const std::string_view& street)
{ return generatedStreet.find(street) != std::string::npos; }));
}


TEST_F(LocationTest, shouldGenerateMacedoniaStreetAddress)
{
const auto generatedStreetAddress = streetAddress(Locale::mk_MK);

ASSERT_TRUE(std::ranges::any_of(macedoniaStreetNames, [&generatedStreetAddress](const std::string_view& streetName)
{ return generatedStreetAddress.find(streetName) != std::string::npos; }));
}


TEST_F(LocationTest, shouldGeneratepalestineStreet)
{
const auto generatedStreet = street(Locale::ar_PS);
Expand Down

0 comments on commit 735347f

Please sign in to comment.