From 8ab2959f25d98b66aaee3766e8049dd92b58780a Mon Sep 17 00:00:00 2001 From: joshhn Date: Sat, 13 Jan 2024 17:25:40 -0600 Subject: [PATCH] fix test fail --- src/modules/location/LocationTest.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/modules/location/LocationTest.cpp b/src/modules/location/LocationTest.cpp index ed64db2e9..63a7ccdc6 100644 --- a/src/modules/location/LocationTest.cpp +++ b/src/modules/location/LocationTest.cpp @@ -640,13 +640,22 @@ TEST_F(LocationTest, shouldGenerateAustraliaStreetAddress) const auto& generatedBuildingNumber = generatedStreetAddressElements[0]; const auto& generatedStreetSuffix = - StringHelper::join({generatedStreetAddressElements.begin() + 2, generatedStreetAddressElements.end()}); + StringHelper::join({generatedStreetAddressElements.begin() + 1, generatedStreetAddressElements.end()}); + + std::vector firstNames{australianMalesFirstNames}; + firstNames.insert(firstNames.end(), australianFemalesFirstNames.begin(), australianFemalesFirstNames.end()); + + std::vector lastNames{australianLastNames}; - ASSERT_GE(generatedStreetAddressElements.size(), 3); ASSERT_TRUE(!generatedBuildingNumber.empty() && generatedBuildingNumber.size() <= 4); ASSERT_TRUE(checkIfAllCharactersAreNumeric(generatedBuildingNumber)); - ASSERT_TRUE(std::ranges::any_of(australiaStreetSuffixes, [&generatedStreetSuffix](const std::string& streetSuffix) - { return streetSuffix == generatedStreetSuffix; })); + + ASSERT_TRUE((std::ranges::any_of(firstNames, [&generatedStreetSuffix](const std::string& firstName) + { return generatedStreetSuffix.find(firstName) != std::string::npos; }) || + std::ranges::any_of(lastNames, [&generatedStreetSuffix](const std::string& lastName) + { return generatedStreetSuffix.find(lastName) != std::string::npos; })) && + std::ranges::any_of(australiaStreetSuffixes, [&generatedStreetSuffix](const std::string& streetSuffix) + { return generatedStreetSuffix.find(streetSuffix) != std::string::npos; })); } TEST_F(LocationTest, shouldGenerateIndiaStreet)