From f43a203e84a3372d25e7100125b3a1cd1a10fc97 Mon Sep 17 00:00:00 2001 From: Michal Cieslar Date: Thu, 27 Jun 2024 23:19:10 +0200 Subject: [PATCH] chore: remove county location function --- CHANGELOG.md | 6 + include/faker-cxx/Location.h | 337 +++++++++-------- src/modules/location/Location.cpp | 12 - src/modules/location/LocationData.h | 465 +++++++++++------------- tests/modules/location/LocationTest.cpp | 13 - 5 files changed, 380 insertions(+), 453 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d965c6cb..141b1ebb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file +## v2.1.0 (TBD) + +### ⚠ BREAKING CHANGES + +* removed `location.county` method + ## v2.0.0 (27.06.2024) ### ⚠ BREAKING CHANGES diff --git a/include/faker-cxx/Location.h b/include/faker-cxx/Location.h index 62c2d261..176c9b15 100644 --- a/include/faker-cxx/Location.h +++ b/include/faker-cxx/Location.h @@ -25,179 +25,166 @@ enum class AddressCountry Usa, }; - /** - * @brief Returns a random country name. - * - * @returns Country name. - * - * @code - * faker::location::country() // "Poland" - * @endcode - */ - std::string_view country(); - - /** - * @brief Returns a random country code. - * - * @returns Country code consisting two letters. - * - * @code - * faker::location::countryCode() // "PL" - * @endcode - */ - std::string_view countryCode(); - - /** - * @brief Returns a random state for a given country. - * - * @param country The country to generate state from. Defaults to `Country::Usa`. - * - * @returns State. - * - * @code - * faker::location::state() // "Arizona" - * @endcode - */ - std::string_view state(AddressCountry country = AddressCountry::Usa); - - /** - * @brief Returns a random county for a given country. - * - * @param country The country to generate county from. Defaults to `Country::Usa`. - * - * @returns County. - * - * @code - * faker::location::county() // "Adams County" - * @endcode - */ - std::string_view county(AddressCountry country = AddressCountry::Usa); - - /** - * @brief Returns a random city for given country. - * - * @param country The country to generate city from. Defaults to `Country::Usa`. - * - * @returns City. - * - * @code - * faker::location::city() // "Boston" - * @endcode - */ - std::string city(AddressCountry country = AddressCountry::Usa); - - /** - * @brief Returns a random zip code for given country. - * - * @param country The country to generate zip code from. Defaults to `Country::Usa`. - * - * @returns Zip code. - * - * @code - * faker::location::zipCode() // "47683-9880" - * faker::location::zipCode(Country::Poland) // "31-881" - * @endcode - */ - std::string zipCode(AddressCountry country = AddressCountry::Usa); - - /** - * @brief Returns a random street address for given country. - * - * @param country The country to generate street address from. Defaults to `Country::Usa`. - * - * @returns Street address including building number and street name. - * - * @code - * faker::location::streetAddress() // "34830 Erdman Hollow" - * @endcode - */ - std::string streetAddress(AddressCountry country = AddressCountry::Usa); - - /** - * @brief Returns a random street for given country. - * - * @param country The country to generate street from. Defaults to `Country::Usa`. - * - * @returns Street name. - * - * @code - * faker::location::street() // "Schroeder Isle" - * @endcode - */ - std::string street(AddressCountry country = AddressCountry::Usa); - - /** - * @brief Returns a random building number for given country. - * - * @param country The country to generate building number from. Defaults to `Country::Usa`. - * - * @returns Building number. - * - * @code - * faker::location::buildingNumber() // "505" - * @endcode - */ - std::string buildingNumber(AddressCountry country = AddressCountry::Usa); - - /** - * @brief Returns a random secondary address number for given country. - * This refers to a specific location at a given address such as an apartment or room number - * - * @param country The country to generate building number from. Defaults to `Country::Usa`. - * - * @returns Secondary address. - * - * @code - * faker::location::secondaryAddress() // "Apt. 861" - * @endcode - */ - std::string secondaryAddress(AddressCountry country = AddressCountry::Usa); - - /** - * @brief Generates a random latitude. - * - * @param precision The number of decimal points of precision for the latitude. Defaults to `Precision::FourDp`. - * - * @returns Latitude within -90 to 90 range. - * - * @code - * faker::location::latitude() // "-30.9501" - * @endcode - */ - std::string latitude(Precision precision = Precision::FourDp); - - /** - * @brief Generates a random longitude. - * - * @param precision The number of decimal points of precision for the longitude. Defaults to `Precision::FourDp`. - * - * @returns Longitude within -180 to 180 range. - * - * @code - * faker::location::longitude() // "-30.9501" - * @endcode - */ - std::string longitude(Precision precision = Precision::FourDp); - - /** - * @brief Generates a random direction from cardinal and ordinal directions. - * - * @returns Direction. - * - * @code - * faker::location::direction() // "North" - * @endcode - */ - std::string_view direction(); - - /** - * @brief Generates a random time zone. - * - * @returns Time zone. - * - * @code - * faker::location::timeZone() // "Europe/Warsaw" - * @endcode - */ - std::string_view timeZone(); +/** + * @brief Returns a random country name. + * + * @returns Country name. + * + * @code + * faker::location::country() // "Poland" + * @endcode + */ +std::string_view country(); + +/** + * @brief Returns a random country code. + * + * @returns Country code consisting two letters. + * + * @code + * faker::location::countryCode() // "PL" + * @endcode + */ +std::string_view countryCode(); + +/** + * @brief Returns a random state for a given country. + * + * @param country The country to generate state from. Defaults to `Country::Usa`. + * + * @returns State. + * + * @code + * faker::location::state() // "Arizona" + * @endcode + */ +std::string_view state(AddressCountry country = AddressCountry::Usa); + +/** + * @brief Returns a random city for given country. + * + * @param country The country to generate city from. Defaults to `Country::Usa`. + * + * @returns City. + * + * @code + * faker::location::city() // "Boston" + * @endcode + */ +std::string city(AddressCountry country = AddressCountry::Usa); + +/** + * @brief Returns a random zip code for given country. + * + * @param country The country to generate zip code from. Defaults to `Country::Usa`. + * + * @returns Zip code. + * + * @code + * faker::location::zipCode() // "47683-9880" + * faker::location::zipCode(Country::Poland) // "31-881" + * @endcode + */ +std::string zipCode(AddressCountry country = AddressCountry::Usa); + +/** + * @brief Returns a random street address for given country. + * + * @param country The country to generate street address from. Defaults to `Country::Usa`. + * + * @returns Street address including building number and street name. + * + * @code + * faker::location::streetAddress() // "34830 Erdman Hollow" + * @endcode + */ +std::string streetAddress(AddressCountry country = AddressCountry::Usa); + +/** + * @brief Returns a random street for given country. + * + * @param country The country to generate street from. Defaults to `Country::Usa`. + * + * @returns Street name. + * + * @code + * faker::location::street() // "Schroeder Isle" + * @endcode + */ +std::string street(AddressCountry country = AddressCountry::Usa); + +/** + * @brief Returns a random building number for given country. + * + * @param country The country to generate building number from. Defaults to `Country::Usa`. + * + * @returns Building number. + * + * @code + * faker::location::buildingNumber() // "505" + * @endcode + */ +std::string buildingNumber(AddressCountry country = AddressCountry::Usa); + +/** + * @brief Returns a random secondary address number for given country. + * This refers to a specific location at a given address such as an apartment or room number + * + * @param country The country to generate building number from. Defaults to `Country::Usa`. + * + * @returns Secondary address. + * + * @code + * faker::location::secondaryAddress() // "Apt. 861" + * @endcode + */ +std::string secondaryAddress(AddressCountry country = AddressCountry::Usa); + +/** + * @brief Generates a random latitude. + * + * @param precision The number of decimal points of precision for the latitude. Defaults to `Precision::FourDp`. + * + * @returns Latitude within -90 to 90 range. + * + * @code + * faker::location::latitude() // "-30.9501" + * @endcode + */ +std::string latitude(Precision precision = Precision::FourDp); + +/** + * @brief Generates a random longitude. + * + * @param precision The number of decimal points of precision for the longitude. Defaults to `Precision::FourDp`. + * + * @returns Longitude within -180 to 180 range. + * + * @code + * faker::location::longitude() // "-30.9501" + * @endcode + */ +std::string longitude(Precision precision = Precision::FourDp); + +/** + * @brief Generates a random direction from cardinal and ordinal directions. + * + * @returns Direction. + * + * @code + * faker::location::direction() // "North" + * @endcode + */ +std::string_view direction(); + +/** + * @brief Generates a random time zone. + * + * @returns Time zone. + * + * @code + * faker::location::timeZone() // "Europe/Warsaw" + * @endcode + */ +std::string_view timeZone(); } diff --git a/src/modules/location/Location.cpp b/src/modules/location/Location.cpp index 0ec943b5..5184c1c8 100644 --- a/src/modules/location/Location.cpp +++ b/src/modules/location/Location.cpp @@ -105,18 +105,6 @@ std::string_view countryCode() return helper::arrayElement(countryCodes); } -std::string_view county(AddressCountry country) -{ - const auto& countryAddresses = getAddresses(country); - - if (countryAddresses.counties.empty()) - { - return ""; - } - - return helper::arrayElement(countryAddresses.counties); -} - std::string_view state(AddressCountry country) { const auto& countryAddresses = getAddresses(country); diff --git a/src/modules/location/LocationData.h b/src/modules/location/LocationData.h index 9db28f42..145426e3 100644 --- a/src/modules/location/LocationData.h +++ b/src/modules/location/LocationData.h @@ -21,7 +21,6 @@ struct CountryAddressesInfo std::span cities; std::span citySuffixes; std::span states; - std::span counties; }; const auto allCountries = std::to_array({ @@ -360,7 +359,6 @@ const CountryAddressesInfo australiaAddresses{ (australiaCities), {}, (australiaStates), - {}, }; // Brazil @@ -422,7 +420,6 @@ const CountryAddressesInfo brazilAddresses{ {}, (brazilCitySuffixes), (brazilStates), - {}, }; // Czech Republic @@ -646,7 +643,6 @@ const CountryAddressesInfo czechAddresses{ (czechCities), {}, (czechStates), - {}, }; // Denmark @@ -778,20 +774,21 @@ const auto denmarkStreetFormats = std::to_array({"{streetName} const auto denmarkCityFormats = std::to_array({"{cityName}"}); -const CountryAddressesInfo denmarkAddresses{denmarkZipCodeFormat, - (denmarkAddressFormats), - (denmarkSecondaryAddressFormats), - (denmarkStreetFormats), - {}, - (denmarkStreetNames), - {}, - (denmarkBuildingNumberFormats), - (denmarkCityFormats), - {}, - (denmarkCities), - {}, - (denmarkStates), - {}}; +const CountryAddressesInfo denmarkAddresses{ + denmarkZipCodeFormat, + (denmarkAddressFormats), + (denmarkSecondaryAddressFormats), + (denmarkStreetFormats), + {}, + (denmarkStreetNames), + {}, + (denmarkBuildingNumberFormats), + (denmarkCityFormats), + {}, + (denmarkCities), + {}, + (denmarkStates), +}; // Estonia @@ -803,24 +800,6 @@ const auto estoniaCities = std::to_array({ "Kohtla-Järve", }); -const auto estoniaCounties = std::to_array({ - "Harju", - "Hiiu", - "Ida-Viru", - "Jõgeva", - "Järva", - "Lääne", - "Lääne-Viru", - "Põlva", - "Pärnu", - "Rapla", - "Saare", - "Tartu", - "Valga", - "Viljandi", - "Võru", -}); - const auto estoniaStreetNames = std::to_array({ "Laagna", "Punane", "Paepargi", "Pae", "Peterburi", "Valukoja", "Betooni", "Sõpruse", "Mustamäe", "Tuisu", "Külmallika", "Tammi", "Koore", "Kuubi", "Okka", "Vaba", @@ -848,20 +827,21 @@ const auto estoniaStreetFormats = std::to_array({"{streetName} const auto estoniaCityFormats = std::to_array({"{cityName}"}); -const CountryAddressesInfo estoniaAddresses{estoniaZipCodeFormat, - (estoniaAddressFormats), - {}, - (estoniaStreetFormats), - {}, - (estoniaStreetNames), - (estoniaStreetSuffixes), - (estoniaBuildingNumberFormats), - (estoniaCityFormats), - {}, - (estoniaCities), - {}, - {}, - (estoniaCounties)}; +const CountryAddressesInfo estoniaAddresses{ + estoniaZipCodeFormat, + (estoniaAddressFormats), + {}, + (estoniaStreetFormats), + {}, + (estoniaStreetNames), + (estoniaStreetSuffixes), + (estoniaBuildingNumberFormats), + (estoniaCityFormats), + {}, + (estoniaCities), + {}, + {}, +}; // Finland @@ -907,20 +887,21 @@ const auto finlandStreetFormats = const auto finlandCityFormats = std::to_array({"{cityName}"}); -const CountryAddressesInfo finlandAddresses{finlandZipCodeFormat, - (finlandAddressFormats), - (finlandSecondaryAddressFormats), - (finlandStreetFormats), - {}, - {}, - (finlandStreetSuffixes), - (finlandBuildingNumberFormats), - (finlandCityFormats), - {}, - (finlandCities), - {}, - (finlandStates), - {}}; +const CountryAddressesInfo finlandAddresses{ + finlandZipCodeFormat, + (finlandAddressFormats), + (finlandSecondaryAddressFormats), + (finlandStreetFormats), + {}, + {}, + (finlandStreetSuffixes), + (finlandBuildingNumberFormats), + (finlandCityFormats), + {}, + (finlandCities), + {}, + (finlandStates), +}; // France @@ -1061,20 +1042,21 @@ const auto franceStreetFormats = std::to_array({"{streetPrefix const auto franceCityFormats = std::to_array({"{cityName}"}); -const CountryAddressesInfo franceAddresses{franceZipCodeFormat, - (franceAddressFormats), - (franceSecondaryAddressFormats), - (franceStreetFormats), - (franceStreetPrefixes), - {}, - (franceStreetSuffixes), - (franceBuildingNumberFormats), - (franceCityFormats), - {}, - (franceCities), - {}, - (franceStates), - {}}; +const CountryAddressesInfo franceAddresses{ + franceZipCodeFormat, + (franceAddressFormats), + (franceSecondaryAddressFormats), + (franceStreetFormats), + (franceStreetPrefixes), + {}, + (franceStreetSuffixes), + (franceBuildingNumberFormats), + (franceCityFormats), + {}, + (franceCities), + {}, + (franceStates), +}; // Germany @@ -1228,20 +1210,21 @@ const auto germanyStreetFormats = std::to_array({"{streetName} const auto germanyCityFormats = std::to_array({"{cityName}"}); -const CountryAddressesInfo germanyAddresses{germanyZipCodeFormat, - (germanyAddressFormats), - (germanySecondaryAddressFormats), - (germanyStreetFormats), - {}, - (germanyStreetNames), - {}, - (germanyBuildingNumberFormats), - (germanyCityFormats), - {}, - (germanyCities), - {}, - (germanyStates), - {}}; +const CountryAddressesInfo germanyAddresses{ + germanyZipCodeFormat, + (germanyAddressFormats), + (germanySecondaryAddressFormats), + (germanyStreetFormats), + {}, + (germanyStreetNames), + {}, + (germanyBuildingNumberFormats), + (germanyCityFormats), + {}, + (germanyCities), + {}, + (germanyStates), +}; // India @@ -1340,20 +1323,21 @@ const auto indiaStreetFormats = const auto indiaCityFormats = std::to_array({"{cityName}"}); -const CountryAddressesInfo indiaAddresses{indiaZipCodeFormat, - (indiaAddressFormats), - (indiaSecondaryAddressFormats), - (indiaStreetFormats), - {}, - {}, - (indiaStreetSuffixes), - (indiaBuildingNumberFormats), - (indiaCityFormats), - {}, - (indiaCities), - {}, - (indiaStates), - {}}; +const CountryAddressesInfo indiaAddresses{ + indiaZipCodeFormat, + (indiaAddressFormats), + (indiaSecondaryAddressFormats), + (indiaStreetFormats), + {}, + {}, + (indiaStreetSuffixes), + (indiaBuildingNumberFormats), + (indiaCityFormats), + {}, + (indiaCities), + {}, + (indiaStates), +}; // Italy @@ -1480,20 +1464,21 @@ const auto italyStreetFormats = const auto italyCityFormats = std::to_array({"{cityName}"}); -const CountryAddressesInfo italyAddresses{italyZipCodeFormat, - (italyAddressFormats), - (italySecondaryAddressFormats), - (italyStreetFormats), - (italyStreetPrefixes), - {}, - {}, - (italyBuildingNumberFormats), - (italyCityFormats), - {}, - (italyCities), - {}, - (italyStates), - {}}; +const CountryAddressesInfo italyAddresses{ + italyZipCodeFormat, + (italyAddressFormats), + (italySecondaryAddressFormats), + (italyStreetFormats), + (italyStreetPrefixes), + {}, + {}, + (italyBuildingNumberFormats), + (italyCityFormats), + {}, + (italyCities), + {}, + (italyStates), +}; // Poland @@ -1699,20 +1684,21 @@ const auto polandStreetFormats = std::to_array({"{streetPrefix const auto polandCityFormats = std::to_array({"{cityName}"}); -const CountryAddressesInfo polandAddresses{polandZipCodeFormat, - (polandAddressFormats), - (polandSecondaryAddressFormats), - (polandStreetFormats), - (polandStreetPrefixes), - (polandStreetNames), - {}, - (polandBuildingNumberFormats), - (polandCityFormats), - {}, - (polandCities), - {}, - (polandStates), - {}}; +const CountryAddressesInfo polandAddresses{ + polandZipCodeFormat, + (polandAddressFormats), + (polandSecondaryAddressFormats), + (polandStreetFormats), + (polandStreetPrefixes), + (polandStreetNames), + {}, + (polandBuildingNumberFormats), + (polandCityFormats), + {}, + (polandCities), + {}, + (polandStates), +}; // Russia @@ -1849,81 +1835,62 @@ const auto russiaStreetFormats = std::to_array( const auto russiaCityFormats = std::to_array({"{cityName}"}); -const CountryAddressesInfo russiaAddresses{russiaZipCodeFormat, - (russiaAddressFormats), - (russiaSecondaryAddressFormats), - (russiaStreetFormats), - (russiaStreetPrefixes), - (russiaStreetNames), - {}, - (russiaBuildingNumberFormats), - (russiaCityFormats), - {}, - (russiaCities), - {}, - (russiaStates), - {}}; +const CountryAddressesInfo russiaAddresses{ + russiaZipCodeFormat, + (russiaAddressFormats), + (russiaSecondaryAddressFormats), + (russiaStreetFormats), + (russiaStreetPrefixes), + (russiaStreetNames), + {}, + (russiaBuildingNumberFormats), + (russiaCityFormats), + {}, + (russiaCities), + {}, + (russiaStates), +}; // Spain const auto spainCities = std::to_array({ // clang-format off - "Parla", "Ponferrada", "Mollet del Vallés", "Almería", - "Telde", "Zamora", "Puertollano", "San Sebastián", - "Baracaldo", "Alcalá de Guadaira", "Madrid", "Leganés", - "San Fernando", "Fuengirola", "Barcelona", "Santander", - "Torrevieja", "Mijas", "Valencia", "Burgos", - "Lugo", "Sanlúcar de Barrameda","Sevilla", "Castellón de la Plana", - "Santiago de Compostela","La Línea de la Concepción","Zaragoza", "Alcorcón", - "Gerona", "Majadahonda", "Málaga", "Albacete", - "Cáceres", "Sagunto", "Murcia", "Getafe", - "Lorca", "El Prat de LLobregat", "Palma de Mallorca", "Salamanca", - "Coslada", "Viladecans", "Las Palmas de Gran Canaria","Huelva", - "Talavera de la Reina", "Linares", "Bilbao", "Logroño", - "El Puerto de Santa María","Alcoy", "Córdoba", "Badajoz", - "Cornellá de Llobregat","Irún", "Alicante", "San Cristróbal de la Laguna", - "Avilés", "Estepona", "Valladolid", "León", - "Palencia", "Torremolinos", "Vigo", "Tarragona", - "Gecho", "Rivas-Vaciamadrid", "Gijón", "Cádiz", - "Orihuela", "Molina de Segura", "Hospitalet de LLobregat","Lérida", - "Pontevedra", "Paterna", "La Coruña", "Marbella", - "Pozuelo de Alarcón", "Granollers", "Granada", "Mataró", - "Toledo", "Santa Lucía de Tirajana","Vitoria", "Dos Hermanas", - "El Ejido", "Motril", "Elche", "Santa Coloma de Gramanet", - "Guadalajara", "Cerdañola del Vallés", "Santa Cruz de Tenerife","Jaén", - "Gandía", "Arrecife", "Oviedo", "Algeciras", - "Ceuta", "Segovia", "Badalona", "Torrejón de Ardoz", - "Ferrol", "Torrelavega", "Cartagena", "Orense", - "Chiclana de la Frontera","Elda", "Móstoles", "Alcobendas", - "Manresa", "Mérida", "Jerez de la Frontera", "Reus", - "Roquetas de Mar", "Ávila", "Tarrasa", "Calahorra", - "Ciudad Real", "Valdemoro", "Sabadell", "Inca", - "Rubí", "Cuenta", "Alcalá de Henares", "Aýna", - "Benidorm", "Collado Villalba", "Pamplona", + "Parla", "Ponferrada", "Mollet del Vallés", "Almería", + "Telde", "Zamora", "Puertollano", "San Sebastián", + "Baracaldo", "Alcalá de Guadaira", "Madrid", "Leganés", + "San Fernando", "Fuengirola", "Barcelona", "Santander", + "Torrevieja", "Mijas", "Valencia", "Burgos", + "Lugo", "Sanlúcar de Barrameda","Sevilla", "Castellón de la Plana", + "Santiago de Compostela","La Línea de la Concepción","Zaragoza", "Alcorcón", + "Gerona", "Majadahonda", "Málaga", "Albacete", + "Cáceres", "Sagunto", "Murcia", "Getafe", + "Lorca", "El Prat de LLobregat", "Palma de Mallorca", "Salamanca", + "Coslada", "Viladecans", "Las Palmas de Gran Canaria","Huelva", + "Talavera de la Reina", "Linares", "Bilbao", "Logroño", + "El Puerto de Santa María","Alcoy", "Córdoba", "Badajoz", + "Cornellá de Llobregat","Irún", "Alicante", "San Cristróbal de la Laguna", + "Avilés", "Estepona", "Valladolid", "León", + "Palencia", "Torremolinos", "Vigo", "Tarragona", + "Gecho", "Rivas-Vaciamadrid", "Gijón", "Cádiz", + "Orihuela", "Molina de Segura", "Hospitalet de LLobregat","Lérida", + "Pontevedra", "Paterna", "La Coruña", "Marbella", + "Pozuelo de Alarcón", "Granollers", "Granada", "Mataró", + "Toledo", "Santa Lucía de Tirajana","Vitoria", "Dos Hermanas", + "El Ejido", "Motril", "Elche", "Santa Coloma de Gramanet", + "Guadalajara", "Cerdañola del Vallés", "Santa Cruz de Tenerife","Jaén", + "Gandía", "Arrecife", "Oviedo", "Algeciras", + "Ceuta", "Segovia", "Badalona", "Torrejón de Ardoz", + "Ferrol", "Torrelavega", "Cartagena", "Orense", + "Chiclana de la Frontera","Elda", "Móstoles", "Alcobendas", + "Manresa", "Mérida", "Jerez de la Frontera", "Reus", + "Roquetas de Mar", "Ávila", "Tarrasa", "Calahorra", + "Ciudad Real", "Valdemoro", "Sabadell", "Inca", + "Rubí", "Cuenta", "Alcalá de Henares", "Aýna", + "Benidorm", "Collado Villalba", "Pamplona", "San Sebastían de los Reyes","Benalmádena", "Fuenlabrada", // clang-format on }); -const auto spainCounties = std::to_array({ - "Álava", "Albacete", "Alicante", - "Almería", "Asturias", "Ávila", - "Badajoz", "Barcelona", "Burgos", - "Cantabria", "Castellón", "Ciudad Real", - "Cuenca", "Cáceres", "Cádiz", - "Córdoba", "Gerona", "Granada", - "Guadalajara", "Guipúzcoa", "Huelva", - "Huesca", "Islas Baleares", "Jaén", - "La Coruña", "La Rioja", "Las Palmas", - "León", "Lugo", "lérida", - "Madrid", "Murcia", "Málaga", - "Navarra", "Orense", "Palencia", - "Pontevedra", "Salamanca", "Santa Cruz de Tenerife", - "Segovia", "Sevilla", "Soria", - "Tarragona", "Teruel", "Toledo", - "Valencia", "Valladolid", "Vizcaya", - "Zamora", "Zaragoza", -}); - const auto spainStates = std::to_array({ // clang-format off "Andalucía", "Cantabria", "Extremadura", "País Vasco", @@ -1962,20 +1929,21 @@ const auto spainStreetFormats = const auto spainCityFormats = std::to_array({"{cityName}"}); -const CountryAddressesInfo spainAddresses{spainZipCodeFormat, - (spainAddressFormats), - (spainSecondaryAddressFormats), - (spainStreetFormats), - {}, - {}, - (spainStreetSuffixes), - (spainBuildingNumberFormats), - (spainCityFormats), - {}, - (spainCities), - {}, - (spainStates), - (spainCounties)}; +const CountryAddressesInfo spainAddresses{ + spainZipCodeFormat, + (spainAddressFormats), + (spainSecondaryAddressFormats), + (spainStreetFormats), + {}, + {}, + (spainStreetSuffixes), + (spainBuildingNumberFormats), + (spainCityFormats), + {}, + (spainCities), + {}, + (spainStates), +}; // Ukraine @@ -2106,20 +2074,21 @@ const auto ukraineStreetFormats = std::to_array( const auto ukraineCityFormats = std::to_array({"{cityName}"}); -const CountryAddressesInfo ukraineAddresses{ukraineZipCodeFormat, - (ukraineAddressFormats), - (ukraineSecondaryAddressFormats), - (ukraineStreetFormats), - (ukraineStreetPrefixes), - (ukraineStreetNames), - {}, - (ukraineBuildingNumberFormats), - (ukraineCityFormats), - {}, - (ukraineCities), - {}, - (ukraineStates), - {}}; +const CountryAddressesInfo ukraineAddresses{ + ukraineZipCodeFormat, + (ukraineAddressFormats), + (ukraineSecondaryAddressFormats), + (ukraineStreetFormats), + (ukraineStreetPrefixes), + (ukraineStreetNames), + {}, + (ukraineBuildingNumberFormats), + (ukraineCityFormats), + {}, + (ukraineCities), + {}, + (ukraineStates), +}; // USA @@ -2251,17 +2220,6 @@ const auto usaCities = std::to_array({ // clang-format on }); -const auto usaCounties = std::to_array({ - "Adams County", "Calhoun County", "Carroll County", "Clark County", "Clay County", - "Crawford County", "Douglas County", "Fayette County", "Franklin County", "Grant County", - "Greene County", "Hamilton County", "Hancock County", "Henry County", "Jackson County", - "Jefferson County", "Johnson County", "Lake County", "Lawrence County", "Lee County", - "Lincoln County", "Logan County", "Madison County", "Marion County", "Marshall County", - "Monroe County", "Montgomery County", "Morgan County", "Perry County", "Pike County", - "Polk County", "Scott County", "Union County", "Warren County", "Washington County", - "Wayne County", -}); - const auto usaStates = std::to_array( {"Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", @@ -2312,19 +2270,20 @@ const auto usaStreetFormats = const auto usaCityFormats = std::to_array({"{cityName}"}); -const CountryAddressesInfo usaAddresses{usaZipCodeFormat, - (usaAddressFormats), - (usaSecondaryAddressFormats), - (usaStreetFormats), - {}, - {}, - (usaStreetSuffixes), - (usaBuildingNumberFormats), - (usaCityFormats), - {}, - (usaCities), - {}, - usaStates, - usaCounties}; +const CountryAddressesInfo usaAddresses{ + usaZipCodeFormat, + (usaAddressFormats), + (usaSecondaryAddressFormats), + (usaStreetFormats), + {}, + {}, + (usaStreetSuffixes), + (usaBuildingNumberFormats), + (usaCityFormats), + {}, + (usaCities), + {}, + usaStates, +}; } diff --git a/tests/modules/location/LocationTest.cpp b/tests/modules/location/LocationTest.cpp index 3fdc140a..0ef70a8c 100644 --- a/tests/modules/location/LocationTest.cpp +++ b/tests/modules/location/LocationTest.cpp @@ -119,19 +119,6 @@ class LocationTest : public TestWithParam } }; -TEST_P(LocationTest, shouldGenerateCounty) -{ - const auto country = GetParam(); - - const auto& countryAddresses = getAddresses(country); - - const auto generatedCounty = county(country); - - ASSERT_TRUE(std::ranges::any_of(countryAddresses.counties, [&generatedCounty](const std::string_view& county) - { return county == generatedCounty; }) || - (countryAddresses.counties.empty() && generatedCounty.empty())); -} - TEST_P(LocationTest, shouldGenerateState) { const auto country = GetParam();