diff --git a/src/modules/location.cpp b/src/modules/location.cpp index 911c120a..f6ee5789 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::es_MX: + return mexicoAddresses; default: return usaAddresses; } diff --git a/src/modules/location_data.h b/src/modules/location_data.h index 5de9b6cb..02052602 100644 --- a/src/modules/location_data.h +++ b/src/modules/location_data.h @@ -8060,6 +8060,181 @@ const CountryAddressesInfo italyAddresses{ (italyStates), }; +// Mexico + +const auto mexicoCities = std::to_array({ + "Acapulco", + "Aguascalientes", + "Apizaco", + "Celaya", + "Chihuahua", + "Chilpancingo", + "Ciudad Juarez", + "Ciudad de Mexico", + "Colima", + "Cuernavaca", + "Culiacán", + "Delicias", + "Durango", + "Guadalajara", + "Guadalupe", + "Gomez Palacio", + "Hermosillo", + "Iguala", + "Irapuato", + "La Paz", + "León ato", + "Los Mochis", + "Mazatlán", + "Mérida", + "Mexicali", + "Minatitlán", + "Monterrey", + "Morelia", + "Nogales", + "Pachuca", + "Puebla", + "Puerto Vallarta", + "Querétaro", + "Reynosa", + "Rosarito", + "Saltillo", + "San Luis Potosí", + "San Nicolás de los Garza", + "San Pedro Garza García", + "Tapachula", + "Tepic", + "Tijuana", + "Toluca", + "Torreón", + "Tuxla Gutiérrez", + "Veracruz", + "Xalapa", + "Zacatecas", + "Zihuatanejo", +}); + +const auto mexicoStates = std::to_array({ + "Aguascalientes", + "Baja California", + "Baja California Sur", + "Campeche", + "Chiapas", + "Chihuahua", + "Coahuila", + "Colima", + "Durango", + "Guanajuato", + "Guerrero", + "Hidalgo", + "Jalisco", + "Ciudad de México (CDMX)", + "Michoacán", + "Morelos", + "Nayarit", + "Nuevo León", + "Oaxaca", + "Puebla", + "Querétaro", + "Quintana Roo", + "San Luis Potosí", + "Sinaloa", + "Sonora", + "Tabasco", + "Tamaulipas", + "Tlaxcala", + "Veracruz", + "Yucatán", + "Zacatecas", +}); + +const auto mexicoStreetNames = std::to_array({ + "Avenida Reforma", + "Avenida Insurgentes", + "Calle 5 de Febrero", + "Avenida Juárez", + "Calle Morelos", + "Calle Madero", + "Avenida de los Insurgentes", + "Avenida Zaragoza", + "Calle Hidalgo", + "Calle Prolongación Madero", + "Avenida Lázaro Cárdenas", + "Calle Benito Juárez", + "Calle Francisco I. Madero", + "Calle Pino Suárez", + "Avenida Tulum", + "Avenida México", + "Calle 16 de Septiembre", + "Calle Juárez", + "Avenida 20 de Noviembre", + "Calle Reforma", + "Avenida Veracruz", + "Calle Guerrero", + "Calle Oaxaca", + "Avenida 5 de Febrero", + "Avenida Constitución", + "Calle Lázaro Cárdenas", + "Calle Libertad", + "Calle Emiliano Zapata", + "Avenida Pino Suárez", + "Calle Ramon Ramirez", + "Avenida Independencia", +}); + +const auto mexicoStreetPrefixes = + std::to_array({ + "Calle", + "Avenida", + "Colonia", + "Paseo", + "Plaza", +}); + +const std::string_view mexicoZipCodeFormat{"#####"}; + +const auto mexicoAddressFormats = + std::to_array({ + "{street} {buildingNumber} {secondaryAddress}", + "{street} {buildingNumber})", +}); + +const auto mexicoSecondaryAddressFormats = std::to_array({ + "Piso. #", + "Apto. #", +}); + +const auto mexicoBuildingNumberFormats = std::to_array({ + "#", + "##", + "###", +}); + +const auto mexicoStreetFormats = + std::to_array({ + "{streetSuffix} {streetName}", +}); + +const auto mexicoCityFormats = std::to_array({ + "{cityName}", +}); + +const CountryAddressesInfo mexicoAddresses{ + mexicoZipCodeFormat, + (mexicoAddressFormats), + (mexicoSecondaryAddressFormats), + (mexicoStreetFormats), + {}, + {mexicoStreetNames}, + (mexicoStreetPrefixes), + (mexicoBuildingNumberFormats), + (mexicoCityFormats), + {}, + (mexicoCities), + {}, + (mexicoStates), +}; + // Poland const auto polandCities = std::to_array({ diff --git a/tests/modules/location_test.cpp b/tests/modules/location_test.cpp index 1bb32b7b..04fe3982 100644 --- a/tests/modules/location_test.cpp +++ b/tests/modules/location_test.cpp @@ -80,6 +80,8 @@ CountryAddressesInfo getAddresses(const Locale& locale) return portugalAddresses; case Locale::he_IL: return israelAddresses; + case Locale::es_MX: + return mexicoAddresses; default: return usaAddresses; } @@ -1102,4 +1104,20 @@ TEST_F(LocationTest, shouldGenerateIsraelStreetAddress) { return streetPrefix == generatedStreetPrefix; })); ASSERT_TRUE(std::ranges::any_of(israelStreetNames, [&generatedStreetName](const std::string_view& streetName) { return streetName == generatedStreetName; })); -} \ No newline at end of file +} + +TEST_F(LocationTest, shouldGenerateMexicoStreet) +{ + 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; })); +} + +TEST_F(LocationTest, shouldGenerateMexicoStreetAddress) +{ + const auto generatedStreetAddress = streetAddress(Locale::es_MX); + + ASSERT_TRUE(std::ranges::any_of(mexicoStreetNames, [&generatedStreetAddress](const std::string_view& streetName) + { return generatedStreetAddress.find(streetName) != std::string::npos; })); +}