Fri, 17 Jan 2020 22:23:30 +0100
implement multistatus writer
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 | #include "xml.h" |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | #include <stdio.h> |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | #include <stdlib.h> |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | #include <libxml/tree.h> |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | #include "testutils.h" |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | #include "../public/webdav.h" |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | typedef struct Test1Data { |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | int beginCounter; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | int endCounter; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | int elmCounter; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44 | int endElmCounter; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | int textErr; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | int err; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47 | int endErr; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48 | xmlNode *prev; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | } Test1Data; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
51 | static int test1_begin(xmlNode *node, void *userdata) { |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
52 | Test1Data *data = userdata; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
53 | data->beginCounter++; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55 | if(node->type == XML_ELEMENT_NODE) { |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
56 | data->elmCounter++; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57 | const char *name = (const char*)node->name; |
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 | if(!strcmp(name, "ignore") || !strcmp(name, "ignore")) { |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
60 | data->err = 1; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
61 | return 1; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
62 | } |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
63 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
64 | switch(data->elmCounter) { |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | case 1: if(strcmp(name, "test")){ data->err = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | case 2: if(strcmp(name, "elm1")) { data->err = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | case 3: if(strcmp(name, "elm2")) { data->err = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | case 4: if(strcmp(name, "c")) { data->err = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | case 5: if(strcmp(name, "a")) { data->err = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70 | case 6: if(strcmp(name, "d")) { data->err = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71 | case 7: if(strcmp(name, "e")) { data->err = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
72 | case 8: if(strcmp(name, "b")) { data->err = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
73 | case 9: if(strcmp(name, "x")) { data->err = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
74 | case 10: if(strcmp(name, "z")) { data->err = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
75 | case 11: if(strcmp(name, "nextelm")) { data->err = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
76 | } |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
77 | } else if(node->type == XML_TEXT_NODE) { |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
78 | const char *text = (const char*)node->content; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
79 | if(!strcmp(text, "teststr")) { |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
80 | if(strcmp((const char*)data->prev->name, "elm1")) { |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
81 | data->textErr = 1; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
82 | return 1; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
83 | } |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
84 | } else if(!strcmp(text, "hello") || !strcmp(text, "world")) { |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
85 | if(strcmp((const char*)data->prev->name, "a")) { |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
86 | data->textErr = 1; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
87 | return 1; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
88 | } |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
89 | } |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
90 | } |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
91 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
92 | if(node->type == XML_ELEMENT_NODE) { |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
93 | data->prev = node; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
94 | } |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
95 | return 0; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
96 | } |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
97 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
98 | static int test1_end(xmlNode *node, void *userdata) { |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
99 | Test1Data *data = userdata; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
100 | data->endCounter++; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
101 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
102 | if(node->type == XML_ELEMENT_NODE) { |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
103 | data->endElmCounter++; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
104 | const char *name = (const char*)node->name; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
105 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
106 | if(!strcmp(name, "ignore") || !strcmp(name, "ignore")) { |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
107 | data->err = 1; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
108 | return 1; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
109 | } |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
110 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
111 | switch(data->endElmCounter) { |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
112 | case 1: if(strcmp(name, "elm1")){ data->endErr = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
113 | case 2: if(strcmp(name, "elm2")){ data->endErr = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
114 | case 3: if(strcmp(name, "a")){ data->endErr = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
115 | case 4: if(strcmp(name, "b")){ data->endErr = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
116 | case 5: if(strcmp(name, "e")){ data->endErr = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
117 | case 6: if(strcmp(name, "d")){ data->endErr = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
118 | case 7: if(strcmp(name, "c")){ data->endErr = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
119 | case 8: if(strcmp(name, "z")){ data->endErr = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
120 | case 9: if(strcmp(name, "x")){ data->endErr = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
121 | case 10: if(strcmp(name, "test")){ data->endErr = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
122 | case 11: if(strcmp(name, "nextelm")) { data->endErr = 1; return 1; } break; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
123 | } |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
124 | } |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
125 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
126 | return 0; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
127 | } |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
128 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
129 | UCX_TEST(test_wsxml_iterator) { |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
130 | Session *sn = testutil_session(); |
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 | UCX_TEST_BEGIN; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
133 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
134 | xmlDoc *doc = xmlReadMemory( |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
135 | XML_TESTDATA1, strlen(XML_TESTDATA1), NULL, NULL, 0); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
136 | xmlDoc *doc2 = xmlReadMemory( |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
137 | XML_TESTDATA2, strlen(XML_TESTDATA2), NULL, NULL, 0); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
138 | UCX_TEST_ASSERT(doc, "doc is NULL"); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
139 | UCX_TEST_ASSERT(doc2, "doc2 is NULL"); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
140 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
141 | xmlNode *root = xmlDocGetRootElement(doc); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
142 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
143 | // Test 1: iterate over complete document |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
144 | Test1Data testdata; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
145 | ZERO(&testdata, sizeof(Test1Data)); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
146 | int ret = wsxml_iterator(sn->pool, root, test1_begin, test1_end, &testdata); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
147 | UCX_TEST_ASSERT(ret == 0, "wsxml_iterator failed"); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
148 | UCX_TEST_ASSERT(!testdata.err, "wrong element order (begin)"); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
149 | UCX_TEST_ASSERT(!testdata.endErr, "wrong element order (end)"); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
150 | UCX_TEST_ASSERT(!testdata.textErr, "text order error"); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
151 | UCX_TEST_ASSERT(testdata.beginCounter == testdata.endCounter, "begin/end counter not equal"); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
152 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
153 | // Test 2: iterate over sub-document |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
154 | ZERO(&testdata, sizeof(Test1Data)); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
155 | xmlNode *root2 = xmlDocGetRootElement(doc2); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
156 | xmlNode *sub = root2->children->children; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
157 | ret = wsxml_iterator(sn->pool, sub, test1_begin, test1_end, &testdata); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
158 | UCX_TEST_ASSERT(ret == 0, "test2: wsxml_iterator failed"); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
159 | UCX_TEST_ASSERT(!testdata.err, "test2: wrong element order (begin)"); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
160 | UCX_TEST_ASSERT(!testdata.endErr, "test2: wrong element order (end)"); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
161 | UCX_TEST_ASSERT(!testdata.textErr, "test2: text order error"); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
162 | UCX_TEST_ASSERT(testdata.beginCounter == testdata.endCounter, "test2: begin/end counter not equal"); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
163 | |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
164 | xmlFreeDoc(doc); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
165 | xmlFreeDoc(doc2); |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
166 | UCX_TEST_END; |
0de1ec82628e
add test for xml iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
167 | } |
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
|
168 | |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
169 | // checks if the namespace list contains the test namespaces x1, x2, x3 and x4 |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
170 | static void check_ns_list(WebdavNSList *list, int *x1, int *x2, int *x3, int *x4) { |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
171 | *x1 = 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
|
172 | *x2 = 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
|
173 | *x3 = 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
|
174 | *x4 = 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
|
175 | |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
176 | WebdavNSList *elm = list; |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
177 | while(elm) { |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
178 | if(!strcmp((const char*)elm->namespace->prefix, "x1") && |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
179 | !strcmp((const char*)elm->namespace->href, "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
|
180 | { |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
181 | *x1 = 1; |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
182 | } else if(!strcmp((const char*)elm->namespace->prefix, "x2") && |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
183 | !strcmp((const char*)elm->namespace->href, "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
|
184 | { |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
185 | *x2 = 1; |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
186 | } else if(!strcmp((const char*)elm->namespace->prefix, "x3") && |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
187 | !strcmp((const char*)elm->namespace->href, "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
|
188 | { |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
189 | *x3 = 1; |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
190 | } else if(!strcmp((const char*)elm->namespace->prefix, "x4") && |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
191 | !strcmp((const char*)elm->namespace->href, "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
|
192 | { |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
193 | *x4 = 1; |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
194 | } |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
195 | |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
196 | elm = elm->next; |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
197 | } |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
198 | } |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
199 | |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
200 | UCX_TEST(test_wsxml_get_required_namespaces) { |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
201 | Session *sn = testutil_session(); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
202 | |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
203 | UCX_TEST_BEGIN; |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
204 | |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
205 | xmlDoc *doc3 = xmlReadMemory( |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
206 | XML_TESTDATA3, strlen(XML_TESTDATA3), NULL, NULL, 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
|
207 | xmlDoc *doc4 = xmlReadMemory( |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
208 | XML_TESTDATA4, strlen(XML_TESTDATA4), NULL, NULL, 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
|
209 | xmlDoc *doc5 = xmlReadMemory( |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
210 | XML_TESTDATA5, strlen(XML_TESTDATA5), NULL, NULL, 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
|
211 | |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
212 | xmlNode *node0 = xmlDocGetRootElement(doc3); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
213 | xmlNode *node1 = xmlDocGetRootElement(doc3)->children; |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
214 | xmlNode *node2 = xmlDocGetRootElement(doc4)->children; |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
215 | xmlNode *node3 = xmlDocGetRootElement(doc5)->children; |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
216 | |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
217 | UCX_TEST_ASSERT(doc3, "doc3 is NULL"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
218 | UCX_TEST_ASSERT(doc4, "doc4 is NULL"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
219 | UCX_TEST_ASSERT(doc5, "doc5 is NULL"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
220 | |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
221 | int err0, err1, err2, err3; |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
222 | int x1 = 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
|
223 | int x2 = 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
|
224 | int x3 = 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
|
225 | int x4 = 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
|
226 | WebdavNSList *elm = NULL; |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
227 | |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
228 | // Test 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
|
229 | WebdavNSList *ns0 = wsxml_get_required_namespaces(sn->pool, node0, &err0); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
230 | UCX_TEST_ASSERT(!err0, "ns0 failed"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
231 | UCX_TEST_ASSERT(!ns0, "ns0: nsdefs should be ignored"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
232 | |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
233 | WebdavNSList *ns1 = wsxml_get_required_namespaces(sn->pool, node1, &err1); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
234 | check_ns_list(ns1, &x1, &x2, &x3, &x4); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
235 | UCX_TEST_ASSERT(!err1, "ns1 failed"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
236 | UCX_TEST_ASSERT(ns1, "ns1: no list"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
237 | UCX_TEST_ASSERT(x1, "ns1: x1 missing"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
238 | UCX_TEST_ASSERT(x2, "ns1: x2 missing"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
239 | UCX_TEST_ASSERT(x3, "ns1: x3 missing"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
240 | UCX_TEST_ASSERT(x4, "ns1: x4 missing"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
241 | |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
242 | WebdavNSList *ns2 = wsxml_get_required_namespaces(sn->pool, node2, &err2); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
243 | check_ns_list(ns2, &x1, &x2, &x3, &x4); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
244 | UCX_TEST_ASSERT(!err2, "ns2 failed"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
245 | UCX_TEST_ASSERT(ns2, "ns2: no list"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
246 | UCX_TEST_ASSERT(x1, "ns2: x1 missing"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
247 | UCX_TEST_ASSERT(x2, "ns2: x2 missing"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
248 | UCX_TEST_ASSERT(!x3, "ns2: x3"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
249 | UCX_TEST_ASSERT(!x4, "ns2: x4"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
250 | |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
251 | WebdavNSList *ns3 = wsxml_get_required_namespaces(sn->pool, node3, &err3); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
252 | check_ns_list(ns3, &x1, &x2, &x3, &x4); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
253 | UCX_TEST_ASSERT(!err3, "ns3 failed"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
254 | UCX_TEST_ASSERT(ns3, "ns3: no list"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
255 | UCX_TEST_ASSERT(x1, "ns3: x1 missing"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
256 | UCX_TEST_ASSERT(x2, "ns3: x2 missing"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
257 | UCX_TEST_ASSERT(!x3, "ns3: x3"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
258 | UCX_TEST_ASSERT(!x4, "ns3: x4"); |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
259 | |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
260 | UCX_TEST_END; |
e4f3e1433098
add function for getting all namespace definitions that are required for an element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
224
diff
changeset
|
261 | } |