Skip to content

Commit

Permalink
fix: location_test.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
tskxz committed Oct 23, 2024
1 parent 3b912f5 commit 01c12ab
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions tests/modules/location_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1027,11 +1027,21 @@ TEST_F(LocationTest, shouldGeneratePortugalStreetAddress)
{
const auto generatedStreetAddress = streetAddress(Locale::pt_PT);

const auto generatedStreetAddressElements = common::split(generatedStreetAddress, " ");
const auto generatedStreetAddressElements = common::split(generatedStreetAddress[0], " ");

const auto& generatedBuildNumber = 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& generatedStreet = generatedStreetAddressElements[0];
const auto& generatedStreetSuffix = generatedStreetAddressElements[1];
const auto& generatedBuildingNumber = generatedStreetAddressElements[2];
const auto& generatedUnitNumber = generatedSecondaryAddressParts[generatedSecondaryAddressParts.size()-1];

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 All @@ -1041,4 +1051,4 @@ TEST_F(LocationTest, shouldGeneratePortugalStreetAddress)

ASSERT_TRUE(std::ranges::any_of(portugalStreetSuffixes, [&generatedStreetSuffix](const std::string_view& streetSuffix)
{ return generatedStreetSuffix.find(streetSuffix) != std::string::npos; }));
}
}

0 comments on commit 01c12ab

Please sign in to comment.