Time out test for public IP address

On poor network connections, the call to getPublicAddress may hang
indefinitely. If it is to succeed, let's require that it succeed
within a reasonable time frame to put an upper limit on how long
this test takes to run.
This commit is contained in:
Chris Thrasher 2022-09-12 13:01:33 -06:00 committed by Vittorio Romeo
parent e294090c8e
commit 105ff68a6a

View File

@ -71,7 +71,7 @@ TEST_CASE("sf::IpAddress class - [network]")
SUBCASE("getPublicAddress")
{
const std::optional<sf::IpAddress> ipAddress = sf::IpAddress::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);