From b94df9e0d82597539b78dbf214dd000908784dc6 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Mon, 12 Sep 2022 13:04:57 -0600 Subject: [PATCH] Let tests succeed even if nullopt is returned This is the desire behavior when the network fails so we can't just fail the test when this happens. --- test/Network/IpAddress.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/Network/IpAddress.cpp b/test/Network/IpAddress.cpp index 07b3d0972..347c9aa42 100644 --- a/test/Network/IpAddress.cpp +++ b/test/Network/IpAddress.cpp @@ -72,9 +72,11 @@ TEST_CASE("sf::IpAddress class - [network]") SUBCASE("getPublicAddress") { const std::optional 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); + } } }