ws2_32/tests: Use winetest_push_context() in test_inet_pton().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2022-02-10 21:29:45 -06:00 committed by Alexandre Julliard
parent c8c9508267
commit 9856049a5b
1 changed files with 22 additions and 22 deletions

View File

@ -952,29 +952,29 @@ static void test_inet_pton(void)
WCHAR inputW[32]; WCHAR inputW[32];
DWORD addr; DWORD addr;
winetest_push_context( "Address %s", debugstr_a(ipv4_tests[i].input) );
WSASetLastError(0xdeadbeef); WSASetLastError(0xdeadbeef);
addr = 0xdeadbeef; addr = 0xdeadbeef;
ret = p_inet_pton(AF_INET, ipv4_tests[i].input, &addr); ret = p_inet_pton(AF_INET, ipv4_tests[i].input, &addr);
ok(ret == ipv4_tests[i].ret, "%s: got %d\n", debugstr_a(ipv4_tests[i].input), ret); ok(ret == ipv4_tests[i].ret, "got %d\n", ret);
ok(WSAGetLastError() == 0xdeadbeef, "%s: got error %u\n", ok(WSAGetLastError() == 0xdeadbeef, "got error %u\n", WSAGetLastError());
debugstr_a(ipv4_tests[i].input), WSAGetLastError()); ok(addr == ipv4_tests[i].addr, "got addr %#08x\n", addr);
ok(addr == ipv4_tests[i].addr, "%s: got addr %#08x\n", debugstr_a(ipv4_tests[i].input), addr);
MultiByteToWideChar(CP_ACP, 0, ipv4_tests[i].input, -1, inputW, ARRAY_SIZE(inputW)); MultiByteToWideChar(CP_ACP, 0, ipv4_tests[i].input, -1, inputW, ARRAY_SIZE(inputW));
WSASetLastError(0xdeadbeef); WSASetLastError(0xdeadbeef);
addr = 0xdeadbeef; addr = 0xdeadbeef;
ret = pInetPtonW(AF_INET, inputW, &addr); ret = pInetPtonW(AF_INET, inputW, &addr);
ok(ret == ipv4_tests[i].ret, "%s: got %d\n", debugstr_a(ipv4_tests[i].input), ret); ok(ret == ipv4_tests[i].ret, "got %d\n", ret);
ok(WSAGetLastError() == (ret ? 0xdeadbeef : WSAEINVAL), "%s: got error %u\n", ok(WSAGetLastError() == (ret ? 0xdeadbeef : WSAEINVAL), "got error %u\n", WSAGetLastError());
debugstr_a(ipv4_tests[i].input), WSAGetLastError()); ok(addr == ipv4_tests[i].addr, "got addr %#08x\n", addr);
ok(addr == ipv4_tests[i].addr, "%s: got addr %#08x\n", debugstr_a(ipv4_tests[i].input), addr);
WSASetLastError(0xdeadbeef); WSASetLastError(0xdeadbeef);
addr = inet_addr(ipv4_tests[i].input); addr = inet_addr(ipv4_tests[i].input);
ok(addr == ipv4_tests[i].ret ? ipv4_tests[i].addr : INADDR_NONE, ok(addr == ipv4_tests[i].ret ? ipv4_tests[i].addr : INADDR_NONE, "got addr %#08x\n", addr);
"%s: got addr %#08x\n", debugstr_a(ipv4_tests[i].input), addr); ok(WSAGetLastError() == 0xdeadbeef, "got error %u\n", WSAGetLastError());
ok(WSAGetLastError() == 0xdeadbeef, "%s: got error %u\n",
debugstr_a(ipv4_tests[i].input), WSAGetLastError()); winetest_pop_context();
} }
for (i = 0; i < ARRAY_SIZE(ipv6_tests); ++i) for (i = 0; i < ARRAY_SIZE(ipv6_tests); ++i)
@ -982,24 +982,24 @@ static void test_inet_pton(void)
unsigned short addr[8]; unsigned short addr[8];
WCHAR inputW[64]; WCHAR inputW[64];
winetest_push_context( "Address %s", debugstr_a(ipv6_tests[i].input) );
WSASetLastError(0xdeadbeef); WSASetLastError(0xdeadbeef);
memset(addr, 0xab, sizeof(addr)); memset(addr, 0xab, sizeof(addr));
ret = p_inet_pton(AF_INET6, ipv6_tests[i].input, addr); ret = p_inet_pton(AF_INET6, ipv6_tests[i].input, addr);
ok(ret == ipv6_tests[i].ret, "%s: got %d\n", debugstr_a(ipv6_tests[i].input), ret); ok(ret == ipv6_tests[i].ret, "got %d\n", ret);
ok(WSAGetLastError() == 0xdeadbeef, "%s: got error %u\n", ok(WSAGetLastError() == 0xdeadbeef, "got error %u\n", WSAGetLastError());
debugstr_a(ipv6_tests[i].input), WSAGetLastError()); ok(!memcmp(addr, ipv6_tests[i].addr, sizeof(addr)), "address didn't match\n");
ok(!memcmp(addr, ipv6_tests[i].addr, sizeof(addr)),
"%s: address didn't match\n", debugstr_a(ipv6_tests[i].input));
MultiByteToWideChar(CP_ACP, 0, ipv6_tests[i].input, -1, inputW, ARRAY_SIZE(inputW)); MultiByteToWideChar(CP_ACP, 0, ipv6_tests[i].input, -1, inputW, ARRAY_SIZE(inputW));
WSASetLastError(0xdeadbeef); WSASetLastError(0xdeadbeef);
memset(addr, 0xab, sizeof(addr)); memset(addr, 0xab, sizeof(addr));
ret = pInetPtonW(AF_INET6, inputW, addr); ret = pInetPtonW(AF_INET6, inputW, addr);
ok(ret == ipv6_tests[i].ret, "%s: got %d\n", debugstr_a(ipv6_tests[i].input), ret); ok(ret == ipv6_tests[i].ret, "got %d\n", ret);
ok(WSAGetLastError() == (ret ? 0xdeadbeef : WSAEINVAL), "%s: got error %u\n", ok(WSAGetLastError() == (ret ? 0xdeadbeef : WSAEINVAL), "got error %u\n", WSAGetLastError());
debugstr_a(ipv6_tests[i].input), WSAGetLastError()); ok(!memcmp(addr, ipv6_tests[i].addr, sizeof(addr)), "address didn't match\n");
ok(!memcmp(addr, ipv6_tests[i].addr, sizeof(addr)),
"%s: address didn't match\n", debugstr_a(ipv6_tests[i].input)); winetest_pop_context();
} }
} }