Commit 0c723b7d authored by Owen Rudge's avatar Owen Rudge Committed by Alexandre Julliard

wsdapi/tests: Use wide character string literals.

parent 683cdf55
......@@ -77,11 +77,9 @@ static void CreateUdpAddress_tests(void)
static void GetSetTransportAddress_udp_tests(void)
{
IWSDUdpAddress *udpAddress = NULL;
const WCHAR ipv4Address[] = {'1','0','.','2','0','.','3','0','.','4','0',0};
const WCHAR ipv6Address[] = {'a','a','b','b',':','c','d',':',':','a','b','c',0};
const WCHAR ipv4AddressWithPort[] = {'1','0','.','2','0','.','3','0','.','4','0',':','1','2','4',0};
const WCHAR ipv6AddressWithPort[] = {'[','a','a','b','b',':','c','d',':',':','a','b','c',':','5','6','7',']',':','1','2','4',0};
const WCHAR invalidAddress[] = {'n','o','t','/','v','a','l','i','d',0};
const WCHAR *ipv4Address = L"10.20.30.40";
const WCHAR *ipv6Address = L"aabb:cd::abc";
const WCHAR *ipv6AddressWithPort = L"[aabb:cd::abc:567]:124";
LPCWSTR returnedAddress = NULL;
WSADATA wsaData;
HRESULT rc;
......@@ -103,7 +101,7 @@ static void GetSetTransportAddress_udp_tests(void)
ok(rc == E_INVALIDARG, "SetTransportAddress(NULL) returned unexpected result: %08x\n", rc);
/* Try setting an invalid address */
rc = IWSDUdpAddress_SetTransportAddress(udpAddress, invalidAddress);
rc = IWSDUdpAddress_SetTransportAddress(udpAddress, L"not/valid");
ok(rc == HRESULT_FROM_WIN32(WSAHOST_NOT_FOUND), "SetTransportAddress(invalidAddress) returned unexpected result: %08x\n", rc);
/* Try setting an IPv4 address */
......@@ -119,7 +117,7 @@ static void GetSetTransportAddress_udp_tests(void)
ok(lstrcmpW(returnedAddress, ipv4Address) == 0, "Returned address != ipv4Address (%s)\n", wine_dbgstr_w(returnedAddress));
/* Try setting an IPv4 address with a port number */
rc = IWSDUdpAddress_SetTransportAddress(udpAddress, ipv4AddressWithPort);
rc = IWSDUdpAddress_SetTransportAddress(udpAddress, L"10.20.30.40:124");
ok(rc == HRESULT_FROM_WIN32(WSAHOST_NOT_FOUND), "SetTransportAddress(ipv4Address) failed: %08x\n", rc);
/* Try setting an IPv6 address */
......@@ -254,15 +252,10 @@ static void GetSetSockaddr_udp_tests(void)
const char *ipv4Address = "1.2.3.4";
const short ipv4Port = 1234;
const WCHAR expectedIpv4TransportAddr[] = {'1','.','2','.','3','.','4',':','1','2','3','4',0};
const WCHAR expectedIpv4TransportAddrNoPort[] = {'1','.','2','.','3','.','4',0};
const char *ipv6Address = "2a00:1234:5678:dead:beef::aaaa";
const short ipv6Port = 2345;
const WCHAR expectedIpv6TransportAddr[] = {'[','2','a','0','0',':','1','2','3','4',':','5','6','7','8',':','d','e','a','d',':',
'b','e','e','f',':',':','a','a','a','a',']',':','2','3','4','5',0};
const WCHAR expectedIpv6TransportAddrNoPort[] = {'2','a','0','0',':','1','2','3','4',':','5','6','7','8',':','d','e','a','d',':',
'b','e','e','f',':',':','a','a','a','a',0};
const WCHAR *expectedIpv6TransportAddr = L"[2a00:1234:5678:dead:beef::aaaa]:2345";
ZeroMemory(&storage1, sizeof(SOCKADDR_STORAGE));
ZeroMemory(&storage2, sizeof(SOCKADDR_STORAGE));
......@@ -328,7 +321,7 @@ static void GetSetSockaddr_udp_tests(void)
rc = IWSDUdpAddress_GetTransportAddress(udpAddress, &returnedAddress);
ok(rc == S_OK, "GetTransportAddress failed: %08x\n", rc);
ok(returnedAddress != NULL, "GetTransportAddress returned unexpected address: %p\n", returnedAddress);
ok(lstrcmpW(returnedAddress, expectedIpv4TransportAddr) == 0, "GetTransportAddress returned unexpected address: %s\n", wine_dbgstr_w(returnedAddress));
ok(lstrcmpW(returnedAddress, L"1.2.3.4:1234") == 0, "GetTransportAddress returned unexpected address: %s\n", wine_dbgstr_w(returnedAddress));
/* Check that GetPort doesn't return the port set via the socket */
rc = IWSDUdpAddress_GetPort(udpAddress, &port);
......@@ -345,7 +338,7 @@ static void GetSetSockaddr_udp_tests(void)
rc = IWSDUdpAddress_GetTransportAddress(udpAddress, &returnedAddress);
ok(rc == S_OK, "GetTransportAddress failed: %08x\n", rc);
ok(returnedAddress != NULL, "GetTransportAddress returned unexpected address: %p\n", returnedAddress);
ok(lstrcmpW(returnedAddress, expectedIpv4TransportAddrNoPort) == 0, "GetTransportAddress returned unexpected address: %s\n", wine_dbgstr_w(returnedAddress));
ok(lstrcmpW(returnedAddress, L"1.2.3.4") == 0, "GetTransportAddress returned unexpected address: %s\n", wine_dbgstr_w(returnedAddress));
/* Try setting an IPv6 address */
sockAddr6Ptr = (struct sockaddr_in6 *) &storage2;
......@@ -385,7 +378,7 @@ static void GetSetSockaddr_udp_tests(void)
rc = IWSDUdpAddress_GetTransportAddress(udpAddress, &returnedAddress);
ok(rc == S_OK, "GetTransportAddress failed: %08x\n", rc);
ok(returnedAddress != NULL, "GetTransportAddress returned unexpected address: %p\n", returnedAddress);
ok(lstrcmpW(returnedAddress, expectedIpv6TransportAddrNoPort) == 0, "GetTransportAddress returned unexpected address: %s\n", wine_dbgstr_w(returnedAddress));
ok(lstrcmpW(returnedAddress, L"2a00:1234:5678:dead:beef::aaaa") == 0, "GetTransportAddress returned unexpected address: %s\n", wine_dbgstr_w(returnedAddress));
rc = IWSDUdpAddress_SetSockaddr(udpAddress, &storage2);
ok(rc == S_OK, "SetSockaddr returned unexpected result: %08x\n", rc);
......
......@@ -71,7 +71,6 @@ static void LocalAddress_tests(void)
IWSDUdpAddress *origUdpAddress = NULL;
IWSDAddress *returnedAddress = NULL;
IWSDUdpMessageParameters *udpMessageParams = NULL;
WCHAR address[] = {'1','.','2','.','3','.','4',0};
WSADATA wsaData;
HRESULT rc;
int ret;
......@@ -95,7 +94,7 @@ static void LocalAddress_tests(void)
ok(rc == S_OK, "WSDCreateUdpAddress(NULL, &origUdpAddress) failed: %08x\n", rc);
ok(origUdpAddress != NULL, "WSDCreateUdpMessageParameters(NULL, &origUdpAddress) failed: origUdpAddress == NULL\n");
rc = IWSDUdpAddress_SetTransportAddress(origUdpAddress, address);
rc = IWSDUdpAddress_SetTransportAddress(origUdpAddress, L"1.2.3.4");
ok(rc == S_OK, "SetTransportAddress failed: %08x\n", rc);
rc = IWSDUdpMessageParameters_SetLocalAddress(udpMessageParams, (IWSDAddress *)origUdpAddress);
......@@ -129,7 +128,6 @@ static void RemoteAddress_tests(void)
IWSDUdpAddress *origUdpAddress = NULL;
IWSDAddress *returnedAddress = NULL;
IWSDUdpMessageParameters *udpMessageParams = NULL;
WCHAR address[] = {'1','.','2','.','3','.','4',0};
WSADATA wsaData;
HRESULT rc;
int ret;
......@@ -153,7 +151,7 @@ static void RemoteAddress_tests(void)
ok(rc == S_OK, "WSDCreateUdpAddress(NULL, &origUdpAddress) failed: %08x\n", rc);
ok(origUdpAddress != NULL, "WSDCreateUdpMessageParameters(NULL, &origUdpAddress) failed: origUdpAddress == NULL\n");
rc = IWSDUdpAddress_SetTransportAddress(origUdpAddress, address);
rc = IWSDUdpAddress_SetTransportAddress(origUdpAddress, L"1.2.3.4");
ok(rc == S_OK, "SetTransportAddress failed: %08x\n", rc);
rc = IWSDUdpMessageParameters_SetRemoteAddress(udpMessageParams, (IWSDAddress *)origUdpAddress);
......
......@@ -34,17 +34,14 @@ static void BuildAnyForSingleElement_tests(void)
WSDXML_ELEMENT *element;
WSDXML_NAME name;
WSDXML_NAMESPACE ns;
WCHAR nameText[] = {'E','l','1',0};
static const WCHAR text[] = {'H','e','l','l','o',0};
static const WCHAR uri[] = {'h','t','t','p',':','/','/','t','e','s','t','.','t','e','s','t','/',0};
static const WCHAR prefix[] = {'t',0};
static const WCHAR *text = L"Hello";
HRESULT hr;
/* Populate structures */
ns.Uri = uri;
ns.PreferredPrefix = prefix;
ns.Uri = L"http://test.test/";
ns.PreferredPrefix = L"t";
name.LocalName = nameText;
name.LocalName = (WCHAR *) L"El1";
name.Space = &ns;
/* Test invalid arguments */
......@@ -106,11 +103,7 @@ static void AddChild_tests(void)
WSDXML_ELEMENT *parent, *child1, *child2;
WSDXML_NAME parentName, child1Name, child2Name;
WSDXML_NAMESPACE ns;
WCHAR parentNameText[] = {'D','a','d',0};
WCHAR child1NameText[] = {'T','i','m',0};
WCHAR child2NameText[] = {'B','o','b',0};
static const WCHAR uri[] = {'h','t','t','p',':','/','/','t','e','s','t','.','t','e','s','t','/',0};
static const WCHAR prefix[] = {'t',0};
static const WCHAR *child1NameText = L"Tim";
HRESULT hr;
/* Test invalid values */
......@@ -118,16 +111,16 @@ static void AddChild_tests(void)
ok(hr == E_INVALIDARG, "WSDXMLAddChild failed with %08x\n", hr);
/* Populate structures */
ns.Uri = uri;
ns.PreferredPrefix = prefix;
ns.Uri = L"http://test.test/";
ns.PreferredPrefix = L"t";
parentName.LocalName = parentNameText;
parentName.LocalName = (WCHAR *) L"Dad";
parentName.Space = &ns;
child1Name.LocalName = child1NameText;
child1Name.LocalName = (WCHAR *) child1NameText;
child1Name.Space = &ns;
child2Name.LocalName = child2NameText;
child2Name.LocalName = (WCHAR *) L"Bob";
child2Name.Space = &ns;
/* Create some elements */
......@@ -191,11 +184,7 @@ static void AddSibling_tests(void)
WSDXML_ELEMENT *parent, *child1, *child2, *child3;
WSDXML_NAME parentName, child1Name, child2Name;
WSDXML_NAMESPACE ns;
WCHAR parentNameText[] = {'D','a','d',0};
WCHAR child1NameText[] = {'T','i','m',0};
WCHAR child2NameText[] = {'B','o','b',0};
static const WCHAR uri[] = {'h','t','t','p',':','/','/','t','e','s','t','.','t','e','s','t','/',0};
static const WCHAR prefix[] = {'t',0};
static const WCHAR *child1NameText = L"Tim";
HRESULT hr;
/* Test invalid values */
......@@ -203,16 +192,16 @@ static void AddSibling_tests(void)
ok(hr == E_INVALIDARG, "WSDXMLAddSibling failed with %08x\n", hr);
/* Populate structures */
ns.Uri = uri;
ns.PreferredPrefix = prefix;
ns.Uri = L"http://test.test/";
ns.PreferredPrefix = L"t";
parentName.LocalName = parentNameText;
parentName.LocalName = (WCHAR *) L"Dad";
parentName.Space = &ns;
child1Name.LocalName = child1NameText;
child1Name.LocalName = (WCHAR *) child1NameText;
child1Name.Space = &ns;
child2Name.LocalName = child2NameText;
child2Name.LocalName = (WCHAR *) L"Bob";
child2Name.Space = &ns;
/* Create some elements */
......@@ -273,36 +262,33 @@ static void GetValueFromAny_tests(void)
WSDXML_ELEMENT *parent, *child1, *child2, *child3;
WSDXML_NAME parentName, child1Name, child2Name, child3Name;
WSDXML_NAMESPACE ns, ns2;
WCHAR parentNameText[] = {'D','a','d',0};
WCHAR child1NameText[] = {'T','i','m',0};
WCHAR child2NameText[] = {'B','o','b',0};
WCHAR child3NameText[] = {'J','o','e',0};
static const WCHAR child1Value[] = {'V','1',0};
static const WCHAR child2Value[] = {'V','2',0};
static const WCHAR uri[] = {'h','t','t','p',':','/','/','t','e','s','t','.','t','e','s','t','/',0};
static const WCHAR uri2[] = {'h','t','t','p',':','/','/','t','e','s','t','2','.','t','e','s','t','/',0};
static const WCHAR prefix[] = {'t',0};
static const WCHAR prefix2[] = {'u',0};
static const WCHAR *child1NameText = L"Tim";
static const WCHAR *child2NameText = L"Bob";
static const WCHAR *child3NameText = L"Joe";
static const WCHAR *child1Value = L"V1";
static const WCHAR *child2Value = L"V2";
static const WCHAR *uri = L"http://test.test/";
static const WCHAR *uri2 = L"http://test2.test/";
LPCWSTR returnedValue = NULL, oldReturnedValue;
HRESULT hr;
/* Populate structures */
ns.Uri = uri;
ns.PreferredPrefix = prefix;
ns.PreferredPrefix = L"t";
ns2.Uri = uri2;
ns2.PreferredPrefix = prefix2;
ns2.PreferredPrefix = L"u";
parentName.LocalName = parentNameText;
parentName.LocalName = (WCHAR *) L"Dad";
parentName.Space = &ns;
child1Name.LocalName = child1NameText;
child1Name.LocalName = (WCHAR *) child1NameText;
child1Name.Space = &ns2;
child2Name.LocalName = child2NameText;
child2Name.LocalName = (WCHAR *) child2NameText;
child2Name.Space = &ns;
child3Name.LocalName = child3NameText;
child3Name.LocalName = (WCHAR *) child3NameText;
child3Name.Space = &ns;
/* Create some elements */
......@@ -379,15 +365,12 @@ static void GetValueFromAny_tests(void)
static void XMLContext_AddNamespace_tests(void)
{
static const WCHAR ns1Uri[] = {'h','t','t','p',':','/','/','t','e','s','t','.','t','e','s','t',0};
static const WCHAR ns2Uri[] = {'h','t','t','p',':','/','/','w','i','n','e','.','r','o','c','k','s',0};
static const WCHAR ns3Uri[] = {'h','t','t','p',':','/','/','t','e','s','t','.','a','g','a','i','n',0};
static const WCHAR ns4Uri[] = {'h','t','t','p',':','/','/','o','n','e','.','m','o','r','e',0};
static const WCHAR prefix1[] = {'t','s','t',0};
static const WCHAR prefix2[] = {'w','i','n','e',0};
static const WCHAR unPrefix0[] = {'u','n','0',0};
static const WCHAR unPrefix1[] = {'u','n','1',0};
static const WCHAR unPrefix2[] = {'u','n','2',0};
static const WCHAR *ns1Uri = L"http://test.test";
static const WCHAR *ns2Uri = L"http://wine.rocks";
static const WCHAR *ns3Uri = L"http://test.again";
static const WCHAR *prefix1 = L"tst";
static const WCHAR *prefix2 = L"wine";
static const WCHAR *unPrefix1 = L"un1";
IWSDXMLContext *context;
WSDXML_NAMESPACE *ns1 = NULL, *ns2 = NULL;
......@@ -448,7 +431,7 @@ static void XMLContext_AddNamespace_tests(void)
if (ns2 != NULL)
{
ok(lstrcmpW(ns2->Uri, ns2Uri) == 0, "URI returned by AddNamespace is not as expected (%s)\n", wine_dbgstr_w(ns2->Uri));
ok(lstrcmpW(ns2->PreferredPrefix, unPrefix0) == 0, "PreferredPrefix returned by AddNamespace is not as expected (%s)\n", wine_dbgstr_w(ns2->PreferredPrefix));
ok(lstrcmpW(ns2->PreferredPrefix, L"un0") == 0, "PreferredPrefix returned by AddNamespace is not as expected (%s)\n", wine_dbgstr_w(ns2->PreferredPrefix));
ok(ns2->Names == NULL, "Names array is not empty\n");
ok(ns2->NamesCount == 0, "NamesCount is not 0 (value = %d)\n", ns2->NamesCount);
ok(ns2->Uri != ns2Uri, "URI has not been cloned\n");
......@@ -459,7 +442,7 @@ static void XMLContext_AddNamespace_tests(void)
WSDFreeLinkedMemory(ns2);
/* Try explicitly creating a prefix called 'un1' */
hr = IWSDXMLContext_AddNamespace(context, ns4Uri, unPrefix1, &ns2);
hr = IWSDXMLContext_AddNamespace(context, L"http://one.more", unPrefix1, &ns2);
ok(hr == S_OK, "AddNamespace failed with %08x\n", hr);
/* Check the returned structure */
......@@ -481,7 +464,7 @@ static void XMLContext_AddNamespace_tests(void)
if (ns2 != NULL)
{
ok(lstrcmpW(ns2->PreferredPrefix, unPrefix2) == 0, "PreferredPrefix returned by AddNamespace is not as expected (%s)\n", wine_dbgstr_w(ns2->PreferredPrefix));
ok(lstrcmpW(ns2->PreferredPrefix, L"un2") == 0, "PreferredPrefix returned by AddNamespace is not as expected (%s)\n", wine_dbgstr_w(ns2->PreferredPrefix));
}
WSDFreeLinkedMemory(ns2);
......@@ -506,12 +489,11 @@ static void XMLContext_AddNamespace_tests(void)
static void XMLContext_AddNameToNamespace_tests(void)
{
static const WCHAR ns1Uri[] = {'h','t','t','p',':','/','/','t','e','s','t','.','t','e','s','t',0};
static const WCHAR ns2Uri[] = {'h','t','t','p',':','/','/','w','i','n','e','.','r','o','c','k','s',0};
static const WCHAR prefix2[] = {'w','i','n','e',0};
static const WCHAR unPrefix0[] = {'u','n','0',0};
static const WCHAR name1Text[] = {'B','o','b',0};
static const WCHAR name2Text[] = {'T','i','m',0};
static const WCHAR *ns1Uri = L"http://test.test";
static const WCHAR *ns2Uri = L"http://wine.rocks";
static const WCHAR *prefix2 = L"wine";
static const WCHAR *name1Text = L"Bob";
static const WCHAR *name2Text = L"Tim";
IWSDXMLContext *context;
WSDXML_NAMESPACE *ns2 = NULL;
WSDXML_NAME *name1 = NULL, *name2 = NULL;
......@@ -548,7 +530,7 @@ static void XMLContext_AddNameToNamespace_tests(void)
ok(name1->Space != NULL, "Space returned by AddNameToNamespace is null\n");
ok(lstrcmpW(name1->Space->Uri, ns1Uri) == 0, "URI returned by AddNameToNamespace is not as expected (%s)\n", wine_dbgstr_w(name1->Space->Uri));
ok(lstrcmpW(name1->Space->PreferredPrefix, unPrefix0) == 0, "PreferredPrefix returned by AddName is not as expected (%s)\n", wine_dbgstr_w(name1->Space->PreferredPrefix));
ok(lstrcmpW(name1->Space->PreferredPrefix, L"un0") == 0, "PreferredPrefix returned by AddName is not as expected (%s)\n", wine_dbgstr_w(name1->Space->PreferredPrefix));
ok(name1->Space->Names == NULL, "Names array is not empty\n");
ok(name1->Space->NamesCount == 0, "NamesCount is not 0 (value = %d)\n", name1->Space->NamesCount);
ok(name1->Space->Uri != ns1Uri, "URI has not been cloned\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment