Skip to content

Commit

Permalink
fix: Improve test to allow multiple word street names and added cover…
Browse files Browse the repository at this point in the history
…age for suffixes
  • Loading branch information
dkorecko committed Oct 4, 2024
1 parent 66688b0 commit 17a9c30
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions tests/modules/location_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -883,11 +883,23 @@ TEST_F(LocationTest, shouldGenerateSlovakiaStreetAddress)
{
const auto generatedStreetAddress = streetAddress(Locale::sk_SK);

const auto generatedStreetAddressElements = common::split(generatedStreetAddress, " ");
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];

const auto& generatedStreet = generatedStreetAddressElements[0];
const auto& generatedStreetSuffix = generatedStreetAddressElements[1];
const auto& generatedBuildingNumber = generatedStreetAddressElements[2];
ASSERT_TRUE(generatedUnitNumber.size() == 1 || generatedUnitNumber.size() == 3);
ASSERT_TRUE(checkIfAllCharactersAreNumeric(generatedUnitNumber));
}

ASSERT_TRUE(generatedBuildingNumber.size() >= 1 && generatedBuildingNumber.size() <= 3);
ASSERT_TRUE(checkIfAllCharactersAreNumeric(generatedBuildingNumber));
Expand Down

0 comments on commit 17a9c30

Please sign in to comment.