add test for the new function isValidIpAddress
This commit is contained in:
parent
7528b0a9d7
commit
2e2a255a9d
@ -95,4 +95,19 @@ TEST_CASE("socket", "[socket]")
|
|||||||
testSocket(host, port, request, socket, expectedStatus, timeoutSecs);
|
testSocket(host, port, request, socket, expectedStatus, timeoutSecs);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
TEST_CASE("isValidIpAddress") {
|
||||||
|
// Valid IPv4 addresses
|
||||||
|
CHECK(isValidIpAddress("127.0.0.1"));
|
||||||
|
CHECK(isValidIpAddress("192.168.0.1"));
|
||||||
|
CHECK(isValidIpAddress("10.0.0.1"));
|
||||||
|
CHECK(isValidIpAddress("172.16.0.1"));
|
||||||
|
|
||||||
|
// Invalid IPv4 addresses
|
||||||
|
CHECK(!isValidIpAddress("256.0.0.1"));
|
||||||
|
CHECK(!isValidIpAddress("1.2.3.4.5"));
|
||||||
|
CHECK(!isValidIpAddress("192.168.0."));
|
||||||
|
CHECK(!isValidIpAddress("192.168.0.-1"));
|
||||||
|
CHECK(!isValidIpAddress("192.168.0.256"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user