test: add uv_inet_ntop(AF_INET) coverage

Libuv had coverage for the AF_INET6 path but not the AF_INET path.
Now it does.

PR-URL: https://github.com/libuv/libuv/pull/2065
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This commit is contained in:
Ben Noordhuis 2018-12-03 09:29:23 +01:00
parent 5b64cc60b9
commit fe77e34cff

View File

@ -27,8 +27,13 @@
TEST_IMPL(ip4_addr) {
struct sockaddr_in addr;
char dst[16];
ASSERT(0 == uv_inet_ntop(AF_INET, "\xFF\xFF\xFF\xFF", dst, sizeof(dst)));
ASSERT(0 == strcmp(dst, "255.255.255.255"));
ASSERT(UV_ENOSPC == uv_inet_ntop(AF_INET, "\xFF\xFF\xFF\xFF",
dst, sizeof(dst) - 1));
ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr));
ASSERT(0 == uv_ip4_addr("255.255.255.255", TEST_PORT, &addr));