Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions test/IXSocketTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,19 @@ TEST_CASE("socket", "[socket]")
testSocket(host, port, request, socket, expectedStatus, timeoutSecs);
}
#endif

TEST_CASE("isValidIpAddress") {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this works, I am not able to compile the test folder under windows. I also tried under Centos7 with build_linux.sh, but some files are missing. So, I don't know if I am supposed to build....

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to read the top level makefile.dev / enabling the test is done through a cmake option.

(this is for running things locally/manually on your end)

// 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"));
}
}