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
038cb118
Commit
038cb118
authored
Nov 11, 2015
by
Hans Leidekker
Committed by
Alexandre Julliard
Nov 11, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices/tests: Add more tests.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
83e4e135
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
163 additions
and
1 deletion
+163
-1
reader.c
dlls/webservices/tests/reader.c
+163
-1
No files found.
dlls/webservices/tests/reader.c
View file @
038cb118
...
...
@@ -29,7 +29,7 @@ static const char data2[] =
static
const
char
data3
[]
=
"<?xml version=
\"
1.0
\"
encoding=
\"
utf-8
\"
?>"
"<text>test</
text
>"
;
"<text>test</
TEXT
>"
;
static
const
char
data4
[]
=
"<?xml version=
\"
1.0
\"
encoding=
\"
utf-8
\"
?>
\r\n
"
...
...
@@ -61,6 +61,9 @@ static const char data8[] =
static
const
char
data9
[]
=
"<text xml:attr=
\"
value
\"
>test</text>"
;
static
const
char
data10
[]
=
"<a></b>"
;
static
void
test_WsCreateError
(
void
)
{
HRESULT
hr
;
...
...
@@ -584,6 +587,32 @@ static void test_WsFillReader(void)
WS_XML_READER
*
reader
;
const
WS_XML_NODE
*
node
;
/* what happens of we don't call WsFillReader? */
hr
=
WsCreateReader
(
NULL
,
0
,
&
reader
,
NULL
)
;
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
node
=
NULL
;
hr
=
WsGetReaderNode
(
reader
,
&
node
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
if
(
node
)
ok
(
node
->
nodeType
==
WS_XML_NODE_TYPE_EOF
,
"got %u
\n
"
,
node
->
nodeType
);
hr
=
set_input
(
reader
,
data1
,
sizeof
(
data1
)
-
1
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
node
=
NULL
;
hr
=
WsGetReaderNode
(
reader
,
&
node
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
if
(
node
)
ok
(
node
->
nodeType
==
WS_XML_NODE_TYPE_BOF
,
"got %u
\n
"
,
node
->
nodeType
);
hr
=
WsReadNode
(
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
node
=
NULL
;
hr
=
WsGetReaderNode
(
reader
,
&
node
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
if
(
node
)
ok
(
node
->
nodeType
==
WS_XML_NODE_TYPE_EOF
,
"got %u
\n
"
,
node
->
nodeType
);
WsFreeReader
(
reader
);
hr
=
WsCreateReader
(
NULL
,
0
,
&
reader
,
NULL
)
;
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -903,6 +932,22 @@ static void test_WsReadEndElement(void)
hr
=
WsReadEndElement
(
reader
,
NULL
);
ok
(
hr
==
WS_E_INVALID_FORMAT
,
"got %08x
\n
"
,
hr
);
hr
=
set_input
(
reader
,
data10
,
sizeof
(
data10
)
-
1
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsFillReader
(
reader
,
sizeof
(
data10
)
-
1
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsReadNode
(
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsGetReaderNode
(
reader
,
&
node
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
if
(
node
)
ok
(
node
->
nodeType
==
WS_XML_NODE_TYPE_ELEMENT
,
"got %u
\n
"
,
node
->
nodeType
);
hr
=
WsReadEndElement
(
reader
,
NULL
);
ok
(
hr
==
WS_E_INVALID_FORMAT
,
"got %08x
\n
"
,
hr
);
WsFreeReader
(
reader
);
}
...
...
@@ -1479,6 +1524,122 @@ static void test_WsAlloc(void)
WsFreeHeap
(
heap
);
}
static
void
test_WsMoveReader
(
void
)
{
HRESULT
hr
;
WS_HEAP
*
heap
;
WS_XML_READER
*
reader
;
WS_XML_WRITER
*
writer
;
WS_XML_BUFFER
*
buffer
;
WS_XML_STRING
localname
=
{
1
,
(
BYTE
*
)
"a"
},
localname2
=
{
1
,
(
BYTE
*
)
"b"
},
ns
=
{
0
,
NULL
};
const
WS_XML_NODE
*
node
;
WS_XML_ELEMENT_NODE
*
elem
;
hr
=
WsCreateReader
(
NULL
,
0
,
&
reader
,
NULL
)
;
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsMoveReader
(
NULL
,
WS_MOVE_TO_EOF
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
/* reader must be set to an XML buffer */
hr
=
WsMoveReader
(
reader
,
WS_MOVE_TO_EOF
,
NULL
,
NULL
);
ok
(
hr
==
WS_E_INVALID_OPERATION
,
"got %08x
\n
"
,
hr
);
hr
=
set_input
(
reader
,
data8
,
sizeof
(
data8
)
-
1
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsMoveReader
(
reader
,
WS_MOVE_TO_EOF
,
NULL
,
NULL
);
todo_wine
ok
(
hr
==
WS_E_INVALID_OPERATION
,
"got %08x
\n
"
,
hr
);
WsFreeReader
(
reader
);
hr
=
WsCreateHeap
(
1
<<
16
,
0
,
NULL
,
0
,
&
heap
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsCreateXmlBuffer
(
heap
,
NULL
,
0
,
&
buffer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsCreateWriter
(
NULL
,
0
,
&
writer
,
NULL
)
;
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsSetOutputToBuffer
(
writer
,
buffer
,
NULL
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
/* <a><b/></a> */
hr
=
WsWriteStartElement
(
writer
,
NULL
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteStartElement
(
writer
,
NULL
,
&
localname2
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteEndElement
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteEndElement
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsCreateReader
(
NULL
,
0
,
&
reader
,
NULL
)
;
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsMoveReader
(
reader
,
WS_MOVE_TO_EOF
,
NULL
,
NULL
);
ok
(
hr
==
WS_E_INVALID_OPERATION
,
"got %08x
\n
"
,
hr
);
hr
=
WsSetInputToBuffer
(
reader
,
buffer
,
NULL
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
/* first element is child node of BOF node */
hr
=
WsMoveReader
(
reader
,
WS_MOVE_TO_BOF
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsMoveReader
(
reader
,
WS_MOVE_TO_CHILD_NODE
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsGetReaderNode
(
reader
,
&
node
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
elem
=
(
WS_XML_ELEMENT_NODE
*
)
node
;
ok
(
elem
->
node
.
nodeType
==
WS_XML_NODE_TYPE_ELEMENT
,
"got %u
\n
"
,
elem
->
node
.
nodeType
);
ok
(
elem
->
localName
->
length
==
1
,
"got %u
\n
"
,
elem
->
localName
->
length
);
ok
(
!
memcmp
(
elem
->
localName
->
bytes
,
"a"
,
1
),
"wrong data
\n
"
);
hr
=
WsMoveReader
(
reader
,
WS_MOVE_TO_CHILD_NODE
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsGetReaderNode
(
reader
,
&
node
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
elem
=
(
WS_XML_ELEMENT_NODE
*
)
node
;
ok
(
elem
->
node
.
nodeType
==
WS_XML_NODE_TYPE_ELEMENT
,
"got %u
\n
"
,
elem
->
node
.
nodeType
);
ok
(
elem
->
localName
->
length
==
1
,
"got %u
\n
"
,
elem
->
localName
->
length
);
ok
(
!
memcmp
(
elem
->
localName
->
bytes
,
"b"
,
1
),
"wrong data
\n
"
);
hr
=
WsMoveReader
(
reader
,
WS_MOVE_TO_NEXT_NODE
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsGetReaderNode
(
reader
,
&
node
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
node
->
nodeType
==
WS_XML_NODE_TYPE_END_ELEMENT
,
"got %u
\n
"
,
elem
->
node
.
nodeType
);
/* EOF node is last child of BOF node */
hr
=
WsMoveReader
(
reader
,
WS_MOVE_TO_BOF
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsMoveReader
(
reader
,
WS_MOVE_TO_CHILD_NODE
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsGetReaderNode
(
reader
,
&
node
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
node
->
nodeType
==
WS_XML_NODE_TYPE_ELEMENT
,
"got %u
\n
"
,
elem
->
node
.
nodeType
);
hr
=
WsMoveReader
(
reader
,
WS_MOVE_TO_NEXT_NODE
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsGetReaderNode
(
reader
,
&
node
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
node
->
nodeType
==
WS_XML_NODE_TYPE_EOF
,
"got %u
\n
"
,
elem
->
node
.
nodeType
);
WsFreeReader
(
reader
);
WsFreeWriter
(
writer
);
WsFreeHeap
(
heap
);
}
START_TEST
(
reader
)
{
test_WsCreateError
();
...
...
@@ -1495,4 +1656,5 @@ START_TEST(reader)
test_WsGetXmlAttribute
();
test_WsXmlStringEquals
();
test_WsAlloc
();
test_WsMoveReader
();
}
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