Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f735ffbf
Commit
f735ffbf
authored
Mar 17, 2020
by
Hans Leidekker
Committed by
Alexandre Julliard
Mar 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices/tests: Use wide character string literals.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e1b74133
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
172 additions
and
253 deletions
+172
-253
channel.c
dlls/webservices/tests/channel.c
+17
-34
msg.c
dlls/webservices/tests/msg.c
+14
-20
proxy.c
dlls/webservices/tests/proxy.c
+10
-18
reader.c
dlls/webservices/tests/reader.c
+23
-34
url.c
dlls/webservices/tests/url.c
+77
-101
writer.c
dlls/webservices/tests/writer.c
+31
-46
No files found.
dlls/webservices/tests/channel.c
View file @
f735ffbf
...
...
@@ -115,7 +115,6 @@ static void test_WsCreateChannel(void)
static
void
test_WsOpenChannel
(
void
)
{
WCHAR
url
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
'h'
,
'o'
,
's'
,
't'
};
HRESULT
hr
;
WS_CHANNEL
*
channel
;
WS_ENDPOINT_ADDRESS
addr
;
...
...
@@ -134,8 +133,8 @@ static void test_WsOpenChannel(void)
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
memset
(
&
addr
,
0
,
sizeof
(
addr
)
);
addr
.
url
.
length
=
ARRAY_SIZE
(
url
)
;
addr
.
url
.
chars
=
url
;
addr
.
url
.
length
=
ARRAY_SIZE
(
L"http://localhost"
)
-
1
;
addr
.
url
.
chars
=
(
WCHAR
*
)
L"http://localhost"
;
hr
=
WsOpenChannel
(
NULL
,
&
addr
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
...
...
@@ -159,7 +158,6 @@ static void test_WsOpenChannel(void)
static
void
test_WsResetChannel
(
void
)
{
WCHAR
url
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
'h'
,
'o'
,
's'
,
't'
};
HRESULT
hr
;
WS_CHANNEL
*
channel
;
WS_CHANNEL_STATE
state
;
...
...
@@ -179,8 +177,8 @@ static void test_WsResetChannel(void)
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
memset
(
&
addr
,
0
,
sizeof
(
addr
)
);
addr
.
url
.
length
=
ARRAY_SIZE
(
url
)
;
addr
.
url
.
chars
=
url
;
addr
.
url
.
length
=
ARRAY_SIZE
(
L"http://localhost"
)
-
1
;
addr
.
url
.
chars
=
(
WCHAR
*
)
L"http://localhost"
;
hr
=
WsOpenChannel
(
channel
,
&
addr
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -274,12 +272,6 @@ static void test_WsCreateListener(void)
static
void
test_WsOpenListener
(
void
)
{
WCHAR
str
[]
=
{
'n'
,
'e'
,
't'
,
'.'
,
't'
,
'c'
,
'p'
,
':'
,
'/'
,
'/'
,
'+'
,
':'
,
'2'
,
'0'
,
'1'
,
'7'
,
'/'
,
'p'
,
'a'
,
't'
,
'h'
};
WCHAR
str2
[]
=
{
'n'
,
'e'
,
't'
,
'.'
,
't'
,
'c'
,
'p'
,
':'
,
'/'
,
'/'
,
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
'h'
,
'o'
,
's'
,
't'
,
':'
,
'2'
,
'0'
,
'1'
,
'7'
};
WCHAR
str3
[]
=
{
'n'
,
'e'
,
't'
,
'.'
,
't'
,
'c'
,
'p'
,
':'
,
'/'
,
'/'
,
'1'
,
'2'
,
'7'
,
'.'
,
'0'
,
'.'
,
'0'
,
'.'
,
'1'
,
':'
,
'2'
,
'0'
,
'1'
,
'7'
};
WS_STRING
url
;
WS_LISTENER
*
listener
;
HRESULT
hr
;
...
...
@@ -300,9 +292,8 @@ static void test_WsOpenListener(void)
hr
=
WsOpenListener
(
listener
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
url
.
length
=
ARRAY_SIZE
(
str
);
url
.
chars
=
str
;
url
.
length
=
ARRAY_SIZE
(
L"net.tcp://+:2017/path"
)
-
1
;
url
.
chars
=
(
WCHAR
*
)
L"net.tcp://+:2017/path"
;
hr
=
WsOpenListener
(
NULL
,
&
url
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
...
...
@@ -320,8 +311,8 @@ static void test_WsOpenListener(void)
hr
=
WsCreateListener
(
WS_CHANNEL_TYPE_DUPLEX_SESSION
,
WS_TCP_CHANNEL_BINDING
,
NULL
,
0
,
NULL
,
&
listener
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
url
.
length
=
ARRAY_SIZE
(
str2
)
;
url
.
chars
=
str2
;
url
.
length
=
ARRAY_SIZE
(
L"net.tcp://localhost:2017"
)
-
1
;
url
.
chars
=
(
WCHAR
*
)
L"net.tcp://localhost:2017"
;
hr
=
WsOpenListener
(
listener
,
&
url
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -333,8 +324,8 @@ static void test_WsOpenListener(void)
hr
=
WsCreateListener
(
WS_CHANNEL_TYPE_DUPLEX_SESSION
,
WS_TCP_CHANNEL_BINDING
,
NULL
,
0
,
NULL
,
&
listener
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
url
.
length
=
ARRAY_SIZE
(
str3
)
;
url
.
chars
=
str3
;
url
.
length
=
ARRAY_SIZE
(
L"net.tcp://127.0.0.1:2017"
)
-
1
;
url
.
chars
=
(
WCHAR
*
)
L"net.tcp://127.0.0.1:2017"
;
hr
=
WsOpenListener
(
listener
,
&
url
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -385,9 +376,7 @@ static void test_WsCreateChannelForListener(void)
static
void
test_WsResetListener
(
void
)
{
WCHAR
str
[]
=
{
'n'
,
'e'
,
't'
,
'.'
,
't'
,
'c'
,
'p'
,
':'
,
'/'
,
'/'
,
'+'
,
':'
,
'2'
,
'0'
,
'1'
,
'7'
,
'/'
,
'p'
,
'a'
,
't'
,
'h'
};
WS_STRING
url
=
{
ARRAY_SIZE
(
str
),
str
};
WS_STRING
url
=
{
ARRAY_SIZE
(
L"net.tcp://+:2017/path"
)
-
1
,
(
WCHAR
*
)
L"net.tcp://+:2017/path"
};
WS_LISTENER
*
listener
;
WS_LISTENER_STATE
state
;
WS_LISTENER_PROPERTY
prop
;
...
...
@@ -433,11 +422,6 @@ static void test_WsResetListener(void)
WsFreeListener
(
listener
);
}
static
const
WCHAR
fmt_soap_udp
[]
=
{
's'
,
'o'
,
'a'
,
'p'
,
'.'
,
'u'
,
'd'
,
'p'
,
':'
,
'/'
,
'/'
,
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
'h'
,
'o'
,
's'
,
't'
,
':'
,
'%'
,
'u'
,
0
};
static
const
WCHAR
fmt_net_tcp
[]
=
{
'n'
,
'e'
,
't'
,
'.'
,
't'
,
'c'
,
'p'
,
':'
,
'/'
,
'/'
,
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
'h'
,
'o'
,
's'
,
't'
,
':'
,
'%'
,
'u'
,
0
};
struct
listener_info
{
int
port
;
...
...
@@ -494,7 +478,7 @@ static void client_message_read_write( const struct listener_info *info )
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
memset
(
&
addr
,
0
,
sizeof
(
addr
)
);
addr
.
url
.
length
=
wsprintfW
(
buf
,
fmt_soap_udp
,
info
->
port
);
addr
.
url
.
length
=
wsprintfW
(
buf
,
L"soap.udp://localhost:%u"
,
info
->
port
);
addr
.
url
.
chars
=
buf
;
hr
=
WsOpenChannel
(
channel
,
&
addr
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -635,7 +619,7 @@ static void client_duplex_session( const struct listener_info *info )
ok
(
hr
==
WS_E_INVALID_OPERATION
,
"got %08x
\n
"
,
hr
);
memset
(
&
addr
,
0
,
sizeof
(
addr
)
);
addr
.
url
.
length
=
wsprintfW
(
buf
,
fmt_net_tcp
,
info
->
port
);
addr
.
url
.
length
=
wsprintfW
(
buf
,
L"net.tcp://localhost:%u"
,
info
->
port
);
addr
.
url
.
chars
=
buf
;
hr
=
WsOpenChannel
(
channel
,
&
addr
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -707,7 +691,7 @@ static void server_accept_channel( WS_CHANNEL *channel )
static
void
client_accept_channel
(
const
struct
listener_info
*
info
)
{
const
WCHAR
*
fmt
=
(
info
->
binding
==
WS_TCP_CHANNEL_BINDING
)
?
fmt_net_tcp
:
fmt_soap_udp
;
const
WCHAR
*
fmt
=
(
info
->
binding
==
WS_TCP_CHANNEL_BINDING
)
?
L"net.tcp://localhost:%u"
:
L"soap.udp://localhost:%u"
;
WS_XML_STRING
localname
=
{
9
,
(
BYTE
*
)
"localname"
},
ns
=
{
2
,
(
BYTE
*
)
"ns"
},
action
=
{
6
,
(
BYTE
*
)
"action"
};
WCHAR
buf
[
64
];
WS_LISTENER
*
listener
;
...
...
@@ -827,7 +811,7 @@ static void client_request_reply( const struct listener_info *info )
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
memset
(
&
addr
,
0
,
sizeof
(
addr
)
);
addr
.
url
.
length
=
wsprintfW
(
buf
,
fmt_net_tcp
,
info
->
port
);
addr
.
url
.
length
=
wsprintfW
(
buf
,
L"net.tcp://localhost:%u"
,
info
->
port
);
addr
.
url
.
chars
=
buf
;
hr
=
WsOpenChannel
(
channel
,
&
addr
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -867,7 +851,7 @@ static void client_request_reply( const struct listener_info *info )
static
DWORD
CALLBACK
listener_proc
(
void
*
arg
)
{
struct
listener_info
*
info
=
arg
;
const
WCHAR
*
fmt
=
(
info
->
binding
==
WS_TCP_CHANNEL_BINDING
)
?
fmt_net_tcp
:
fmt_soap_udp
;
const
WCHAR
*
fmt
=
(
info
->
binding
==
WS_TCP_CHANNEL_BINDING
)
?
L"net.tcp://localhost:%u"
:
L"soap.udp://localhost:%u"
;
WS_LISTENER
*
listener
;
WS_CHANNEL
*
channel
;
WCHAR
buf
[
64
];
...
...
@@ -973,7 +957,6 @@ done:
static
HRESULT
set_firewall
(
enum
firewall_op
op
)
{
static
const
WCHAR
testW
[]
=
{
'w'
,
'e'
,
'b'
,
's'
,
'e'
,
'r'
,
'v'
,
'i'
,
'c'
,
'e'
,
's'
,
'_'
,
't'
,
'e'
,
's'
,
't'
,
0
};
HRESULT
hr
,
init
;
INetFwMgr
*
mgr
=
NULL
;
INetFwPolicy
*
policy
=
NULL
;
...
...
@@ -1013,7 +996,7 @@ static HRESULT set_firewall( enum firewall_op op )
hr
=
INetFwAuthorizedApplication_put_ProcessImageFileName
(
app
,
image
);
if
(
hr
!=
S_OK
)
goto
done
;
name
=
SysAllocString
(
testW
);
name
=
SysAllocString
(
L"webservices_test"
);
hr
=
INetFwAuthorizedApplication_put_Name
(
app
,
name
);
SysFreeString
(
name
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
dlls/webservices/tests/msg.c
View file @
f735ffbf
...
...
@@ -257,7 +257,6 @@ static void test_WsInitializeMessage(void)
static
void
test_WsAddressMessage
(
void
)
{
static
WCHAR
localhost
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
'h'
,
'o'
,
's'
,
't'
,
'/'
,
0
};
HRESULT
hr
;
WS_MESSAGE
*
msg
;
WS_ENDPOINT_ADDRESS
endpoint
;
...
...
@@ -304,8 +303,8 @@ static void test_WsAddressMessage(void)
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
memset
(
&
endpoint
,
0
,
sizeof
(
endpoint
)
);
endpoint
.
url
.
chars
=
localhost
;
endpoint
.
url
.
length
=
ARRAY_SIZE
(
localhost
)
;
endpoint
.
url
.
chars
=
(
WCHAR
*
)
L"http://localhost/"
;
endpoint
.
url
.
length
=
ARRAY_SIZE
(
L"http://localhost/"
)
-
1
;
hr
=
WsAddressMessage
(
msg
,
&
endpoint
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -639,12 +638,11 @@ static void test_WsSetHeader(void)
"<a:MessageID>urn:uuid:00000000-0000-0000-0000-000000000000</a:MessageID>"
"<a:Action s:mustUnderstand=
\"
1
\"
>action2</a:Action></s:Header>"
"<s:Body/></s:Envelope>"
;
static
const
WCHAR
action
[]
=
{
'a'
,
'c'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
static
const
WS_XML_STRING
action2
=
{
7
,
(
BYTE
*
)
"action2"
};
HRESULT
hr
;
WS_MESSAGE
*
msg
;
WS_XML_WRITER
*
writer
;
const
WCHAR
*
ptr
=
action
;
const
WCHAR
*
ptr
=
L"action"
;
hr
=
WsSetHeader
(
NULL
,
0
,
0
,
0
,
NULL
,
0
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
...
...
@@ -848,8 +846,6 @@ static void test_WsAddCustomHeader(void)
"<header2 xmlns=
\"
ns
\"
>value2</header2></s:Header><s:Body/></s:Envelope>"
;
static
WS_XML_STRING
header
=
{
6
,
(
BYTE
*
)
"header"
},
ns
=
{
2
,
(
BYTE
*
)
"ns"
};
static
WS_XML_STRING
header2
=
{
7
,
(
BYTE
*
)
"header2"
};
static
WCHAR
valueW
[]
=
{
'v'
,
'a'
,
'l'
,
'u'
,
'e'
,
0
};
static
WCHAR
value2W
[]
=
{
'v'
,
'a'
,
'l'
,
'u'
,
'e'
,
'2'
,
0
};
HRESULT
hr
;
WS_MESSAGE
*
msg
;
WS_ELEMENT_DESCRIPTION
desc
;
...
...
@@ -891,12 +887,12 @@ static void test_WsAddCustomHeader(void)
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output_header
(
msg
,
expected2
,
-
1
,
strstr
(
expected2
,
"urn:uuid:"
)
-
expected2
,
46
,
__LINE__
);
test
.
value
=
valueW
;
test
.
value
=
L"value"
;
hr
=
WsAddCustomHeader
(
msg
,
&
desc
,
WS_WRITE_REQUIRED_VALUE
,
&
test
,
sizeof
(
test
),
0
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output_header
(
msg
,
expected
,
-
1
,
strstr
(
expected
,
"urn:uuid:"
)
-
expected
,
46
,
__LINE__
);
test
.
value
=
value2W
;
test
.
value
=
L"value2"
;
hr
=
WsAddCustomHeader
(
msg
,
&
desc
,
WS_WRITE_REQUIRED_VALUE
,
&
test
,
sizeof
(
test
),
0
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output_header
(
msg
,
expected3
,
-
1
,
strstr
(
expected3
,
"urn:uuid:"
)
-
expected3
,
46
,
__LINE__
);
...
...
@@ -1243,9 +1239,8 @@ static void test_WsGetHeader(void)
"<Action s:mustUnderstand=
\"
1
\"
"
"xmlns=
\"
http://schemas.microsoft.com/ws/2005/05/addressing/none
\"
>action</Action>"
"</s:Header><s:Body/></s:Envelope>"
;
static
WCHAR
action
[]
=
{
'a'
,
'c'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
WS_MESSAGE
*
msg
;
WCHAR
*
ptr
;
const
WCHAR
*
ptr
;
HRESULT
hr
;
hr
=
WsGetHeader
(
NULL
,
0
,
0
,
0
,
NULL
,
NULL
,
0
,
NULL
);
...
...
@@ -1275,7 +1270,7 @@ static void test_WsGetHeader(void)
hr
=
WsGetHeader
(
msg
,
WS_ACTION_HEADER
,
WS_WSZ_TYPE
,
WS_READ_REQUIRED_POINTER
,
NULL
,
NULL
,
0
,
NULL
);
ok
(
hr
==
WS_E_INVALID_FORMAT
,
"got %08x
\n
"
,
hr
);
ptr
=
action
;
ptr
=
L"action"
;
hr
=
WsSetHeader
(
msg
,
WS_ACTION_HEADER
,
WS_WSZ_TYPE
,
WS_WRITE_REQUIRED_POINTER
,
&
ptr
,
sizeof
(
ptr
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output_header
(
msg
,
expected
,
-
1
,
strstr
(
expected
,
"urn:uuid:"
)
-
expected
,
46
,
__LINE__
);
...
...
@@ -1291,7 +1286,7 @@ static void test_WsGetHeader(void)
hr
=
WsGetHeader
(
msg
,
WS_ACTION_HEADER
,
WS_WSZ_TYPE
,
WS_READ_REQUIRED_POINTER
,
NULL
,
&
ptr
,
sizeof
(
ptr
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
ptr
!=
NULL
,
"ptr not set
\n
"
);
ok
(
!
memcmp
(
ptr
,
action
,
sizeof
(
action
)
),
"wrong data
\n
"
);
ok
(
!
memcmp
(
ptr
,
L"action"
,
sizeof
(
L"action"
)
),
"wrong data
\n
"
);
WsFreeMessage
(
msg
);
hr
=
WsCreateMessage
(
WS_ENVELOPE_VERSION_NONE
,
WS_ADDRESSING_VERSION_TRANSPORT
,
NULL
,
0
,
&
msg
,
NULL
);
...
...
@@ -1300,7 +1295,7 @@ static void test_WsGetHeader(void)
hr
=
WsInitializeMessage
(
msg
,
WS_REQUEST_MESSAGE
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ptr
=
action
;
ptr
=
L"action"
;
hr
=
WsSetHeader
(
msg
,
WS_ACTION_HEADER
,
WS_WSZ_TYPE
,
WS_WRITE_REQUIRED_POINTER
,
&
ptr
,
sizeof
(
ptr
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
check_output_header
(
msg
,
expected2
,
-
1
,
0
,
0
,
__LINE__
);
...
...
@@ -1309,7 +1304,7 @@ static void test_WsGetHeader(void)
hr
=
WsGetHeader
(
msg
,
WS_ACTION_HEADER
,
WS_WSZ_TYPE
,
WS_READ_REQUIRED_POINTER
,
NULL
,
&
ptr
,
sizeof
(
ptr
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
ptr
!=
NULL
,
"ptr not set
\n
"
);
ok
(
!
memcmp
(
ptr
,
action
,
sizeof
(
action
)
),
"wrong data
\n
"
);
ok
(
!
memcmp
(
ptr
,
L"action"
,
sizeof
(
L"action"
)
),
"wrong data
\n
"
);
WsFreeMessage
(
msg
);
hr
=
WsCreateMessage
(
WS_ENVELOPE_VERSION_SOAP_1_2
,
WS_ADDRESSING_VERSION_TRANSPORT
,
NULL
,
0
,
&
msg
,
NULL
);
...
...
@@ -1318,7 +1313,7 @@ static void test_WsGetHeader(void)
hr
=
WsInitializeMessage
(
msg
,
WS_REQUEST_MESSAGE
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ptr
=
action
;
ptr
=
L"action"
;
hr
=
WsSetHeader
(
msg
,
WS_ACTION_HEADER
,
WS_WSZ_TYPE
,
WS_WRITE_REQUIRED_POINTER
,
&
ptr
,
sizeof
(
ptr
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
check_output_header
(
msg
,
expected3
,
-
1
,
0
,
0
,
__LINE__
);
...
...
@@ -1327,7 +1322,7 @@ static void test_WsGetHeader(void)
hr
=
WsGetHeader
(
msg
,
WS_ACTION_HEADER
,
WS_WSZ_TYPE
,
WS_READ_REQUIRED_POINTER
,
NULL
,
&
ptr
,
sizeof
(
ptr
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
ptr
!=
NULL
,
"ptr not set
\n
"
);
ok
(
!
memcmp
(
ptr
,
action
,
sizeof
(
action
)
),
"wrong data
\n
"
);
ok
(
!
memcmp
(
ptr
,
L"action"
,
sizeof
(
L"action"
)
),
"wrong data
\n
"
);
WsFreeMessage
(
msg
);
}
...
...
@@ -1336,7 +1331,6 @@ static void test_WsGetCustomHeader(void)
static
char
expected
[]
=
"<Envelope><Header><Custom xmlns=
\"
ns
\"
>value</Custom></Header><Body/></Envelope>"
;
static
WS_XML_STRING
custom
=
{
6
,
(
BYTE
*
)
"Custom"
},
ns
=
{
2
,
(
BYTE
*
)
"ns"
};
static
WCHAR
valueW
[]
=
{
'v'
,
'a'
,
'l'
,
'u'
,
'e'
,
0
};
WS_ELEMENT_DESCRIPTION
desc
;
WS_STRUCT_DESCRIPTION
s
;
WS_FIELD_DESCRIPTION
f
,
*
fields
[
1
];
...
...
@@ -1375,7 +1369,7 @@ static void test_WsGetCustomHeader(void)
desc
.
type
=
WS_STRUCT_TYPE
;
desc
.
typeDescription
=
&
s
;
test
.
value
=
valueW
;
test
.
value
=
L"value"
;
hr
=
WsAddCustomHeader
(
msg
,
&
desc
,
WS_WRITE_REQUIRED_VALUE
,
&
test
,
sizeof
(
test
),
0
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output_header
(
msg
,
expected
,
-
1
,
0
,
0
,
__LINE__
);
...
...
@@ -1394,7 +1388,7 @@ static void test_WsGetCustomHeader(void)
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
test
.
value
!=
NULL
,
"value not set
\n
"
);
ok
(
!
memcmp
(
test
.
value
,
valueW
,
sizeof
(
valueW
)
),
"wrong value
\n
"
);
ok
(
!
memcmp
(
test
.
value
,
L"value"
,
sizeof
(
L"value"
)
),
"wrong value
\n
"
);
WsFreeMessage
(
msg
);
}
...
...
dlls/webservices/tests/proxy.c
View file @
f735ffbf
...
...
@@ -146,7 +146,6 @@ static void test_WsCreateServiceProxyFromTemplate(void)
static
void
test_WsOpenServiceProxy
(
void
)
{
WCHAR
url
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
'h'
,
'o'
,
's'
,
't'
,
'/'
};
HRESULT
hr
;
WS_SERVICE_PROXY
*
proxy
;
WS_SERVICE_PROXY_STATE
state
;
...
...
@@ -164,8 +163,8 @@ static void test_WsOpenServiceProxy(void)
ok
(
state
==
WS_SERVICE_PROXY_STATE_CREATED
,
"got %u
\n
"
,
state
);
memset
(
&
addr
,
0
,
sizeof
(
addr
)
);
addr
.
url
.
length
=
ARRAY_SIZE
(
url
)
;
addr
.
url
.
chars
=
url
;
addr
.
url
.
length
=
ARRAY_SIZE
(
L"http://localhost/"
)
-
1
;
addr
.
url
.
chars
=
(
WCHAR
*
)
L"http://localhost/"
;
hr
=
WsOpenServiceProxy
(
proxy
,
&
addr
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -187,7 +186,6 @@ static void test_WsOpenServiceProxy(void)
static
void
test_WsResetServiceProxy
(
void
)
{
WCHAR
url
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
'h'
,
'o'
,
's'
,
't'
,
'/'
};
HRESULT
hr
;
WS_SERVICE_PROXY
*
proxy
;
WS_ENDPOINT_ADDRESS
addr
;
...
...
@@ -206,8 +204,8 @@ static void test_WsResetServiceProxy(void)
ok
(
state
==
WS_SERVICE_PROXY_STATE_CREATED
,
"got %u
\n
"
,
state
);
memset
(
&
addr
,
0
,
sizeof
(
addr
)
);
addr
.
url
.
length
=
ARRAY_SIZE
(
url
)
;
addr
.
url
.
chars
=
url
;
addr
.
url
.
length
=
ARRAY_SIZE
(
L"http://localhost/"
)
-
1
;
addr
.
url
.
chars
=
(
WCHAR
*
)
L"http://localhost/"
;
hr
=
WsOpenServiceProxy
(
proxy
,
&
addr
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -230,8 +228,6 @@ static void test_WsResetServiceProxy(void)
static
HRESULT
create_channel
(
int
port
,
WS_CHANNEL
**
ret
)
{
static
const
WCHAR
fmt
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'1'
,
'2'
,
'7'
,
'.'
,
'0'
,
'.'
,
'0'
,
'.'
,
'1'
,
':'
,
'%'
,
'u'
,
0
};
WS_CHANNEL_PROPERTY
prop
[
2
];
WS_ENVELOPE_VERSION
env_version
=
WS_ENVELOPE_VERSION_SOAP_1_1
;
WS_ADDRESSING_VERSION
addr_version
=
WS_ADDRESSING_VERSION_TRANSPORT
;
...
...
@@ -253,7 +249,7 @@ static HRESULT create_channel( int port, WS_CHANNEL **ret )
if
(
hr
!=
S_OK
)
return
hr
;
memset
(
&
addr
,
0
,
sizeof
(
addr
)
);
addr
.
url
.
length
=
wsprintfW
(
buf
,
fmt
,
port
);
addr
.
url
.
length
=
wsprintfW
(
buf
,
L"http://127.0.0.1:%u"
,
port
);
addr
.
url
.
chars
=
buf
;
hr
=
WsOpenChannel
(
channel
,
&
addr
,
NULL
,
NULL
);
if
(
hr
==
S_OK
)
*
ret
=
channel
;
...
...
@@ -383,8 +379,6 @@ static WS_HTTP_HEADER_MAPPING *response_header_mappings[] =
static
HRESULT
create_proxy
(
int
port
,
WS_SERVICE_PROXY
**
ret
)
{
static
const
WCHAR
fmt
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'1'
,
'2'
,
'7'
,
'.'
,
'0'
,
'.'
,
'0'
,
'.'
,
'1'
,
':'
,
'%'
,
'u'
,
'/'
,
0
};
WS_ENVELOPE_VERSION
env_version
;
WS_ADDRESSING_VERSION
addr_version
;
WS_HTTP_MESSAGE_MAPPING
mapping
;
...
...
@@ -421,7 +415,7 @@ static HRESULT create_proxy( int port, WS_SERVICE_PROXY **ret )
if
(
hr
!=
S_OK
)
return
hr
;
memset
(
&
addr
,
0
,
sizeof
(
addr
)
);
addr
.
url
.
length
=
wsprintfW
(
url
,
fmt
,
port
);
addr
.
url
.
length
=
wsprintfW
(
url
,
L"http://127.0.0.1:%u"
,
port
);
addr
.
url
.
chars
=
url
;
hr
=
WsOpenServiceProxy
(
proxy
,
&
addr
,
NULL
,
NULL
);
if
(
hr
==
S_OK
)
*
ret
=
proxy
;
...
...
@@ -485,7 +479,6 @@ static HRESULT CALLBACK send_callback( WS_MESSAGE *msg, WS_HEAP *heap, void *sta
static
HRESULT
CALLBACK
recv_callback
(
WS_MESSAGE
*
msg
,
WS_HEAP
*
heap
,
void
*
state
,
WS_ERROR
*
error
)
{
static
const
WS_XML_STRING
header
=
{
20
,
(
BYTE
*
)
"MappedResponseHeader"
};
static
const
WCHAR
valueW
[]
=
{
'v'
,
'a'
,
'l'
,
'u'
,
'e'
,
0
};
WCHAR
*
str
;
HRESULT
hr
;
...
...
@@ -493,13 +486,12 @@ static HRESULT CALLBACK recv_callback( WS_MESSAGE *msg, WS_HEAP *heap, void *sta
hr
=
WsGetMappedHeader
(
msg
,
&
header
,
WS_SINGLETON_HEADER
,
0
,
WS_WSZ_TYPE
,
WS_READ_OPTIONAL_POINTER
,
heap
,
&
str
,
sizeof
(
str
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
valueW
),
"wrong value %s
\n
"
,
wine_dbgstr_w
(
str
)
);
ok
(
!
wcscmp
(
str
,
L"value"
),
"wrong value %s
\n
"
,
wine_dbgstr_w
(
str
)
);
return
S_OK
;
}
static
void
test_WsCall
(
int
port
)
{
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
},
test2W
[]
=
{
't'
,
'e'
,
's'
,
't'
,
'2'
,
0
};
WS_XML_STRING
str
=
{
3
,
(
BYTE
*
)
"str"
};
WS_XML_STRING
req
=
{
3
,
(
BYTE
*
)
"req"
};
WS_XML_STRING
resp
=
{
4
,
(
BYTE
*
)
"resp"
};
...
...
@@ -584,8 +576,8 @@ static void test_WsCall( int port )
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
in
.
val
=
1
;
str_array
[
0
]
=
testW
;
str_array
[
1
]
=
test2W
;
str_array
[
0
]
=
L"test"
;
str_array
[
1
]
=
L"test2"
;
in
.
str
=
str_array
;
in
.
count
=
2
;
...
...
@@ -620,7 +612,7 @@ static void test_WsCall( int port )
hr
=
WsCall
(
proxy
,
&
op
,
args
,
heap
,
prop
,
ARRAY_SIZE
(
prop
),
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
out
.
str
,
testW
),
"wrong data
\n
"
);
ok
(
!
wcscmp
(
out
.
str
,
L"test"
),
"wrong data
\n
"
);
ok
(
out
.
count
==
2
,
"got %u
\n
"
,
out
.
count
);
ok
(
out
.
val
[
0
]
==
1
,
"got %u
\n
"
,
out
.
val
[
0
]
);
ok
(
out
.
val
[
1
]
==
2
,
"got %u
\n
"
,
out
.
val
[
1
]
);
...
...
dlls/webservices/tests/reader.c
View file @
f735ffbf
...
...
@@ -1325,10 +1325,8 @@ static void prepare_type_test( WS_XML_READER *reader, const char *data, ULONG si
static
void
test_WsReadType
(
void
)
{
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
},
test2W
[]
=
{
' '
,
't'
,
'e'
,
's'
,
't'
,
' '
};
static
const
GUID
guid
=
{
0
,
0
,
0
,{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0xa1
}};
static
const
char
utf8
[]
=
{
'<'
,
't'
,
'>'
,
0xe2
,
0x80
,
0x99
,
'<'
,
'/'
,
't'
,
'>'
};
static
const
WCHAR
utf8W
[]
=
{
0x2019
,
0
};
HRESULT
hr
;
WS_XML_READER
*
reader
;
WS_HEAP
*
heap
;
...
...
@@ -1381,7 +1379,7 @@ static void test_WsReadType(void)
WS_READ_REQUIRED_POINTER
,
heap
,
&
val_str
,
sizeof
(
val_str
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
val_str
!=
NULL
,
"pointer not set
\n
"
);
if
(
val_str
)
ok
(
!
lstrcmpW
(
val_str
,
testW
),
"wrong data
\n
"
);
if
(
val_str
)
ok
(
!
wcscmp
(
val_str
,
L"test"
),
"wrong data
\n
"
);
val_bool
=
-
1
;
prepare_type_test
(
reader
,
"<t>true</t>"
,
sizeof
(
"<t>true</t>"
)
-
1
);
...
...
@@ -1748,7 +1746,7 @@ static void test_WsReadType(void)
WS_READ_REQUIRED_POINTER
,
heap
,
&
val_str
,
sizeof
(
val_str
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
val_str
!=
NULL
,
"pointer not set
\n
"
);
ok
(
!
lstrcmpW
(
val_str
,
utf8W
),
"got %s
\n
"
,
wine_dbgstr_w
(
val_str
)
);
ok
(
!
lstrcmpW
(
val_str
,
L"
\x2019
"
),
"got %s
\n
"
,
wine_dbgstr_w
(
val_str
)
);
val_str
=
NULL
;
prepare_type_test
(
reader
,
"<t></t>"
,
sizeof
(
"<t></t>"
)
-
1
);
...
...
@@ -1787,7 +1785,7 @@ static void test_WsReadType(void)
WS_READ_REQUIRED_VALUE
,
heap
,
&
val_string
,
sizeof
(
val_string
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
val_string
.
length
==
6
,
"got %u
\n
"
,
val_string
.
length
);
ok
(
!
memcmp
(
val_string
.
chars
,
test2W
,
sizeof
(
test2W
)
),
"wrong data
\n
"
);
ok
(
!
memcmp
(
val_string
.
chars
,
L" test "
,
12
),
"wrong data
\n
"
);
val_string
.
length
=
0xdeadbeef
;
val_string
.
chars
=
(
WCHAR
*
)
0xdeadbeef
;
...
...
@@ -1811,7 +1809,7 @@ static void test_WsReadType(void)
WS_READ_REQUIRED_VALUE
,
heap
,
&
val_id
,
sizeof
(
val_id
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
val_id
.
uri
.
length
==
6
,
"got %u
\n
"
,
val_string
.
length
);
ok
(
!
memcmp
(
val_id
.
uri
.
chars
,
test2W
,
sizeof
(
test2W
)
),
"wrong data
\n
"
);
ok
(
!
memcmp
(
val_id
.
uri
.
chars
,
L" test "
,
12
),
"wrong data
\n
"
);
ok
(
IsEqualGUID
(
&
val_id
.
guid
,
&
guid_null
),
"wrong guid
\n
"
);
memset
(
&
val_id
,
0
,
sizeof
(
val_id
)
);
...
...
@@ -1882,7 +1880,6 @@ static void test_WsReadType(void)
static
void
test_WsGetXmlAttribute
(
void
)
{
static
const
WCHAR
valueW
[]
=
{
'v'
,
'a'
,
'l'
,
'u'
,
'e'
,
0
};
HRESULT
hr
;
WS_XML_READER
*
reader
;
WS_XML_STRING
xmlstr
;
...
...
@@ -1919,7 +1916,7 @@ static void test_WsGetXmlAttribute(void)
todo_wine
ok
(
str
!=
NULL
,
"str not set
\n
"
);
todo_wine
ok
(
count
==
5
,
"got %u
\n
"
,
count
);
/* string is not null-terminated */
if
(
str
)
ok
(
!
memcmp
(
str
,
valueW
,
count
*
sizeof
(
WCHAR
)
),
"wrong data
\n
"
);
if
(
str
)
ok
(
!
memcmp
(
str
,
L"value"
,
count
*
sizeof
(
WCHAR
)
),
"wrong data
\n
"
);
xmlstr
.
bytes
=
(
BYTE
*
)
"none"
;
xmlstr
.
length
=
sizeof
(
"none"
)
-
1
;
...
...
@@ -2285,7 +2282,6 @@ static void prepare_struct_type_test( WS_XML_READER *reader, const char *data )
static
void
test_simple_struct_type
(
void
)
{
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
HRESULT
hr
;
WS_XML_READER
*
reader
;
WS_HEAP
*
heap
;
...
...
@@ -2354,7 +2350,7 @@ static void test_simple_struct_type(void)
if
(
test
)
{
ok
(
test
->
str
!=
NULL
,
"str not set
\n
"
);
if
(
test
->
str
)
ok
(
!
lstrcmpW
(
test
->
str
,
testW
),
"wrong data
\n
"
);
if
(
test
->
str
)
ok
(
!
wcscmp
(
test
->
str
,
L"test"
),
"wrong data
\n
"
);
}
hr
=
WsGetReaderNode
(
reader
,
&
node
,
NULL
);
...
...
@@ -2370,7 +2366,7 @@ static void test_simple_struct_type(void)
if
(
test
)
{
ok
(
test
->
str
!=
NULL
,
"str not set
\n
"
);
if
(
test
->
str
)
ok
(
!
lstrcmpW
(
test
->
str
,
testW
),
"wrong data
\n
"
);
if
(
test
->
str
)
ok
(
!
wcscmp
(
test
->
str
,
L"test"
),
"wrong data
\n
"
);
}
hr
=
WsGetReaderNode
(
reader
,
&
node
,
NULL
);
...
...
@@ -2386,7 +2382,7 @@ static void test_simple_struct_type(void)
if
(
test
)
{
ok
(
test
->
str
!=
NULL
,
"str not set
\n
"
);
if
(
test
->
str
)
ok
(
!
lstrcmpW
(
test
->
str
,
testW
),
"wrong data
\n
"
);
if
(
test
->
str
)
ok
(
!
wcscmp
(
test
->
str
,
L"test"
),
"wrong data
\n
"
);
}
hr
=
WsGetReaderNode
(
reader
,
&
node
,
NULL
);
...
...
@@ -2412,7 +2408,7 @@ static void test_simple_struct_type(void)
if
(
test
)
{
ok
(
test
->
str
!=
NULL
,
"str not set
\n
"
);
if
(
test
->
str
)
ok
(
!
lstrcmpW
(
test
->
str
,
testW
),
"wrong data
\n
"
);
if
(
test
->
str
)
ok
(
!
wcscmp
(
test
->
str
,
L"test"
),
"wrong data
\n
"
);
}
hr
=
WsGetReaderNode
(
reader
,
&
node
,
NULL
);
...
...
@@ -2434,7 +2430,7 @@ static void test_simple_struct_type(void)
if
(
test
)
{
ok
(
test
->
str
!=
NULL
,
"str not set
\n
"
);
if
(
test
->
str
)
ok
(
!
lstrcmpW
(
test
->
str
,
testW
),
"wrong data test %p test->str %p
\n
"
,
test
,
test
->
str
);
if
(
test
->
str
)
ok
(
!
wcscmp
(
test
->
str
,
L"test"
),
"wrong data test %p test->str %p
\n
"
,
test
,
test
->
str
);
}
hr
=
WsGetReaderNode
(
reader
,
&
node
,
NULL
);
...
...
@@ -2903,7 +2899,6 @@ static void test_WsGetNamespaceFromPrefix(void)
static
void
test_text_field_mapping
(
void
)
{
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
HRESULT
hr
;
WS_XML_READER
*
reader
;
WS_HEAP
*
heap
;
...
...
@@ -2939,7 +2934,7 @@ static void test_text_field_mapping(void)
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
test
!=
NULL
,
"test not set
\n
"
);
ok
(
test
->
str
!=
NULL
,
"str not set
\n
"
);
ok
(
!
lstrcmpW
(
test
->
str
,
testW
),
"got %s
\n
"
,
wine_dbgstr_w
(
test
->
str
)
);
ok
(
!
wcscmp
(
test
->
str
,
L"test"
),
"got %s
\n
"
,
wine_dbgstr_w
(
test
->
str
)
);
WsFreeReader
(
reader
);
WsFreeHeap
(
heap
);
...
...
@@ -2958,8 +2953,6 @@ static void test_complex_struct_type(void)
"<o:services o:GenerationTime=
\"
2015-09-03T18:47:54
\"
></o:services>"
"<trailing>content</trailing>"
"</o:OfficeConfig>"
;
static
const
WCHAR
timestampW
[]
=
{
'2'
,
'0'
,
'1'
,
'5'
,
'-'
,
'0'
,
'9'
,
'-'
,
'0'
,
'3'
,
'T'
,
'1'
,
'8'
,
':'
,
'4'
,
'7'
,
':'
,
'5'
,
'4'
,
0
};
HRESULT
hr
;
WS_ERROR
*
error
;
WS_ERROR_PROPERTY
prop
;
...
...
@@ -3056,7 +3049,7 @@ static void test_complex_struct_type(void)
WS_READ_REQUIRED_POINTER
,
heap
,
&
test
,
sizeof
(
test
),
error
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
test
!=
NULL
,
"test not set
\n
"
);
ok
(
!
lstrcmpW
(
test
->
services
->
generationtime
,
timestampW
),
"wrong data
\n
"
);
ok
(
!
wcscmp
(
test
->
services
->
generationtime
,
L"2015-09-03T18:47:54"
),
"wrong data
\n
"
);
hr
=
WsGetReaderNode
(
reader
,
&
node
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -3090,7 +3083,7 @@ static void test_complex_struct_type(void)
WS_READ_REQUIRED_POINTER
,
heap
,
&
test
,
sizeof
(
test
),
error
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
test
!=
NULL
,
"test not set
\n
"
);
if
(
test
)
ok
(
!
lstrcmpW
(
test
->
services
->
generationtime
,
timestampW
),
"wrong data
\n
"
);
if
(
test
)
ok
(
!
wcscmp
(
test
->
services
->
generationtime
,
L"2015-09-03T18:47:54"
),
"wrong data
\n
"
);
hr
=
WsGetReaderNode
(
reader
,
&
node
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -3158,7 +3151,6 @@ static void test_repeating_element(void)
"<services>"
"<service><name></name></service>"
"</services>"
;
static
const
WCHAR
oneW
[]
=
{
'1'
,
0
},
twoW
[]
=
{
'2'
,
0
};
WS_XML_STRING
str_name
=
{
4
,
(
BYTE
*
)
"name"
};
WS_XML_STRING
str_services
=
{
8
,
(
BYTE
*
)
"services"
};
WS_XML_STRING
str_service
=
{
7
,
(
BYTE
*
)
"service"
};
...
...
@@ -3308,8 +3300,8 @@ static void test_repeating_element(void)
ok
(
test2
!=
NULL
,
"test2 not set
\n
"
);
ok
(
test2
->
service
!=
NULL
,
"service not set
\n
"
);
ok
(
test2
->
service_count
==
2
,
"got %u
\n
"
,
test2
->
service_count
);
ok
(
!
lstrcmpW
(
test2
->
service
[
0
].
id
,
oneW
),
"wrong data
\n
"
);
ok
(
!
lstrcmpW
(
test2
->
service
[
1
].
id
,
twoW
),
"wrong data
\n
"
);
ok
(
!
wcscmp
(
test2
->
service
[
0
].
id
,
L"1"
),
"wrong data
\n
"
);
ok
(
!
wcscmp
(
test2
->
service
[
1
].
id
,
L"2"
),
"wrong data
\n
"
);
/* repeating attribute field + text field mapping */
prepare_struct_type_test
(
reader
,
data5
);
...
...
@@ -3331,10 +3323,10 @@ static void test_repeating_element(void)
ok
(
test3
!=
NULL
,
"test3 not set
\n
"
);
ok
(
test3
->
service
!=
NULL
,
"service not set
\n
"
);
ok
(
test3
->
service_count
==
2
,
"got %u
\n
"
,
test3
->
service_count
);
ok
(
!
lstrcmpW
(
test3
->
service
[
0
].
name
,
oneW
),
"wrong data
\n
"
);
ok
(
!
lstrcmpW
(
test3
->
service
[
0
].
id
,
oneW
),
"wrong data
\n
"
);
ok
(
!
lstrcmpW
(
test3
->
service
[
1
].
name
,
twoW
),
"wrong data
\n
"
);
ok
(
!
lstrcmpW
(
test3
->
service
[
1
].
id
,
twoW
),
"wrong data
\n
"
);
ok
(
!
wcscmp
(
test3
->
service
[
0
].
name
,
L"1"
),
"wrong data
\n
"
);
ok
(
!
wcscmp
(
test3
->
service
[
0
].
id
,
L"1"
),
"wrong data
\n
"
);
ok
(
!
wcscmp
(
test3
->
service
[
1
].
name
,
L"2"
),
"wrong data
\n
"
);
ok
(
!
wcscmp
(
test3
->
service
[
1
].
id
,
L"2"
),
"wrong data
\n
"
);
/* empty text, item range */
prepare_struct_type_test
(
reader
,
data6
);
...
...
@@ -4330,7 +4322,6 @@ static void test_WsReadBytes(void)
static
void
test_WsReadChars
(
void
)
{
static
const
WCHAR
textW
[]
=
{
't'
,
'e'
,
'x'
,
't'
};
HRESULT
hr
;
WS_XML_READER
*
reader
;
const
WS_XML_NODE
*
node
;
...
...
@@ -4411,7 +4402,7 @@ static void test_WsReadChars(void)
hr
=
WsReadChars
(
reader
,
bufW
,
2
,
&
count
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
count
==
2
,
"got %u
\n
"
,
count
);
ok
(
!
memcmp
(
bufW
,
textW
,
2
*
sizeof
(
WCHAR
)
),
"wrong data
\n
"
);
ok
(
!
memcmp
(
bufW
,
L"te"
,
2
*
sizeof
(
WCHAR
)
),
"wrong data
\n
"
);
hr
=
WsGetReaderNode
(
reader
,
&
node
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -6168,7 +6159,6 @@ static void test_WsReadXmlBuffer(void)
static
void
test_union_type
(
void
)
{
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
static
WS_XML_STRING
str_ns
=
{
0
,
NULL
},
str_a
=
{
1
,
(
BYTE
*
)
"a"
},
str_b
=
{
1
,
(
BYTE
*
)
"b"
};
static
WS_XML_STRING
str_s
=
{
1
,
(
BYTE
*
)
"s"
};
HRESULT
hr
;
...
...
@@ -6243,7 +6233,7 @@ static void test_union_type(void)
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
test
!=
NULL
,
"test not set
\n
"
);
ok
(
test
->
choice
==
CHOICE_A
,
"got %d
\n
"
,
test
->
choice
);
ok
(
!
lstrcmpW
(
test
->
value
.
a
,
testW
),
"got %s
\n
"
,
wine_dbgstr_w
(
test
->
value
.
a
)
);
ok
(
!
wcscmp
(
test
->
value
.
a
,
L"test"
),
"got %s
\n
"
,
wine_dbgstr_w
(
test
->
value
.
a
)
);
hr
=
WsGetReaderNode
(
reader
,
&
node
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
node
->
nodeType
==
WS_XML_NODE_TYPE_EOF
,
"got %u
\n
"
,
node
->
nodeType
);
...
...
@@ -6386,7 +6376,6 @@ static void test_float(void)
static
void
test_repeating_element_choice
(
void
)
{
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
static
WS_XML_STRING
str_ns
=
{
0
,
NULL
},
str_a
=
{
1
,
(
BYTE
*
)
"a"
},
str_b
=
{
1
,
(
BYTE
*
)
"b"
};
static
WS_XML_STRING
str_s
=
{
1
,
(
BYTE
*
)
"s"
},
str_t
=
{
1
,
(
BYTE
*
)
"t"
};
HRESULT
hr
;
...
...
@@ -6470,7 +6459,7 @@ static void test_repeating_element_choice(void)
ok
(
test
!=
NULL
,
"test not set
\n
"
);
ok
(
test
->
count
==
1
,
"got %u
\n
"
,
test
->
count
);
ok
(
test
->
items
[
0
].
choice
==
CHOICE_A
,
"got %d
\n
"
,
test
->
items
[
0
].
choice
);
ok
(
!
lstrcmpW
(
test
->
items
[
0
].
value
.
a
,
testW
),
"got %s
\n
"
,
wine_dbgstr_w
(
test
->
items
[
0
].
value
.
a
)
);
ok
(
!
wcscmp
(
test
->
items
[
0
].
value
.
a
,
L"test"
),
"got %s
\n
"
,
wine_dbgstr_w
(
test
->
items
[
0
].
value
.
a
)
);
test
=
NULL
;
prepare_struct_type_test
(
reader
,
"<t><b>123</b></t>"
);
...
...
@@ -6490,7 +6479,7 @@ static void test_repeating_element_choice(void)
ok
(
test
!=
NULL
,
"test not set
\n
"
);
ok
(
test
->
count
==
2
,
"got %u
\n
"
,
test
->
count
);
ok
(
test
->
items
[
0
].
choice
==
CHOICE_A
,
"got %d
\n
"
,
test
->
items
[
0
].
choice
);
ok
(
!
lstrcmpW
(
test
->
items
[
0
].
value
.
a
,
testW
),
"got %s
\n
"
,
wine_dbgstr_w
(
test
->
items
[
0
].
value
.
a
)
);
ok
(
!
wcscmp
(
test
->
items
[
0
].
value
.
a
,
L"test"
),
"got %s
\n
"
,
wine_dbgstr_w
(
test
->
items
[
0
].
value
.
a
)
);
ok
(
test
->
items
[
1
].
choice
==
CHOICE_B
,
"got %d
\n
"
,
test
->
items
[
1
].
choice
);
ok
(
test
->
items
[
1
].
value
.
b
==
123
,
"got %u
\n
"
,
test
->
items
[
1
].
value
.
b
);
...
...
dlls/webservices/tests/url.c
View file @
f735ffbf
...
...
@@ -23,58 +23,48 @@
static
void
test_WsDecodeUrl
(
void
)
{
static
WCHAR
url1
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
0
};
static
WCHAR
url2
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
's'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
0
};
static
WCHAR
url3
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
':'
,
'8'
,
'0'
,
0
};
static
WCHAR
url4
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
's'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
':'
,
'8'
,
'0'
,
0
};
static
WCHAR
url5
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
'/'
,
'p'
,
'a'
,
't'
,
'h'
,
0
};
static
WCHAR
url6
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
'/'
,
'p'
,
'a'
,
't'
,
'h'
,
'?'
,
'q'
,
'u'
,
'e'
,
'r'
,
'y'
,
0
};
static
WCHAR
url7
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
'/'
,
'p'
,
'a'
,
't'
,
'h'
,
'?'
,
'q'
,
'u'
,
'e'
,
'r'
,
'y'
,
'#'
,
'f'
,
'r'
,
'a'
,
'g'
,
0
};
static
WCHAR
url8
[]
=
{
'H'
,
'T'
,
'T'
,
'P'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
0
};
static
WCHAR
url9
[]
=
{
'h'
,
't'
,
't'
,
'q'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
0
};
static
WCHAR
url10
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
0
};
static
WCHAR
url11
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
0
};
static
WCHAR
url12
[]
=
{
'n'
,
'e'
,
't'
,
'.'
,
't'
,
'c'
,
'p'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
0
};
static
WCHAR
url13
[]
=
{
's'
,
'o'
,
'a'
,
'p'
,
'.'
,
'u'
,
'd'
,
'p'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
0
};
static
WCHAR
url14
[]
=
{
'n'
,
'e'
,
't'
,
'.'
,
'p'
,
'i'
,
'p'
,
'e'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
0
};
static
WCHAR
url15
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
0
};
static
WCHAR
url16
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'h'
,
'o'
,
's'
,
't'
,
0
};
static
WCHAR
url17
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
0
};
static
WCHAR
url18
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
'/'
,
0
};
static
WCHAR
url19
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
':'
,
'/'
,
0
};
static
WCHAR
url20
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
':'
,
'6'
,
'5'
,
'5'
,
'3'
,
'6'
,
0
};
static
WCHAR
url21
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
'?'
,
'q'
,
'u'
,
'e'
,
'r'
,
'y'
,
0
};
static
WCHAR
url22
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
'#'
,
'f'
,
'r'
,
'a'
,
'g'
,
0
};
static
WCHAR
url23
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
'%'
,
'2'
,
'0'
,
'2'
,
0
};
static
WCHAR
url24
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
'/'
,
'p'
,
'a'
,
't'
,
'h'
,
'%'
,
'2'
,
'0'
,
'2'
,
0
};
static
WCHAR
url25
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
'?'
,
'q'
,
'u'
,
'e'
,
'r'
,
'y'
,
'%'
,
'2'
,
'0'
,
'2'
,
0
};
static
WCHAR
url26
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
'#'
,
'f'
,
'r'
,
'a'
,
'g'
,
'%'
,
'2'
,
'0'
,
'2'
,
0
};
static
WCHAR
url27
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
'/'
,
'%'
,
'c'
,
'3'
,
'%'
,
'a'
,
'b'
,
'/'
,
0
};
static
WCHAR
host2
[]
=
{
'h'
,
'o'
,
's'
,
't'
,
' '
,
'2'
};
static
WCHAR
path2
[]
=
{
'/'
,
'p'
,
'a'
,
't'
,
'h'
,
' '
,
'2'
};
static
WCHAR
path3
[]
=
{
'/'
,
0xeb
,
'/'
};
static
WCHAR
query2
[]
=
{
'q'
,
'u'
,
'e'
,
'r'
,
'y'
,
' '
,
'2'
};
static
WCHAR
frag2
[]
=
{
'f'
,
'r'
,
'a'
,
'g'
,
' '
,
'2'
};
static
const
WCHAR
url1
[]
=
L"http://host"
;
static
const
WCHAR
url2
[]
=
L"https://host"
;
static
const
WCHAR
url3
[]
=
L"http://host:80"
;
static
const
WCHAR
url4
[]
=
L"https://host:80"
;
static
const
WCHAR
url5
[]
=
L"http://host/path"
;
static
const
WCHAR
url6
[]
=
L"http://host/path?query"
;
static
const
WCHAR
url7
[]
=
L"http://host/path?query#frag"
;
static
const
WCHAR
url8
[]
=
L"HTTP://host"
;
static
const
WCHAR
url9
[]
=
L"httq://host"
;
static
const
WCHAR
url10
[]
=
L"http:"
;
static
const
WCHAR
url11
[]
=
L"http"
;
static
const
WCHAR
url12
[]
=
L"net.tcp://host"
;
static
const
WCHAR
url13
[]
=
L"soap.udp://host"
;
static
const
WCHAR
url14
[]
=
L"net.pipe://host"
;
static
const
WCHAR
url15
[]
=
L"http:/host"
;
static
const
WCHAR
url16
[]
=
L"http:host"
;
static
const
WCHAR
url17
[]
=
L"http:///host"
;
static
const
WCHAR
url18
[]
=
L"http://host/"
;
static
const
WCHAR
url19
[]
=
L"http://host:/"
;
static
const
WCHAR
url20
[]
=
L"http://host:65536"
;
static
const
WCHAR
url21
[]
=
L"http://host?query"
;
static
const
WCHAR
url22
[]
=
L"http://host#frag"
;
static
const
WCHAR
url23
[]
=
L"http://host%202"
;
static
const
WCHAR
url24
[]
=
L"http://host/path%202"
;
static
const
WCHAR
url25
[]
=
L"http://host?query%202"
;
static
const
WCHAR
url26
[]
=
L"http://host#frag%202"
;
static
const
WCHAR
url27
[]
=
L"http://host/%c3%ab/"
;
static
const
struct
{
WCHAR
*
str
;
const
WCHAR
*
str
;
HRESULT
hr
;
WS_URL_SCHEME_TYPE
scheme
;
WCHAR
*
host
;
const
WCHAR
*
host
;
ULONG
host_len
;
USHORT
port
;
WCHAR
*
port_str
;
const
WCHAR
*
port_str
;
ULONG
port_len
;
WCHAR
*
path
;
const
WCHAR
*
path
;
ULONG
path_len
;
WCHAR
*
query
;
const
WCHAR
*
query
;
ULONG
query_len
;
WCHAR
*
fragment
;
const
WCHAR
*
fragment
;
ULONG
fragment_len
;
}
tests
[]
=
...
...
@@ -85,8 +75,7 @@ static void test_WsDecodeUrl(void)
{
url4
,
S_OK
,
WS_URL_HTTPS_SCHEME_TYPE
,
url4
+
8
,
4
,
80
,
url4
+
13
,
2
},
{
url5
,
S_OK
,
WS_URL_HTTP_SCHEME_TYPE
,
url5
+
7
,
4
,
80
,
NULL
,
0
,
url5
+
11
,
5
},
{
url6
,
S_OK
,
WS_URL_HTTP_SCHEME_TYPE
,
url5
+
7
,
4
,
80
,
NULL
,
0
,
url6
+
11
,
5
,
url6
+
17
,
5
},
{
url7
,
S_OK
,
WS_URL_HTTP_SCHEME_TYPE
,
url5
+
7
,
4
,
80
,
NULL
,
0
,
url7
+
11
,
5
,
url7
+
17
,
5
,
url7
+
23
,
4
},
{
url7
,
S_OK
,
WS_URL_HTTP_SCHEME_TYPE
,
url5
+
7
,
4
,
80
,
NULL
,
0
,
url7
+
11
,
5
,
url7
+
17
,
5
,
url7
+
23
,
4
},
{
url8
,
S_OK
,
WS_URL_HTTP_SCHEME_TYPE
,
url1
+
7
,
4
,
80
},
{
url9
,
WS_E_INVALID_FORMAT
},
{
url10
,
WS_E_INVALID_FORMAT
},
...
...
@@ -103,11 +92,11 @@ static void test_WsDecodeUrl(void)
{
url21
,
S_OK
,
WS_URL_HTTP_SCHEME_TYPE
,
url21
+
7
,
4
,
80
,
NULL
,
0
,
NULL
,
0
,
url21
+
12
,
5
},
{
url22
,
S_OK
,
WS_URL_HTTP_SCHEME_TYPE
,
url22
+
7
,
4
,
80
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
url22
+
12
,
4
},
{
url23
,
S_OK
,
WS_URL_HTTP_SCHEME_TYPE
,
host2
,
6
,
80
},
{
url24
,
S_OK
,
WS_URL_HTTP_SCHEME_TYPE
,
url24
+
7
,
4
,
80
,
NULL
,
0
,
path2
,
7
},
{
url25
,
S_OK
,
WS_URL_HTTP_SCHEME_TYPE
,
url25
+
7
,
4
,
80
,
NULL
,
0
,
NULL
,
0
,
query2
,
7
},
{
url26
,
S_OK
,
WS_URL_HTTP_SCHEME_TYPE
,
url26
+
7
,
4
,
80
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
frag2
,
6
},
{
url27
,
S_OK
,
WS_URL_HTTP_SCHEME_TYPE
,
url27
+
7
,
4
,
80
,
NULL
,
0
,
path3
,
3
},
{
url23
,
S_OK
,
WS_URL_HTTP_SCHEME_TYPE
,
L"host 2"
,
6
,
80
},
{
url24
,
S_OK
,
WS_URL_HTTP_SCHEME_TYPE
,
url24
+
7
,
4
,
80
,
NULL
,
0
,
L"/path 2"
,
7
},
{
url25
,
S_OK
,
WS_URL_HTTP_SCHEME_TYPE
,
url25
+
7
,
4
,
80
,
NULL
,
0
,
NULL
,
0
,
L"query 2"
,
7
},
{
url26
,
S_OK
,
WS_URL_HTTP_SCHEME_TYPE
,
url26
+
7
,
4
,
80
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
L"frag 2"
,
6
},
{
url27
,
S_OK
,
WS_URL_HTTP_SCHEME_TYPE
,
url27
+
7
,
4
,
80
,
NULL
,
0
,
L"/
\x00eb
/"
,
3
},
};
WS_HEAP
*
heap
;
WS_STRING
str
;
...
...
@@ -126,21 +115,19 @@ static void test_WsDecodeUrl(void)
hr
=
WsDecodeUrl
(
&
str
,
0
,
heap
,
(
WS_URL
**
)
&
url
,
NULL
);
ok
(
hr
==
WS_E_INVALID_FORMAT
,
"got %08x
\n
"
,
hr
);
str
.
chars
=
url1
;
str
.
chars
=
(
WCHAR
*
)
url1
;
str
.
length
=
lstrlenW
(
url1
);
hr
=
WsDecodeUrl
(
&
str
,
0
,
NULL
,
(
WS_URL
**
)
&
url
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
tests
);
i
++
)
{
static
const
WCHAR
netpipe
[]
=
{
'n'
,
'e'
,
't'
,
'.'
,
'p'
,
'i'
,
'p'
,
'e'
};
str
.
length
=
lstrlenW
(
tests
[
i
].
str
);
str
.
chars
=
tests
[
i
].
str
;
str
.
chars
=
(
WCHAR
*
)
tests
[
i
].
str
;
url
=
NULL
;
hr
=
WsDecodeUrl
(
&
str
,
0
,
heap
,
(
WS_URL
**
)
&
url
,
NULL
);
ok
(
hr
==
tests
[
i
].
hr
||
broken
(
hr
==
WS_E_INVALID_FORMAT
&&
str
.
length
>=
8
&&
!
memcmp
(
netpipe
,
str
.
chars
,
8
)),
broken
(
hr
==
WS_E_INVALID_FORMAT
&&
str
.
length
>=
8
&&
!
memcmp
(
L"net.pipe"
,
str
.
chars
,
8
)),
"%u: got %08x
\n
"
,
i
,
hr
);
if
(
hr
!=
S_OK
)
continue
;
...
...
@@ -193,42 +180,31 @@ static void test_WsDecodeUrl(void)
static
void
test_WsEncodeUrl
(
void
)
{
static
WCHAR
host
[]
=
{
'h'
,
'o'
,
's'
,
't'
};
static
WCHAR
host2
[]
=
{
'h'
,
'o'
,
's'
,
't'
,
' '
,
'2'
};
static
WCHAR
path
[]
=
{
'/'
,
'p'
,
'a'
,
't'
,
'h'
};
static
WCHAR
path2
[]
=
{
'/'
,
'p'
,
'a'
,
't'
,
'h'
,
' '
,
'2'
};
static
WCHAR
query
[]
=
{
'q'
,
'u'
,
'e'
,
'r'
,
'y'
};
static
WCHAR
query2
[]
=
{
'q'
,
'u'
,
'e'
,
'r'
,
'y'
,
' '
,
'2'
};
static
WCHAR
frag
[]
=
{
'f'
,
'r'
,
'a'
,
'g'
};
static
WCHAR
frag2
[]
=
{
'f'
,
'r'
,
'a'
,
'g'
,
' '
,
'2'
};
static
WCHAR
port
[]
=
{
'8'
,
'0'
,
'8'
,
'0'
};
static
WCHAR
port2
[]
=
{
'6'
,
'5'
,
'5'
,
'3'
,
'6'
};
static
const
WCHAR
url1
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
};
static
const
WCHAR
url2
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
};
static
const
WCHAR
url3
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'/'
,
'p'
,
'a'
,
't'
,
'h'
};
static
const
WCHAR
url4
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'?'
,
'q'
,
'u'
,
'e'
,
'r'
,
'y'
};
static
const
WCHAR
url5
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'#'
,
'f'
,
'r'
,
'a'
,
'g'
};
static
const
WCHAR
url6
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
':'
,
'8'
,
'0'
,
'8'
,
'0'
,
'/'
,
'p'
,
'a'
,
't'
,
'h'
,
'?'
,
'q'
,
'u'
,
'e'
,
'r'
,
'y'
,
'#'
,
'f'
,
'r'
,
'a'
,
'g'
};
static
const
WCHAR
url7
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
':'
,
'8'
,
'0'
,
'8'
,
'0'
};
static
const
WCHAR
url8
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
};
static
const
WCHAR
url9
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'/'
,
'p'
,
'a'
,
't'
,
'h'
,
'%'
,
'2'
,
'0'
,
'2'
};
static
const
WCHAR
url10
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'?'
,
'q'
,
'u'
,
'e'
,
'r'
,
'y'
,
'%'
,
'2'
,
'0'
,
'2'
};
static
const
WCHAR
url11
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'#'
,
'f'
,
'r'
,
'a'
,
'g'
,
'%'
,
'2'
,
'0'
,
'2'
};
static
const
WCHAR
url12
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'h'
,
'o'
,
's'
,
't'
,
'%'
,
'2'
,
'0'
,
'2'
};
static
const
WCHAR
url1
[]
=
L"http://host"
;
static
const
WCHAR
url2
[]
=
L"http://"
;
static
const
WCHAR
url3
[]
=
L"http:///path"
;
static
const
WCHAR
url4
[]
=
L"http://?query"
;
static
const
WCHAR
url5
[]
=
L"http://#frag"
;
static
const
WCHAR
url6
[]
=
L"http://host:8080/path?query#frag"
;
static
const
WCHAR
url7
[]
=
L"http://:8080"
;
static
const
WCHAR
url8
[]
=
L"http://"
;
static
const
WCHAR
url9
[]
=
L"http:///path%202"
;
static
const
WCHAR
url10
[]
=
L"http://?query%202"
;
static
const
WCHAR
url11
[]
=
L"http://#frag%202"
;
static
const
WCHAR
url12
[]
=
L"http://host%202"
;
static
const
struct
{
WS_URL_SCHEME_TYPE
scheme
;
WCHAR
*
host
;
const
WCHAR
*
host
;
ULONG
host_len
;
USHORT
port
;
WCHAR
*
port_str
;
const
WCHAR
*
port_str
;
ULONG
port_len
;
WCHAR
*
path
;
const
WCHAR
*
path
;
ULONG
path_len
;
WCHAR
*
query
;
const
WCHAR
*
query
;
ULONG
query_len
;
WCHAR
*
fragment
;
const
WCHAR
*
fragment
;
ULONG
fragment_len
;
HRESULT
hr
;
ULONG
len
;
...
...
@@ -236,22 +212,22 @@ static void test_WsEncodeUrl(void)
}
tests
[]
=
{
{
WS_URL_HTTP_SCHEME_TYPE
,
host
,
4
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
S_OK
,
11
,
url1
},
{
WS_URL_HTTP_SCHEME_TYPE
,
L"host"
,
4
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
S_OK
,
11
,
url1
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
S_OK
,
7
,
url2
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
0
,
NULL
,
0
,
path
,
5
,
NULL
,
0
,
NULL
,
0
,
S_OK
,
12
,
url3
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
0
,
NULL
,
0
,
NULL
,
0
,
query
,
5
,
NULL
,
0
,
S_OK
,
13
,
url4
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
frag
,
4
,
S_OK
,
12
,
url5
},
{
WS_URL_HTTP_SCHEME_TYPE
,
host
,
4
,
0
,
port
,
4
,
path
,
5
,
query
,
5
,
frag
,
4
,
S_OK
,
32
,
url6
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
0
,
NULL
,
0
,
L"/path"
,
5
,
NULL
,
0
,
NULL
,
0
,
S_OK
,
12
,
url3
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
0
,
NULL
,
0
,
NULL
,
0
,
L"query"
,
5
,
NULL
,
0
,
S_OK
,
13
,
url4
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
L"frag"
,
4
,
S_OK
,
12
,
url5
},
{
WS_URL_HTTP_SCHEME_TYPE
,
L"host"
,
4
,
0
,
L"8080"
,
4
,
L"/path"
,
5
,
L"query"
,
5
,
L"frag"
,
4
,
S_OK
,
32
,
url6
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
8080
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
S_OK
,
12
,
url7
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
0
,
port
,
4
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
S_OK
,
12
,
url7
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
8080
,
port
,
4
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
S_OK
,
12
,
url7
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
8181
,
port
,
4
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
E_INVALIDARG
,
0
,
NULL
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
0
,
port2
,
5
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
WS_E_INVALID_FORMAT
,
0
,
NULL
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
0
,
L"8080"
,
4
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
S_OK
,
12
,
url7
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
8080
,
L"8080"
,
4
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
S_OK
,
12
,
url7
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
8181
,
L"8080"
,
4
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
E_INVALIDARG
,
0
,
NULL
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
0
,
L"65536"
,
5
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
WS_E_INVALID_FORMAT
,
0
,
NULL
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
80
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
S_OK
,
7
,
url8
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
0
,
NULL
,
0
,
path2
,
7
,
NULL
,
0
,
NULL
,
0
,
S_OK
,
16
,
url9
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
0
,
NULL
,
0
,
NULL
,
0
,
query2
,
7
,
NULL
,
0
,
S_OK
,
17
,
url10
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
frag2
,
6
,
S_OK
,
16
,
url11
},
{
WS_URL_HTTP_SCHEME_TYPE
,
host2
,
6
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
S_OK
,
15
,
url12
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
0
,
NULL
,
0
,
L"/path 2"
,
7
,
NULL
,
0
,
NULL
,
0
,
S_OK
,
16
,
url9
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
0
,
NULL
,
0
,
NULL
,
0
,
L"query 2"
,
7
,
NULL
,
0
,
S_OK
,
17
,
url10
},
{
WS_URL_HTTP_SCHEME_TYPE
,
NULL
,
0
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
L"frag 2"
,
6
,
S_OK
,
16
,
url11
},
{
WS_URL_HTTP_SCHEME_TYPE
,
L"host 2"
,
6
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
,
0
,
S_OK
,
15
,
url12
},
};
WS_HEAP
*
heap
;
WS_STRING
str
;
...
...
@@ -275,16 +251,16 @@ static void test_WsEncodeUrl(void)
{
memset
(
&
url
,
0
,
sizeof
(
url
)
);
url
.
url
.
scheme
=
tests
[
i
].
scheme
;
url
.
host
.
chars
=
tests
[
i
].
host
;
url
.
host
.
chars
=
(
WCHAR
*
)
tests
[
i
].
host
;
url
.
host
.
length
=
tests
[
i
].
host_len
;
url
.
port
=
tests
[
i
].
port
;
url
.
portAsString
.
chars
=
tests
[
i
].
port_str
;
url
.
portAsString
.
chars
=
(
WCHAR
*
)
tests
[
i
].
port_str
;
url
.
portAsString
.
length
=
tests
[
i
].
port_len
;
url
.
path
.
chars
=
tests
[
i
].
path
;
url
.
path
.
chars
=
(
WCHAR
*
)
tests
[
i
].
path
;
url
.
path
.
length
=
tests
[
i
].
path_len
;
url
.
query
.
chars
=
tests
[
i
].
query
;
url
.
query
.
chars
=
(
WCHAR
*
)
tests
[
i
].
query
;
url
.
query
.
length
=
tests
[
i
].
query_len
;
url
.
fragment
.
chars
=
tests
[
i
].
fragment
;
url
.
fragment
.
chars
=
(
WCHAR
*
)
tests
[
i
].
fragment
;
url
.
fragment
.
length
=
tests
[
i
].
fragment_len
;
memset
(
&
str
,
0
,
sizeof
(
str
)
);
...
...
dlls/webservices/tests/writer.c
View file @
f735ffbf
...
...
@@ -549,7 +549,6 @@ static void test_WsWriteStartAttribute(void)
static
void
test_WsWriteType
(
void
)
{
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
HRESULT
hr
;
WS_XML_WRITER
*
writer
;
WS_XML_STRING
prefix
=
{
1
,
(
BYTE
*
)
"p"
},
localname
=
{
3
,
(
BYTE
*
)
"str"
},
ns
=
{
2
,
(
BYTE
*
)
"ns"
};
...
...
@@ -566,7 +565,7 @@ static void test_WsWriteType(void)
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
val_str
=
testW
;
val_str
=
L"test"
;
hr
=
WsWriteType
(
writer
,
WS_ELEMENT_TYPE_MAPPING
,
WS_WSZ_TYPE
,
NULL
,
WS_WRITE_REQUIRED_POINTER
,
&
val_str
,
sizeof
(
val_str
),
NULL
);
ok
(
hr
==
WS_E_INVALID_FORMAT
,
"got %08x
\n
"
,
hr
);
...
...
@@ -579,11 +578,11 @@ static void test_WsWriteType(void)
/* required value */
hr
=
WsWriteType
(
writer
,
WS_ELEMENT_TYPE_MAPPING
,
WS_WSZ_TYPE
,
NULL
,
WS_WRITE_REQUIRED_VALUE
,
NULL
,
sizeof
(
testW
),
NULL
);
WS_WRITE_REQUIRED_VALUE
,
NULL
,
sizeof
(
L"test"
),
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteType
(
writer
,
WS_ELEMENT_TYPE_MAPPING
,
WS_WSZ_TYPE
,
NULL
,
WS_WRITE_REQUIRED_VALUE
,
testW
,
sizeof
(
testW
),
NULL
);
WS_WRITE_REQUIRED_VALUE
,
L"test"
,
sizeof
(
L"test"
),
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
/* required pointer */
...
...
@@ -592,7 +591,7 @@ static void test_WsWriteType(void)
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteType
(
writer
,
WS_ELEMENT_TYPE_MAPPING
,
WS_WSZ_TYPE
,
NULL
,
WS_WRITE_REQUIRED_VALUE
,
testW
,
sizeof
(
testW
),
NULL
);
WS_WRITE_REQUIRED_VALUE
,
L"test"
,
sizeof
(
L"test"
),
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteType
(
writer
,
WS_ELEMENT_TYPE_MAPPING
,
WS_WSZ_TYPE
,
NULL
,
...
...
@@ -613,7 +612,7 @@ static void test_WsWriteType(void)
hr
=
WsWriteStartAttribute
(
writer
,
NULL
,
&
localname
,
&
ns
,
FALSE
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
val_str
=
testW
;
val_str
=
L"test"
;
hr
=
WsWriteType
(
writer
,
WS_ATTRIBUTE_TYPE_MAPPING
,
WS_WSZ_TYPE
,
NULL
,
WS_WRITE_REQUIRED_POINTER
,
&
val_str
,
sizeof
(
val_str
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -633,7 +632,7 @@ static void test_WsWriteType(void)
hr
=
WsWriteStartElement
(
writer
,
&
prefix
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
val_str
=
testW
;
val_str
=
L"test"
;
hr
=
WsWriteType
(
writer
,
WS_ELEMENT_CONTENT_TYPE_MAPPING
,
WS_WSZ_TYPE
,
NULL
,
WS_WRITE_REQUIRED_POINTER
,
&
val_str
,
sizeof
(
val_str
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -689,12 +688,11 @@ static void prepare_basic_type_test( WS_XML_WRITER *writer )
static
void
test_basic_type
(
void
)
{
static
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
HRESULT
hr
;
WS_XML_WRITER
*
writer
;
WS_XML_STRING
localname
=
{
1
,
(
BYTE
*
)
"t"
},
ns
=
{
0
,
NULL
},
xmlstr
;
GUID
guid
;
WCHAR
*
str
;
const
WCHAR
*
str
;
WS_STRING
string
;
WS_BYTES
bytes
;
WS_UNIQUE_ID
id
;
...
...
@@ -784,7 +782,7 @@ static void test_basic_type(void)
check_output
(
writer
,
"<t>00000000-0000-0000-0000-000000000000</t>"
,
__LINE__
);
prepare_basic_type_test
(
writer
);
string
.
chars
=
testW
;
string
.
chars
=
(
WCHAR
*
)
L"test"
;
string
.
length
=
4
;
hr
=
WsWriteType
(
writer
,
WS_ELEMENT_TYPE_MAPPING
,
WS_STRING_TYPE
,
NULL
,
WS_WRITE_REQUIRED_VALUE
,
&
string
,
sizeof
(
string
),
NULL
);
...
...
@@ -794,7 +792,7 @@ static void test_basic_type(void)
check_output
(
writer
,
"<t>test</t>"
,
__LINE__
);
prepare_basic_type_test
(
writer
);
str
=
testW
;
str
=
L"test"
;
hr
=
WsWriteType
(
writer
,
WS_ELEMENT_TYPE_MAPPING
,
WS_WSZ_TYPE
,
NULL
,
WS_WRITE_REQUIRED_POINTER
,
&
str
,
sizeof
(
str
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -860,7 +858,7 @@ static void test_basic_type(void)
prepare_basic_type_test
(
writer
);
id
.
uri
.
length
=
4
;
id
.
uri
.
chars
=
testW
;
id
.
uri
.
chars
=
(
WCHAR
*
)
L"test"
;
hr
=
WsWriteType
(
writer
,
WS_ELEMENT_TYPE_MAPPING
,
WS_UNIQUE_ID_TYPE
,
NULL
,
WS_WRITE_REQUIRED_VALUE
,
&
id
,
sizeof
(
id
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -873,7 +871,6 @@ static void test_basic_type(void)
static
void
test_simple_struct_type
(
void
)
{
static
const
WCHAR
valueW
[]
=
{
'v'
,
'a'
,
'l'
,
'u'
,
'e'
,
0
};
HRESULT
hr
;
WS_XML_WRITER
*
writer
;
WS_STRUCT_DESCRIPTION
s
;
...
...
@@ -905,7 +902,7 @@ static void test_simple_struct_type(void)
s
.
fieldCount
=
1
;
test
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
test
)
);
test
->
field
=
valueW
;
test
->
field
=
L"value"
;
hr
=
WsWriteType
(
writer
,
WS_ELEMENT_CONTENT_TYPE_MAPPING
,
WS_STRUCT_TYPE
,
NULL
,
WS_WRITE_REQUIRED_POINTER
,
&
test
,
sizeof
(
test
),
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
...
...
@@ -977,7 +974,6 @@ static void test_simple_struct_type(void)
static
void
test_WsWriteElement
(
void
)
{
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
HRESULT
hr
;
WS_XML_WRITER
*
writer
;
WS_STRUCT_DESCRIPTION
s
;
...
...
@@ -1010,7 +1006,7 @@ static void test_WsWriteElement(void)
desc
.
typeDescription
=
&
s
;
test
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
test
)
);
test
->
str
=
testW
;
test
->
str
=
L"test"
;
hr
=
WsWriteElement
(
NULL
,
&
desc
,
WS_WRITE_REQUIRED_POINTER
,
&
test
,
sizeof
(
test
),
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
...
...
@@ -1165,7 +1161,6 @@ static void test_WsWriteValue(void)
static
void
test_WsWriteAttribute
(
void
)
{
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
HRESULT
hr
;
WS_XML_WRITER
*
writer
;
WS_STRUCT_DESCRIPTION
s
;
...
...
@@ -1198,7 +1193,7 @@ static void test_WsWriteAttribute(void)
desc
.
typeDescription
=
&
s
;
test
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
test
)
);
test
->
str
=
testW
;
test
->
str
=
L"test"
;
hr
=
WsWriteAttribute
(
NULL
,
&
desc
,
WS_WRITE_REQUIRED_POINTER
,
&
test
,
sizeof
(
test
),
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
...
...
@@ -1580,8 +1575,6 @@ static void test_complex_struct_type(void)
"<o:OfficeConfig xmlns:o=
\"
urn:schemas-microsoft-com:office:office
\"
>"
"<o:services o:GenerationTime=
\"
2015-09-03T18:47:54
\"
/>"
"</o:OfficeConfig>"
;
static
const
WCHAR
timestampW
[]
=
{
'2'
,
'0'
,
'1'
,
'5'
,
'-'
,
'0'
,
'9'
,
'-'
,
'0'
,
'3'
,
'T'
,
'1'
,
'8'
,
':'
,
'4'
,
'7'
,
':'
,
'5'
,
'4'
,
0
};
WS_XML_STRING
str_officeconfig
=
{
12
,
(
BYTE
*
)
"OfficeConfig"
};
WS_XML_STRING
str_services
=
{
8
,
(
BYTE
*
)
"services"
};
WS_XML_STRING
str_generationtime
=
{
14
,
(
BYTE
*
)
"GenerationTime"
};
...
...
@@ -1654,7 +1647,7 @@ static void test_complex_struct_type(void)
size
=
sizeof
(
struct
officeconfig
)
+
sizeof
(
struct
services
);
test
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
size
);
test
->
services
=
(
struct
services
*
)(
test
+
1
);
test
->
services
->
generationtime
=
timestampW
;
test
->
services
->
generationtime
=
L"2015-09-03T18:47:54"
;
hr
=
WsWriteType
(
writer
,
WS_ELEMENT_CONTENT_TYPE_MAPPING
,
WS_STRUCT_TYPE
,
&
s
,
WS_WRITE_REQUIRED_POINTER
,
&
test
,
sizeof
(
test
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -2141,7 +2134,6 @@ static void test_WsCopyNode(void)
static
void
test_text_types
(
void
)
{
static
const
WCHAR
utf16W
[]
=
{
'u'
,
't'
,
'f'
,
'1'
,
'6'
};
WS_XML_STRING
prefix
=
{
1
,
(
BYTE
*
)
"p"
},
localname
=
{
1
,
(
BYTE
*
)
"t"
},
localname2
=
{
1
,
(
BYTE
*
)
"u"
};
WS_XML_STRING
ns
=
{
0
,
NULL
},
ns2
=
{
2
,
(
BYTE
*
)
"ns"
};
WS_XML_WRITER
*
writer
;
...
...
@@ -2180,8 +2172,8 @@ static void test_text_types(void)
HRESULT
hr
;
ULONG
i
;
val_utf16
.
bytes
=
(
BYTE
*
)
utf16W
;
val_utf16
.
byteCount
=
sizeof
(
utf16W
)
;
val_utf16
.
bytes
=
(
BYTE
*
)
L"utf16"
;
val_utf16
.
byteCount
=
10
;
val_qname
.
localName
=
&
localname2
;
val_qname
.
ns
=
&
ns
;
...
...
@@ -2432,7 +2424,6 @@ static void test_field_options(void)
static
void
test_WsWriteText
(
void
)
{
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
};
WS_XML_STRING
localname
=
{
1
,
(
BYTE
*
)
"t"
},
localname2
=
{
1
,
(
BYTE
*
)
"a"
},
ns
=
{
0
,
NULL
};
HRESULT
hr
;
WS_XML_WRITER
*
writer
;
...
...
@@ -2504,8 +2495,8 @@ static void test_WsWriteText(void)
hr
=
WsWriteStartElement
(
writer
,
NULL
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
utf16
.
bytes
=
(
BYTE
*
)
testW
;
utf16
.
byteCount
=
sizeof
(
testW
)
;
utf16
.
bytes
=
(
BYTE
*
)
L"test"
;
utf16
.
byteCount
=
8
;
hr
=
WsWriteText
(
writer
,
&
utf16
.
text
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<t>test"
,
__LINE__
);
...
...
@@ -2852,11 +2843,10 @@ static void test_escapes(void)
static
void
test_write_option
(
void
)
{
static
const
WCHAR
sW
[]
=
{
's'
,
0
};
static
const
WS_XML_STRING
localname
=
{
1
,
(
BYTE
*
)
"t"
},
ns
=
{
0
,
NULL
};
WS_XML_WRITER
*
writer
;
int
val_int
=
-
1
,
val_int_zero
=
0
,
*
ptr_int
=
&
val_int
,
*
ptr_int_null
=
NULL
;
const
WCHAR
*
ptr_wsz
=
sW
,
*
ptr_wsz_null
=
NULL
;
const
WCHAR
*
ptr_wsz
=
L"s"
,
*
ptr_wsz_null
=
NULL
;
static
const
WS_XML_STRING
val_xmlstr
=
{
1
,
(
BYTE
*
)
"x"
},
val_xmlstr_zero
=
{
0
,
NULL
};
const
WS_XML_STRING
*
ptr_xmlstr
=
&
val_xmlstr
,
*
ptr_xmlstr_null
=
NULL
;
struct
...
...
@@ -3060,7 +3050,6 @@ static void test_datetime(void)
static
void
test_repeating_element
(
void
)
{
static
const
WCHAR
oneW
[]
=
{
'1'
,
0
},
twoW
[]
=
{
'2'
,
0
};
WS_XML_STRING
localname
=
{
4
,
(
BYTE
*
)
"test"
},
ns
=
{
0
,
NULL
};
WS_XML_STRING
val
=
{
3
,
(
BYTE
*
)
"val"
},
wrapper
=
{
7
,
(
BYTE
*
)
"wrapper"
};
HRESULT
hr
;
...
...
@@ -3113,8 +3102,8 @@ static void test_repeating_element(void)
test
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
test
)
+
2
*
sizeof
(
const
WCHAR
*
)
);
test
->
val
=
(
const
WCHAR
**
)(
test
+
1
);
test
->
val
[
0
]
=
oneW
;
test
->
val
[
1
]
=
twoW
;
test
->
val
[
0
]
=
L"1"
;
test
->
val
[
1
]
=
L"2"
;
test
->
count
=
2
;
hr
=
WsWriteType
(
writer
,
WS_ELEMENT_TYPE_MAPPING
,
WS_STRUCT_TYPE
,
&
s
,
WS_WRITE_REQUIRED_POINTER
,
&
test
,
sizeof
(
test
),
NULL
);
...
...
@@ -3317,7 +3306,6 @@ static void test_WsWriteBytes(void)
static
void
test_WsWriteChars
(
void
)
{
WS_XML_STRING
localname
=
{
1
,
(
BYTE
*
)
"t"
},
localname2
=
{
1
,
(
BYTE
*
)
"a"
},
ns
=
{
0
,
NULL
};
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
};
WS_XML_WRITER
*
writer
;
HRESULT
hr
;
...
...
@@ -3330,19 +3318,19 @@ static void test_WsWriteChars(void)
hr
=
WsWriteChars
(
writer
,
NULL
,
0
,
NULL
);
ok
(
hr
==
WS_E_INVALID_OPERATION
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteChars
(
writer
,
testW
,
0
,
NULL
);
hr
=
WsWriteChars
(
writer
,
L"test"
,
0
,
NULL
);
ok
(
hr
==
WS_E_INVALID_OPERATION
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteChars
(
writer
,
NULL
,
1
,
NULL
);
ok
(
hr
==
WS_E_INVALID_OPERATION
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteChars
(
writer
,
testW
,
4
,
NULL
);
hr
=
WsWriteChars
(
writer
,
L"test"
,
4
,
NULL
);
ok
(
hr
==
WS_E_INVALID_OPERATION
,
"got %08x
\n
"
,
hr
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteChars
(
writer
,
testW
,
4
,
NULL
);
hr
=
WsWriteChars
(
writer
,
L"test"
,
4
,
NULL
);
ok
(
hr
==
WS_E_INVALID_FORMAT
,
"got %08x
\n
"
,
hr
);
hr
=
set_output
(
writer
);
...
...
@@ -3352,10 +3340,10 @@ static void test_WsWriteChars(void)
hr
=
WsWriteStartElement
(
writer
,
NULL
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteChars
(
writer
,
testW
,
4
,
NULL
);
hr
=
WsWriteChars
(
writer
,
L"test"
,
4
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteChars
(
writer
,
testW
,
4
,
NULL
);
hr
=
WsWriteChars
(
writer
,
L"test"
,
4
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteEndElement
(
writer
,
NULL
);
...
...
@@ -3372,10 +3360,10 @@ static void test_WsWriteChars(void)
hr
=
WsWriteStartAttribute
(
writer
,
NULL
,
&
localname2
,
&
ns
,
FALSE
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteChars
(
writer
,
testW
,
4
,
NULL
);
hr
=
WsWriteChars
(
writer
,
L"test"
,
4
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteChars
(
writer
,
testW
,
4
,
NULL
);
hr
=
WsWriteChars
(
writer
,
L"test"
,
4
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteEndAttribute
(
writer
,
NULL
);
...
...
@@ -3904,7 +3892,6 @@ static void test_dictionary(void)
static
void
test_union_type
(
void
)
{
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
static
WS_XML_STRING
str_ns
=
{
0
,
NULL
},
str_a
=
{
1
,
(
BYTE
*
)
"a"
},
str_b
=
{
1
,
(
BYTE
*
)
"b"
};
static
WS_XML_STRING
str_none
=
{
4
,
(
BYTE
*
)
"none"
},
str_s
=
{
1
,
(
BYTE
*
)
"s"
},
str_t
=
{
1
,
(
BYTE
*
)
"t"
};
HRESULT
hr
;
...
...
@@ -3974,7 +3961,7 @@ static void test_union_type(void)
hr
=
WsWriteStartElement
(
writer
,
NULL
,
&
str_t
,
&
str_ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
test
.
choice
=
CHOICE_A
;
test
.
value
.
a
=
testW
;
test
.
value
.
a
=
L"test"
;
hr
=
WsWriteType
(
writer
,
WS_ELEMENT_CONTENT_TYPE_MAPPING
,
WS_STRUCT_TYPE
,
&
s
,
WS_WRITE_REQUIRED_VALUE
,
&
test
,
sizeof
(
test
),
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -4069,7 +4056,6 @@ static void prepare_binary_type_test( WS_XML_WRITER *writer, const WS_XML_STRING
static
void
test_text_types_binary
(
void
)
{
static
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
};
static
WS_XML_STRING
str_s
=
{
1
,
(
BYTE
*
)
"s"
},
str_t
=
{
1
,
(
BYTE
*
)
"t"
},
str_u
=
{
1
,
(
BYTE
*
)
"u"
};
static
WS_XML_STRING
str_ns
=
{
0
,
NULL
};
static
const
char
res
[]
=
...
...
@@ -4310,7 +4296,7 @@ static void test_text_types_binary(void)
prepare_binary_type_test
(
writer
,
NULL
,
&
str_t
,
&
str_ns
);
test
.
type
=
WS_XML_TEXT_TYPE_UTF16
;
test
.
u
.
val_utf16
.
chars
=
testW
;
test
.
u
.
val_utf16
.
chars
=
(
WCHAR
*
)
L"test"
;
test
.
u
.
val_utf16
.
length
=
4
;
hr
=
WsWriteType
(
writer
,
WS_ELEMENT_CONTENT_TYPE_MAPPING
,
WS_STRUCT_TYPE
,
&
s
,
WS_WRITE_REQUIRED_VALUE
,
&
test
,
sizeof
(
test
),
NULL
);
...
...
@@ -4575,7 +4561,6 @@ static void test_text_types_binary(void)
static
void
test_repeating_element_choice
(
void
)
{
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
static
WS_XML_STRING
str_ns
=
{
0
,
NULL
},
str_a
=
{
1
,
(
BYTE
*
)
"a"
},
str_b
=
{
1
,
(
BYTE
*
)
"b"
};
static
WS_XML_STRING
str_s
=
{
1
,
(
BYTE
*
)
"s"
},
str_t
=
{
1
,
(
BYTE
*
)
"t"
};
HRESULT
hr
;
...
...
@@ -4647,7 +4632,7 @@ static void test_repeating_element_choice(void)
s
.
typeNs
=
&
str_ns
;
items
[
0
].
choice
=
CHOICE_A
;
items
[
0
].
value
.
a
=
testW
;
items
[
0
].
value
.
a
=
L"test"
;
items
[
1
].
choice
=
CHOICE_B
;
items
[
1
].
value
.
b
=
1
;
test
.
items
=
items
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment