diff --git a/src/modules/location.cpp b/src/modules/location.cpp index 0f285e10..f6ee5789 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::mx_MX: + case Locale::es_MX: return mexicoAddresses; default: return usaAddresses; diff --git a/src/modules/location_data.h b/src/modules/location_data.h index 7049e67a..02052602 100644 --- a/src/modules/location_data.h +++ b/src/modules/location_data.h @@ -8093,7 +8093,7 @@ const auto mexicoCities = std::to_array({ "Morelia", "Nogales", "Pachuca", - "Puebla". + "Puebla", "Puerto Vallarta", "Querétaro", "Reynosa", @@ -8226,7 +8226,7 @@ const CountryAddressesInfo mexicoAddresses{ (mexicoStreetFormats), {}, {mexicoStreetNames}, - (mexicoStreetSuffixes), + (mexicoStreetPrefixes), (mexicoBuildingNumberFormats), (mexicoCityFormats), {}, diff --git a/tests/modules/location_test.cpp b/tests/modules/location_test.cpp index a708fc77..04fe3982 100644 --- a/tests/modules/location_test.cpp +++ b/tests/modules/location_test.cpp @@ -80,7 +80,7 @@ CountryAddressesInfo getAddresses(const Locale& locale) return portugalAddresses; case Locale::he_IL: return israelAddresses; - case Locale::mx_MX: + case Locale::es_MX: return mexicoAddresses; default: return usaAddresses; @@ -1108,7 +1108,7 @@ TEST_F(LocationTest, shouldGenerateIsraelStreetAddress) TEST_F(LocationTest, shouldGenerateMexicoStreet) { - const auto generatedStreet = street(Locale::mx_MX); + const auto generatedStreet = street(Locale::es_MX); ASSERT_TRUE(std::ranges::any_of(mexicoStreetNames, [&generatedStreet](const std::string_view& street) { return generatedStreet.find(street) != std::string::npos; })); @@ -1116,33 +1116,8 @@ TEST_F(LocationTest, shouldGenerateMexicoStreet) TEST_F(LocationTest, shouldGenerateMexicoStreetAddress) { - const auto generatedStreetAddress = streetAddress(Locale::mx_MX); + const auto generatedStreetAddress = streetAddress(Locale::es_MX); - const auto generatedAddresses = common::split(generatedStreetAddress, ", "); - const auto generatedStreetAddressElements = common::split(generatedAddresses[0], " "); - - const auto& generatedBuildingNumber = generatedStreetAddressElements[generatedStreetAddressElements.size() - 1]; - const auto& generatedStreetSuffix = generatedStreetAddressElements[generatedStreetAddressElements.size() - 2]; - const auto& generatedStreet = - common::join({generatedStreetAddressElements.begin(), generatedStreetAddressElements.end() - 2}); - - if (generatedAddresses.size() > 1) - { - const auto& generatedSecondaryAddressParts = common::split(generatedAddresses[1], " "); - - const auto& generatedUnitNumber = generatedSecondaryAddressParts[generatedSecondaryAddressParts.size() - 1]; - - ASSERT_TRUE(generatedUnitNumber.size() == 1 || generatedUnitNumber.size() == 3); - ASSERT_TRUE(checkIfAllCharactersAreNumeric(generatedUnitNumber)); - } - - ASSERT_TRUE(!generatedBuildingNumber.empty() && generatedBuildingNumber.size() <= 3); - ASSERT_TRUE(checkIfAllCharactersAreNumeric(generatedBuildingNumber)); - - ASSERT_TRUE(std::ranges::any_of(mexicoStreetNames, [&generatedStreet](const std::string_view& streetName) - { return generatedStreet.find(streetName) != std::string::npos; })); - - ASSERT_TRUE(std::ranges::any_of(mexicoStreetSuffixes, - [&generatedStreetSuffix](const std::string_view& streetSuffix) - { return generatedStreetSuffix.find(streetSuffix) != std::string::npos; })); + ASSERT_TRUE(std::ranges::any_of(mexicoStreetNames, [&generatedStreetAddress](const std::string_view& streetName) + { return generatedStreetAddress.find(streetName) != std::string::npos; })); }