From 3acba9b413eaec4d5d210aa5362f6bb015f1e15d Mon Sep 17 00:00:00 2001 From: charan-003 <85248228+charan-003@users.noreply.github.com> Date: Fri, 15 Nov 2024 01:03:30 -0700 Subject: [PATCH 01/10] Update location_data.h Added data for Palestine --- src/modules/location_data.h | 179 ++++++++++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) diff --git a/src/modules/location_data.h b/src/modules/location_data.h index 02052602..8d895a34 100644 --- a/src/modules/location_data.h +++ b/src/modules/location_data.h @@ -8234,6 +8234,185 @@ const CountryAddressesInfo mexicoAddresses{ {}, (mexicoStates), }; +// Palestine +const auto PalestineCities = std::to_array( + +{ + "Gaza City", + "Hebron", + "Nablus", + "Jenin", + "Ramallah", + "Bethlehem", + "Jericho", + "Tulkarm", + "Qalqilya", + "Rafah", + "Khan Yunis", + "Beit Jala", + "Beit Sahour", + "Al-Bireh", + "Salfit", + "Tubas", + "Dura", + "Yatta", + "Halhul", + "Beitunia", + "Qabatiya", + "Anabta", + "Bani Na'im", + "Bani Suheila", + "Beit Hanoun", + "Beit Lahia", + "Deir al-Balah", + "Abasan al-Kabira", + "Abu Dis", + "Ad-Dhahiriya", + "Arraba", + "As-Samu", + "Azzun", + "Bala", + "Bani Zeid", + "Bidya", + "Birzeit", + "Bruqin", + "Deir Istiya", + "Hajja", + "Hizma", + "Idhna", + "Jaba", + "Jifna", + "Kafr Aqab", + "Kafr ad-Dik", + "Kafr al-Labad", + "Kafr Qaddum", + "Kharas", + "Qatanna" +}); +const auto PalestineStates = std::to_array({ + "Hebron", + "Bethlehem", + "Jerusalem", + "Ramallah and Al-Bireh", + "Salfit", + "Nablus", + "Qalqilya", + "Tulkarm", + "Jenin", + "Tubas", + "Jericho and the Jordan Valley", + "North Gaza", + "Gaza", + "Deir al-Balah", + "Khan Yunis", + "Rafah" +} +); +const auto PalestineStreetNames = std::to_array({ + "Omar Mukhtar", + "Al-Shuhada", + "Star", + "Jamal Abdel Nasser", + "Al-Wehda", + "Al-Nuzha", + "Al-Irsal", + "Al-Manara", + "Al-Ma'arif", + "Al-Madares", + "Al-Quds", + "Al-Muntazah", + "Al-Ma'arad", + "Al-Baladiya", + "Al-Sa'a", + "Al-Masjid", + "Al-Mahkamah", + "Al-Maktaba", + "Al-Mahatta", + "Al-Masri", + "Al-Mujamma'", + "Al-Muhafaza", + "Al-Mu'assasa", + "Al-Mu'allimin", + "Al-Mu'askar", + "Al-Mu'awiya", + "Al-Mu'athafin", + "Al-Mu'askar Al-Jadid", + "Al-Mu'askar Al-Qadim", + "Al-Mu'askar Al-Shamali", + "Al-Mu'askar Al-Janubi", + "Al-Mu'askar Al-Gharbi", + "Al-Mu'askar Al-Sharqi", + "Al-Mu'askar Al-Awsat", + "Al-Mu'askar Al-Kabir", + "Al-Mu'askar Al-Saghir", + "Al-Mu'askar Al-Madina", + "Al-Mu'askar Al-Bahr", + "Al-Mu'askar Al-Jabal", + "Al-Mu'askar Al-Wadi", + "Al-Mu'askar Al-Sahil", + "Al-Mu'askar Al-Turab", + "Al-Mu'askar Al-Hajar", + "Al-Mu'askar Al-Nahr", + "Al-Mu'askar Al-Suq", + "Al-Mu'askar Al-Masna'", + "Al-Mu'askar Al-Madina Al-Qadima", + "Al-Mu'askar Al-Madina Al-Jadida", + "Al-Mu'askar Al-Madina Al-Munawara", + "Al-Mu'askar Al-Madina Al-Muqaddasa" +} +); + +const auto PalestineStreetSuffix = std::to_array({ + "Shari' or Shari'a", + "Tariq", + "Jada", + "Midan", + "Zuqaq", + "Hara", + "Darb", + "Saha", + "Jisr" +} +); + +const std::string_view PalestineZipCodeFormat{"P######"}; +const auto PalestineAddressFormats = + std::to_array({ + "{street} {buildingNumber} {secondaryAddress}", + "{street} {buildingNumber}", + }); +const auto PalestineSecondaryAddressFormats = std::to_array({ + "Floor #", + "Apt. #", +}); +const auto PalestineBuildingNumberFormats = std::to_array({ + "#", + "##", + "###", +}); +const auto PalestineStreetFormats = + std::to_array({ + "{streetSuffix} {streetName}", + }); +const auto PalestineCityFormats = std::to_array({ + "{cityName}", +}); + +const CountryAddressesInfo PalestineAddresses{ + PalestineZipCodeFormat, + PalestineAddressFormats, + PalestineSecondaryAddressFormats, + PalestineStreetFormats, + {}, + {PalestineStreetNames}, + PalestineStreetSuffixes, + PalestineBuildingNumberFormats, + PalestineCityFormats, + {}, + PalestineCities, + {}, + PalestineStates, +}; // Poland From 28114c5fe85977d4b6de8d37b304b03cc5986c67 Mon Sep 17 00:00:00 2001 From: charan-003 <85248228+charan-003@users.noreply.github.com> Date: Fri, 15 Nov 2024 01:05:11 -0700 Subject: [PATCH 02/10] Update location.cpp Added case for Palestine --- src/modules/location.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/location.cpp b/src/modules/location.cpp index f6ee5789..6ddbab1e 100644 --- a/src/modules/location.cpp +++ b/src/modules/location.cpp @@ -78,6 +78,8 @@ CountryAddressesInfo getAddresses(const Locale& locale) return portugalAddresses; case Locale::he_IL: return israelAddresses; + case Locale::Ar_PS: + return palestineAddresses; case Locale::es_MX: return mexicoAddresses; default: From 441f1c56360eb0bae7ed43492c29a5819fd40a61 Mon Sep 17 00:00:00 2001 From: charan-003 <85248228+charan-003@users.noreply.github.com> Date: Fri, 15 Nov 2024 01:17:25 -0700 Subject: [PATCH 03/10] Update location_test.cpp added test cases for Palestine --- tests/modules/location_test.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/modules/location_test.cpp b/tests/modules/location_test.cpp index 04fe3982..7def43fd 100644 --- a/tests/modules/location_test.cpp +++ b/tests/modules/location_test.cpp @@ -82,6 +82,8 @@ CountryAddressesInfo getAddresses(const Locale& locale) return israelAddresses; case Locale::es_MX: return mexicoAddresses; + case Locale::Ar_PS; + return palestineAddresses; default: return usaAddresses; } @@ -1121,3 +1123,20 @@ TEST_F(LocationTest, shouldGenerateMexicoStreetAddress) ASSERT_TRUE(std::ranges::any_of(mexicoStreetNames, [&generatedStreetAddress](const std::string_view& streetName) { return generatedStreetAddress.find(streetName) != std::string::npos; })); } + +TEST_F(LocationTest, shouldGeneratePalestineStreet) +{ + const auto generatedStreet = street(Locale::Ar_PS); + ASSERT_TRUE(std::ranges::any_of(PalestineStreetNames, [&generatedStreet](const std::string_view& street) + { return generatedStreet.find(street) != std::string::npos; })); +} + +TEST_F(LocationTest, shouldGeneratePalestineStreetAddress) +{ + const auto generatedStreetAddress = streetAddress(Locale::Ar_PS); + ASSERT_TRUE(std::ranges::any_of(PalestineStreetNames, [&generatedStreetAddress](const std::string_view& streetName) + { return generatedStreetAddress.find(streetName) != std::string::npos; })); +} + + + From 84009c9edc2b2d256fc39ec0f35399aaaea5f2f4 Mon Sep 17 00:00:00 2001 From: charan-003 <85248228+charan-003@users.noreply.github.com> Date: Fri, 15 Nov 2024 03:11:48 -0700 Subject: [PATCH 04/10] Update location_test.cpp --- tests/modules/location_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/modules/location_test.cpp b/tests/modules/location_test.cpp index 7def43fd..ae3acd67 100644 --- a/tests/modules/location_test.cpp +++ b/tests/modules/location_test.cpp @@ -82,7 +82,7 @@ CountryAddressesInfo getAddresses(const Locale& locale) return israelAddresses; case Locale::es_MX: return mexicoAddresses; - case Locale::Ar_PS; + case Locale::Ar_PS: return palestineAddresses; default: return usaAddresses; From 9e467f48853298c0f3d6d8e7a02ec6c69b42032c Mon Sep 17 00:00:00 2001 From: charan-003 <85248228+charan-003@users.noreply.github.com> Date: Fri, 15 Nov 2024 03:29:54 -0700 Subject: [PATCH 05/10] Update location_test.cpp --- tests/modules/location_test.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/modules/location_test.cpp b/tests/modules/location_test.cpp index ae3acd67..1e60980c 100644 --- a/tests/modules/location_test.cpp +++ b/tests/modules/location_test.cpp @@ -82,8 +82,8 @@ CountryAddressesInfo getAddresses(const Locale& locale) return israelAddresses; case Locale::es_MX: return mexicoAddresses; - case Locale::Ar_PS: - return palestineAddresses; + case Locale::ar_PS: + return PalestineAddresses; default: return usaAddresses; } @@ -1126,14 +1126,14 @@ TEST_F(LocationTest, shouldGenerateMexicoStreetAddress) TEST_F(LocationTest, shouldGeneratePalestineStreet) { - const auto generatedStreet = street(Locale::Ar_PS); + const auto generatedStreet = street(Locale::ar_PS); ASSERT_TRUE(std::ranges::any_of(PalestineStreetNames, [&generatedStreet](const std::string_view& street) { return generatedStreet.find(street) != std::string::npos; })); } TEST_F(LocationTest, shouldGeneratePalestineStreetAddress) { - const auto generatedStreetAddress = streetAddress(Locale::Ar_PS); + const auto generatedStreetAddress = streetAddress(Locale::ar_PS); ASSERT_TRUE(std::ranges::any_of(PalestineStreetNames, [&generatedStreetAddress](const std::string_view& streetName) { return generatedStreetAddress.find(streetName) != std::string::npos; })); } From 419f8e21ffe5d030145ee686c86ee74b166e9568 Mon Sep 17 00:00:00 2001 From: charan-003 <85248228+charan-003@users.noreply.github.com> Date: Fri, 15 Nov 2024 03:39:03 -0700 Subject: [PATCH 06/10] Update location.cpp changed to camelCasing --- src/modules/location.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/location.cpp b/src/modules/location.cpp index 6ddbab1e..8b535b88 100644 --- a/src/modules/location.cpp +++ b/src/modules/location.cpp @@ -78,7 +78,7 @@ CountryAddressesInfo getAddresses(const Locale& locale) return portugalAddresses; case Locale::he_IL: return israelAddresses; - case Locale::Ar_PS: + case Locale::ar_PS: return palestineAddresses; case Locale::es_MX: return mexicoAddresses; From 43e6d37c971ab5fc069c138a5ef9f8f21d6f960f Mon Sep 17 00:00:00 2001 From: charan-003 <85248228+charan-003@users.noreply.github.com> Date: Fri, 15 Nov 2024 03:44:19 -0700 Subject: [PATCH 07/10] Update location_data.h fixed camelCasing issues --- src/modules/location_data.h | 44 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/modules/location_data.h b/src/modules/location_data.h index 8d895a34..0ee88c1e 100644 --- a/src/modules/location_data.h +++ b/src/modules/location_data.h @@ -8234,8 +8234,8 @@ const CountryAddressesInfo mexicoAddresses{ {}, (mexicoStates), }; -// Palestine -const auto PalestineCities = std::to_array( +// palestine +const auto palestineCities = std::to_array( { "Gaza City", @@ -8289,7 +8289,7 @@ const auto PalestineCities = std::to_array( "Kharas", "Qatanna" }); -const auto PalestineStates = std::to_array({ +const auto palestineStates = std::to_array({ "Hebron", "Bethlehem", "Jerusalem", @@ -8308,7 +8308,7 @@ const auto PalestineStates = std::to_array({ "Rafah" } ); -const auto PalestineStreetNames = std::to_array({ +const auto palestineStreetNames = std::to_array({ "Omar Mukhtar", "Al-Shuhada", "Star", @@ -8362,7 +8362,7 @@ const auto PalestineStreetNames = std::to_array({ } ); -const auto PalestineStreetSuffix = std::to_array({ +const auto palestineStreetSuffixes = std::to_array({ "Shari' or Shari'a", "Tariq", "Jada", @@ -8375,43 +8375,43 @@ const auto PalestineStreetSuffix = std::to_array({ } ); -const std::string_view PalestineZipCodeFormat{"P######"}; -const auto PalestineAddressFormats = +const std::string_view palestineZipCodeFormat{"P######"}; +const auto palestineAddressFormats = std::to_array({ "{street} {buildingNumber} {secondaryAddress}", "{street} {buildingNumber}", }); -const auto PalestineSecondaryAddressFormats = std::to_array({ +const auto palestineSecondaryAddressFormats = std::to_array({ "Floor #", "Apt. #", }); -const auto PalestineBuildingNumberFormats = std::to_array({ +const auto palestineBuildingNumberFormats = std::to_array({ "#", "##", "###", }); -const auto PalestineStreetFormats = +const auto palestineStreetFormats = std::to_array({ "{streetSuffix} {streetName}", }); -const auto PalestineCityFormats = std::to_array({ +const auto palestineCityFormats = std::to_array({ "{cityName}", }); -const CountryAddressesInfo PalestineAddresses{ - PalestineZipCodeFormat, - PalestineAddressFormats, - PalestineSecondaryAddressFormats, - PalestineStreetFormats, +const CountryAddressesInfo palestineAddresses{ + palestineZipCodeFormat, + palestineAddressFormats, + palestineSecondaryAddressFormats, + palestineStreetFormats, {}, - {PalestineStreetNames}, - PalestineStreetSuffixes, - PalestineBuildingNumberFormats, - PalestineCityFormats, + {palestineStreetNames}, + palestineStreetSuffixes, + palestineBuildingNumberFormats, + palestineCityFormats, {}, - PalestineCities, + palestineCities, {}, - PalestineStates, + palestineStates, }; // Poland From be66ecfc035a3c9c152b89c8004f3982f67cc39a Mon Sep 17 00:00:00 2001 From: charan-003 <85248228+charan-003@users.noreply.github.com> Date: Fri, 15 Nov 2024 03:47:02 -0700 Subject: [PATCH 08/10] Update location_test.cpp fixed the camelCasing issue --- tests/modules/location_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/modules/location_test.cpp b/tests/modules/location_test.cpp index 1e60980c..91457a2c 100644 --- a/tests/modules/location_test.cpp +++ b/tests/modules/location_test.cpp @@ -83,7 +83,7 @@ CountryAddressesInfo getAddresses(const Locale& locale) case Locale::es_MX: return mexicoAddresses; case Locale::ar_PS: - return PalestineAddresses; + return palestineAddresses; default: return usaAddresses; } From 2610d8916143aca9a8bf10081b20917078a8ebbd Mon Sep 17 00:00:00 2001 From: charan-003 <85248228+charan-003@users.noreply.github.com> Date: Fri, 15 Nov 2024 03:50:36 -0700 Subject: [PATCH 09/10] Update location_test.cpp changed all the camelCasing for palestine --- tests/modules/location_test.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/modules/location_test.cpp b/tests/modules/location_test.cpp index 91457a2c..96e32b3c 100644 --- a/tests/modules/location_test.cpp +++ b/tests/modules/location_test.cpp @@ -1124,17 +1124,17 @@ TEST_F(LocationTest, shouldGenerateMexicoStreetAddress) { return generatedStreetAddress.find(streetName) != std::string::npos; })); } -TEST_F(LocationTest, shouldGeneratePalestineStreet) +TEST_F(LocationTest, shouldGeneratepalestineStreet) { const auto generatedStreet = street(Locale::ar_PS); - ASSERT_TRUE(std::ranges::any_of(PalestineStreetNames, [&generatedStreet](const std::string_view& street) + ASSERT_TRUE(std::ranges::any_of(palestineStreetNames, [&generatedStreet](const std::string_view& street) { return generatedStreet.find(street) != std::string::npos; })); } -TEST_F(LocationTest, shouldGeneratePalestineStreetAddress) +TEST_F(LocationTest, shouldGeneratepalestineStreetAddress) { const auto generatedStreetAddress = streetAddress(Locale::ar_PS); - ASSERT_TRUE(std::ranges::any_of(PalestineStreetNames, [&generatedStreetAddress](const std::string_view& streetName) + ASSERT_TRUE(std::ranges::any_of(palestineStreetNames, [&generatedStreetAddress](const std::string_view& streetName) { return generatedStreetAddress.find(streetName) != std::string::npos; })); } From 38f5499f9387a7d38e48a1b79f3dbcd8cca73961 Mon Sep 17 00:00:00 2001 From: charan-003 <85248228+charan-003@users.noreply.github.com> Date: Fri, 15 Nov 2024 04:27:52 -0700 Subject: [PATCH 10/10] Update location_data.h changed zipcode format from P####### to ######## --- src/modules/location_data.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/location_data.h b/src/modules/location_data.h index 0ee88c1e..a01403f1 100644 --- a/src/modules/location_data.h +++ b/src/modules/location_data.h @@ -8375,7 +8375,7 @@ const auto palestineStreetSuffixes = std::to_array({ } ); -const std::string_view palestineZipCodeFormat{"P######"}; +const std::string_view palestineZipCodeFormat{"#######"}; const auto palestineAddressFormats = std::to_array({ "{street} {buildingNumber} {secondaryAddress}",