Owen Rudge : wsdapi/tests: Add tests for Get/SetPort.
Alexandre Julliard
julliard at winehq.org
Mon Jun 5 16:56:30 CDT 2017
Module: wine
Branch: master
Commit: d0291c272692896def11e65ac73b849a10739268
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d0291c272692896def11e65ac73b849a10739268
Author: Owen Rudge <orudge at codeweavers.com>
Date: Sat Jun 3 10:34:44 2017 +0100
wsdapi/tests: Add tests for Get/SetPort.
Signed-off-by: Owen Rudge <orudge at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wsdapi/tests/address.c | 49 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/dlls/wsdapi/tests/address.c b/dlls/wsdapi/tests/address.c
index c1bf3ba..74a1c12 100644
--- a/dlls/wsdapi/tests/address.c
+++ b/dlls/wsdapi/tests/address.c
@@ -132,12 +132,61 @@ static void GetSetTransportAddress_udp_tests(void)
ok(ret == 0, "WSACleanup failed: %d\n", ret);
}
+static void GetSetPort_udp_tests(void)
+{
+ IWSDUdpAddress *udpAddress = NULL;
+ WORD expectedPort1 = 12345;
+ WORD expectedPort2 = 8080;
+ WORD actualPort = 0;
+ HRESULT rc;
+ int ret;
+
+ rc = WSDCreateUdpAddress(&udpAddress);
+ ok(rc == S_OK, "WSDCreateUdpAddress(NULL, &udpAddress) failed: %08x\n", rc);
+ ok(udpAddress != NULL, "WSDCreateUdpAddress(NULL, &udpAddress) failed: udpAddress == NULL\n");
+
+ /* No test for GetPort(NULL) as this causes an access violation exception on Windows */
+
+ rc = IWSDUdpAddress_GetPort(udpAddress, &actualPort);
+ todo_wine ok(rc == S_OK, "GetPort returned unexpected result: %08x\n", rc);
+ ok(actualPort == 0, "GetPort returned unexpected port: %d\n", actualPort);
+
+ /* Try setting a zero port */
+ rc = IWSDUdpAddress_SetPort(udpAddress, 0);
+ todo_wine ok(rc == S_OK, "SetPort returned unexpected result: %08x\n", rc);
+
+ rc = IWSDUdpAddress_GetPort(udpAddress, &actualPort);
+ todo_wine ok(rc == S_OK, "GetPort returned unexpected result: %08x\n", rc);
+ ok(actualPort == 0, "GetPort returned unexpected port: %d\n", actualPort);
+
+ /* Set a real port */
+ rc = IWSDUdpAddress_SetPort(udpAddress, expectedPort1);
+ todo_wine ok(rc == S_OK, "SetPort returned unexpected result: %08x\n", rc);
+
+ rc = IWSDUdpAddress_GetPort(udpAddress, &actualPort);
+ todo_wine ok(rc == S_OK, "GetPort returned unexpected result: %08x\n", rc);
+ todo_wine ok(actualPort == expectedPort1, "GetPort returned unexpected port: %d\n", actualPort);
+
+ /* Now set a different port */
+ rc = IWSDUdpAddress_SetPort(udpAddress, expectedPort2);
+ todo_wine ok(rc == S_OK, "SetPort returned unexpected result: %08x\n", rc);
+
+ rc = IWSDUdpAddress_GetPort(udpAddress, &actualPort);
+ todo_wine ok(rc == S_OK, "GetPort returned unexpected result: %08x\n", rc);
+ todo_wine ok(actualPort == expectedPort2, "GetPort returned unexpected port: %d\n", actualPort);
+
+ /* Release the object */
+ ret = IWSDUdpAddress_Release(udpAddress);
+ ok(ret == 0, "IWSDUdpAddress_Release() has %d references, should have 0\n", ret);
+}
+
START_TEST(address)
{
CoInitialize(NULL);
CreateUdpAddress_tests();
GetSetTransportAddress_udp_tests();
+ GetSetPort_udp_tests();
CoUninitialize();
}
More information about the wine-cvs
mailing list