Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Macedonia location data updated #1013

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Testing/Temporary/CTestCostData.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this file

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could add testing directory to gitignore if you want

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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this? Please remove

----------------------------------------------------------
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
Loading