src/server/test/xml.h

Fri, 17 Jan 2020 19:08:19 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 17 Jan 2020 19:08:19 +0100
branch
webdav
changeset 228
c0afce708b1d
parent 225
e4f3e1433098
child 232
499711b2a970
permissions
-rw-r--r--

add tests for some webdav plist util functions

224
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 *
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 * Copyright 2020 Olaf Wintermann. All rights reserved.
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 *
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 *
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 *
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 *
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 */
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 #ifndef TEST_XML_H
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 #define TEST_XML_H
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 #include "../public/nsapi.h"
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33 #include <ucx/test.h>
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35 #ifdef __cplusplus
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 extern "C" {
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37 #endif
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 UCX_TEST(test_wsxml_iterator);
225
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
40 UCX_TEST(test_wsxml_get_required_namespaces);
224
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43 #define XML_TESTDATA1 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44 <test> \
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45 <elm1>teststr</elm1> \
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 <!-- comment -->\
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 <elm2 /> \
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48 <c> \
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49 <a>hello</a> \
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50 world\
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51 <d><e><b/></e></d>\
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 </c> \
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53 <x><z/></x> \
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54 </test>"
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56 #define XML_TESTDATA2 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
57 <root><wrapper><test> \
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
58 <elm1>teststr</elm1> \
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
59 <!-- comment -->\
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
60 <elm2 /> \
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61 <c> \
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
62 <a>hello</a> \
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
63 world\
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64 <d><e><b/></e></d>\
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
65 </c> \
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
66 <x><z/></x> \
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
67 </test><nextelm/></wrapper><ignore/></root>"
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
68
225
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
69 #define XML_TESTDATA3 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
70 <x1:prop \
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
71 xmlns:x1=\"http://example.com/ns1/\" \
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
72 xmlns:x2=\"http://example.com/ns2/\" \
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
73 xmlns:x3=\"http://example.com/ns_0/\" \
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
74 xmlns:x4=\"http://example.com/ns_0/\" > \
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
75 <x1:elm1>str1</x1:elm1>\
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
76 <x2:elm2>str1</x2:elm2>\
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
77 <x3:elm3>str1</x3:elm3>\
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
78 <x4:elm4>str1</x4:elm4>\
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
79 </x1:prop>"
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
80
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
81 #define XML_TESTDATA4 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
82 <x1:prop \
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
83 xmlns:x1=\"http://example.com/ns1/\" \
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
84 xmlns:x2=\"http://example.com/ns2/\" \
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
85 xmlns:x3=\"http://example.com/ns_0/\" \
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
86 xmlns:x4=\"http://example.com/ns_0/\" >\
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
87 <x1:elm1>str1</x1:elm1>\
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
88 <x2:elm2>str1</x2:elm2>\
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
89 </x1:prop>"
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
90
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
91 #define XML_TESTDATA5 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
92 <x1:prop \
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
93 xmlns:x1=\"http://example.com/ns1/\" \
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
94 xmlns:x2=\"http://example.com/ns2/\" > \
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
95 <x1:elm1>str1</x1:elm1>\
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
96 <x2:elm2>str1</x2:elm2>\
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
97 <x3:elm3 xmlns:x3=\"http://example.com/ns_0/\" >str1</x3:elm3>\
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
98 <x4:elm4 xmlns:x4=\"http://example.com/ns_0/\" >str1</x4:elm4>\
e4f3e1433098 add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 224
diff changeset
99 </x1:prop>"
224
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
100
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
101 #ifdef __cplusplus
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
102 }
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
103 #endif
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
104
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
105 #endif /* TEST_XML_H */
0de1ec82628e add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
106

mercurial