Wed, 31 May 2023 12:43:30 +0200
fix missing connection ssl_error initialization
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" |
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
319
diff
changeset
|
33 | #include "test.h" |
224
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); |
232 | 41 | UCX_TEST(test_wsxml_write_nodes); |
319
a9b9344875aa
add WebdavNSList <-> string converting functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
232
diff
changeset
|
42 | UCX_TEST(test_wsxml_nslist2string); |
a9b9344875aa
add WebdavNSList <-> string converting functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
232
diff
changeset
|
43 | UCX_TEST(test_wsxml_string2nslist); |
224
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | #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
|
47 | <test> \ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48 | <elm1>teststr</elm1> \ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | <!-- comment -->\ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | <elm2 /> \ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
51 | <c> \ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
52 | <a>hello</a> \ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
53 | world\ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54 | <d><e><b/></e></d>\ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55 | </c> \ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
56 | <x><z/></x> \ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57 | </test>" |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
58 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
59 | #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
|
60 | <root><wrapper><test> \ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
61 | <elm1>teststr</elm1> \ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
62 | <!-- comment -->\ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
63 | <elm2 /> \ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
64 | <c> \ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | <a>hello</a> \ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | world\ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | <d><e><b/></e></d>\ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | </c> \ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | <x><z/></x> \ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70 | </test><nextelm/></wrapper><ignore/></root>" |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71 | |
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
|
72 | #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
|
73 | <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
|
74 | 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
|
75 | 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
|
76 | 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
|
77 | 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
|
78 | <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
|
79 | <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
|
80 | <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
|
81 | <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
|
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 | |
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 | #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
|
85 | <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
|
86 | 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
|
87 | 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
|
88 | 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
|
89 | 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
|
90 | <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
|
91 | <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
|
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 | |
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 | #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
|
95 | <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
|
96 | 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
|
97 | 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
|
98 | <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
|
99 | <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
|
100 | <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
|
101 | <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
|
102 | </x1:prop>" |
224
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
103 | |
232 | 104 | #define XML_TESTDATA6 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \n\ |
105 | <x1:test \n\ | |
106 | xmlns:x1=\"http://example.com/ns1/\" \n\ | |
107 | xmlns:x2=\"http://example.com/ns2/\" > \n\ | |
108 | <x1:elm1>str1</x1:elm1>\n\ | |
109 | <x2:elm2>str1</x2:elm2>\n\ | |
110 | <x3:elm3 xmlns:x3=\"http://example.com/ns_0/\" >str1</x3:elm3>\n\ | |
111 | <x1:sub> \n\ | |
112 | <x1:a attr1=\"val1\"/> \n\ | |
113 | <x1:a attr2=\"val2\">text</x1:a>\n\ | |
114 | <x1:b x2:nsattr=\"nsval\"><x1:c/></x1:b>\n\ | |
115 | </x1:sub> \n\ | |
116 | <x1:newns xmlns:x4=\"http://example.com/0/\" x4:attr3=\"val3\">\n\ | |
117 | </x1:newns>\n\ | |
118 | <x1:text>Hello\n\ | |
119 | World\n\ | |
120 | end.\n\ | |
121 | </x1:text>\n\ | |
122 | <x1:entityref ea=\"test & value\">\n\ | |
123 | entity reference test &quote& \n\ | |
124 | <xml>\n\ | |
125 | </x1:entityref>\n\ | |
126 | </x1:test>\n" | |
127 | ||
224
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
128 | #ifdef __cplusplus |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
129 | } |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
130 | #endif |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
131 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
132 | #endif /* TEST_XML_H */ |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
133 |