Skip to content

Commit

Permalink
Let tests succeed even if nullopt is returned
Browse files Browse the repository at this point in the history
This is the desire behavior when the network fails so we can't
just fail the test when this happens.
ChrisThrasher authored and vittorioromeo committed Sep 12, 2022
1 parent 105ff68 commit b94df9e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/Network/IpAddress.cpp
Original file line number Diff line number Diff line change
@@ -72,9 +72,11 @@ TEST_CASE("sf::IpAddress class - [network]")
SUBCASE("getPublicAddress")
{
const std::optional<sf::IpAddress> ipAddress = sf::IpAddress::getPublicAddress(sf::seconds(1));
REQUIRE(ipAddress.has_value());
CHECK(ipAddress->toString() != "0.0.0.0");
CHECK(ipAddress->toInteger() != 0);
if (ipAddress.has_value())
{
CHECK(ipAddress->toString() != "0.0.0.0");
CHECK(ipAddress->toInteger() != 0);
}
}
}

0 comments on commit b94df9e

Please sign in to comment.