Avoid doing a real name resolution in sfIpAddress_fromString test

On some PCs, resolving `invalid address` will perform a real name
resolution using the network. This is slows down the test and risks
the test failing if the resolution succeeds.

Use `localhost` instead which shold return a known value, and add an
invalid ip address test for good measure.
This commit is contained in:
James Cowgill authored and Chris Thrasher committed 2025-02-16 10:23:08 -07:00
1 parent 82884b379f
commit f1e6cccb56
1 file changed
+2 -1
+2 -1
View File
@@ -22,7 +22,8 @@ TEST_CASE("[Network] sfIpAddress")
SECTION("sfIpAddress_fromString") SECTION("sfIpAddress_fromString")
{ {
CHECK(sfIpAddress_toInteger(sfIpAddress_fromString("")) == 0); CHECK(sfIpAddress_toInteger(sfIpAddress_fromString("")) == 0);
CHECK(sfIpAddress_toInteger(sfIpAddress_fromString("invalid address")) == 0); CHECK(sfIpAddress_toInteger(sfIpAddress_fromString("256.256.256.256")) == 0);
CHECK(sfIpAddress_toInteger(sfIpAddress_fromString("localhost")) == 0x7F000001);
CHECK(sfIpAddress_toInteger(sfIpAddress_fromString("192.168.0.1")) == 0xC0A80001); CHECK(sfIpAddress_toInteger(sfIpAddress_fromString("192.168.0.1")) == 0xC0A80001);
CHECK(sfIpAddress_toInteger(sfIpAddress_fromString("8.8.8.8")) == 0x08080808); CHECK(sfIpAddress_toInteger(sfIpAddress_fromString("8.8.8.8")) == 0x08080808);
} }