diff --git a/tests/modules/location_test.cpp b/tests/modules/location_test.cpp index 92f68718..0397cbbc 100644 --- a/tests/modules/location_test.cpp +++ b/tests/modules/location_test.cpp @@ -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));