1 | C0CXPAT0 ; CCDCCR/GPL - XPATH TEST CASES ; 6/1/08
|
---|
2 | ;;1.0;C0C;;May 19, 2009;
|
---|
3 | ;Copyright 2008 George Lilly. Licensed under the terms of the GNU
|
---|
4 | ;General Public License See attached copy of the License.
|
---|
5 | ;
|
---|
6 | ;This program is free software; you can redistribute it and/or modify
|
---|
7 | ;it under the terms of the GNU General Public License as published by
|
---|
8 | ;the Free Software Foundation; either version 2 of the License, or
|
---|
9 | ;(at your option) any later version.
|
---|
10 | ;
|
---|
11 | ;This program is distributed in the hope that it will be useful,
|
---|
12 | ;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | ;GNU General Public License for more details.
|
---|
15 | ;
|
---|
16 | ;You should have received a copy of the GNU General Public License along
|
---|
17 | ;with this program; if not, write to the Free Software Foundation, Inc.,
|
---|
18 | ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
---|
19 | ;
|
---|
20 | W "NO ENTRY",!
|
---|
21 | Q
|
---|
22 | ;
|
---|
23 | ;;><TEST>
|
---|
24 | ;;><INIT>
|
---|
25 | ;;>>>K C0C S C0C=""
|
---|
26 | ;;>>>D PUSH^C0CXPATH("C0C","FIRST")
|
---|
27 | ;;>>>D PUSH^C0CXPATH("C0C","SECOND")
|
---|
28 | ;;>>>D PUSH^C0CXPATH("C0C","THIRD")
|
---|
29 | ;;>>>D PUSH^C0CXPATH("C0C","FOURTH")
|
---|
30 | ;;>>?C0C(0)=4
|
---|
31 | ;;><INITXML>
|
---|
32 | ;;>>>K GXML S GXML=""
|
---|
33 | ;;>>>D PUSH^C0CXPATH("GXML","<FIRST>")
|
---|
34 | ;;>>>D PUSH^C0CXPATH("GXML","<SECOND>")
|
---|
35 | ;;>>>D PUSH^C0CXPATH("GXML","<THIRD>")
|
---|
36 | ;;>>>D PUSH^C0CXPATH("GXML","<FOURTH>@@DATA1@@</FOURTH>")
|
---|
37 | ;;>>>D PUSH^C0CXPATH("GXML","<FIFTH>")
|
---|
38 | ;;>>>D PUSH^C0CXPATH("GXML","@@DATA2@@")
|
---|
39 | ;;>>>D PUSH^C0CXPATH("GXML","</FIFTH>")
|
---|
40 | ;;>>>D PUSH^C0CXPATH("GXML","<SIXTH ID=""SELF"" />")
|
---|
41 | ;;>>>D PUSH^C0CXPATH("GXML","</THIRD>")
|
---|
42 | ;;>>>D PUSH^C0CXPATH("GXML","<SECOND>")
|
---|
43 | ;;>>>D PUSH^C0CXPATH("GXML","</SECOND>")
|
---|
44 | ;;>>>D PUSH^C0CXPATH("GXML","</SECOND>")
|
---|
45 | ;;>>>D PUSH^C0CXPATH("GXML","</FIRST>")
|
---|
46 | ;;><INITXML2>
|
---|
47 | ;;>>>K GXML S GXML=""
|
---|
48 | ;;>>>D PUSH^C0CXPATH("GXML","<FIRST>")
|
---|
49 | ;;>>>D PUSH^C0CXPATH("GXML","<SECOND>")
|
---|
50 | ;;>>>D PUSH^C0CXPATH("GXML","<THIRD>")
|
---|
51 | ;;>>>D PUSH^C0CXPATH("GXML","<FOURTH>DATA1</FOURTH>")
|
---|
52 | ;;>>>D PUSH^C0CXPATH("GXML","<FOURTH>")
|
---|
53 | ;;>>>D PUSH^C0CXPATH("GXML","DATA2")
|
---|
54 | ;;>>>D PUSH^C0CXPATH("GXML","</FOURTH>")
|
---|
55 | ;;>>>D PUSH^C0CXPATH("GXML","</THIRD>")
|
---|
56 | ;;>>>D PUSH^C0CXPATH("GXML","<_SECOND>")
|
---|
57 | ;;>>>D PUSH^C0CXPATH("GXML","<FOURTH>DATA3</FOURTH>")
|
---|
58 | ;;>>>D PUSH^C0CXPATH("GXML","</_SECOND>")
|
---|
59 | ;;>>>D PUSH^C0CXPATH("GXML","</SECOND>")
|
---|
60 | ;;>>>D PUSH^C0CXPATH("GXML","</FIRST>")
|
---|
61 | ;;><PUSHPOP>
|
---|
62 | ;;>>>D ZLOAD^C0CUNIT("ZTMP","C0CXPAT0")
|
---|
63 | ;;>>>D ZTEST^C0CUNIT(.ZTMP,"INIT")
|
---|
64 | ;;>>?C0C(C0C(0))="FOURTH"
|
---|
65 | ;;>>>D POP^C0CXPATH("C0C",.GX)
|
---|
66 | ;;>>?GX="FOURTH"
|
---|
67 | ;;>>?C0C(C0C(0))="THIRD"
|
---|
68 | ;;>>>D POP^C0CXPATH("C0C",.GX)
|
---|
69 | ;;>>?GX="THIRD"
|
---|
70 | ;;>>?C0C(C0C(0))="SECOND"
|
---|
71 | ;;><MKMDX>
|
---|
72 | ;;>>>D ZLOAD^C0CUNIT("ZTMP","C0CXPAT0")
|
---|
73 | ;;>>>D ZTEST^C0CUNIT(.ZTMP,"INIT")
|
---|
74 | ;;>>>S GX=""
|
---|
75 | ;;>>>D MKMDX^C0CXPATH("C0C",.GX)
|
---|
76 | ;;>>?GX="//FIRST/SECOND/THIRD/FOURTH"
|
---|
77 | ;;><XNAME>
|
---|
78 | ;;>>?$$XNAME^C0CXPATH("<FOURTH>DATA1</FOURTH>")="FOURTH"
|
---|
79 | ;;>>?$$XNAME^C0CXPATH("<SIXTH ID=""SELF"" />")="SIXTH"
|
---|
80 | ;;>>?$$XNAME^C0CXPATH("</THIRD>")="THIRD"
|
---|
81 | ;;><INDEX>
|
---|
82 | ;;>>>D ZLOAD^C0CUNIT("ZTMP","C0CXPAT0")
|
---|
83 | ;;>>>D ZTEST^C0CUNIT(.ZTMP,"INITXML")
|
---|
84 | ;;>>>D INDEX^C0CXPATH("GXML")
|
---|
85 | ;;>>?GXML("//FIRST/SECOND")="2^12"
|
---|
86 | ;;>>?GXML("//FIRST/SECOND/THIRD")="3^9"
|
---|
87 | ;;>>?GXML("//FIRST/SECOND/THIRD/FIFTH")="5^7"
|
---|
88 | ;;>>?GXML("//FIRST/SECOND/THIRD/FOURTH")="4^4"
|
---|
89 | ;;>>?GXML("//FIRST/SECOND/THIRD/SIXTH")="8^8"
|
---|
90 | ;;>>?GXML("//FIRST/SECOND")="2^12"
|
---|
91 | ;;>>?GXML("//FIRST")="1^13"
|
---|
92 | ;;><INDEX2>
|
---|
93 | ;;>>>D ZTEST^C0CXPATH("INITXML2")
|
---|
94 | ;;>>>D INDEX^C0CXPATH("GXML")
|
---|
95 | ;;>>?GXML("//FIRST/SECOND")="2^12"
|
---|
96 | ;;>>?GXML("//FIRST/SECOND/_SECOND")="9^11"
|
---|
97 | ;;>>?GXML("//FIRST/SECOND/_SECOND/FOURTH")="10^10"
|
---|
98 | ;;>>?GXML("//FIRST/SECOND/THIRD")="3^8"
|
---|
99 | ;;>>?GXML("//FIRST/SECOND/THIRD/FOURTH")="4^7"
|
---|
100 | ;;>>?GXML("//FIRST")="1^13"
|
---|
101 | ;;><MISSING>
|
---|
102 | ;;>>>D ZTEST^C0CXPATH("INITXML")
|
---|
103 | ;;>>>S OUTARY="^TMP($J,""MISSINGTEST"")"
|
---|
104 | ;;>>>D MISSING^C0CXPATH("GXML",OUTARY)
|
---|
105 | ;;>>?@OUTARY@(1)="DATA1"
|
---|
106 | ;;>>?@OUTARY@(2)="DATA2"
|
---|
107 | ;;><MAP>
|
---|
108 | ;;>>>D ZTEST^C0CXPATH("INITXML")
|
---|
109 | ;;>>>S MAPARY="^TMP($J,""MAPVALUES"")"
|
---|
110 | ;;>>>S OUTARY="^TMP($J,""MAPTEST"")"
|
---|
111 | ;;>>>S @MAPARY@("DATA2")="VALUE2"
|
---|
112 | ;;>>>D MAP^C0CXPATH("GXML",MAPARY,OUTARY)
|
---|
113 | ;;>>?@OUTARY@(6)="VALUE2"
|
---|
114 | ;;><MAP2>
|
---|
115 | ;;>>>D ZTEST^C0CXPATH("INITXML")
|
---|
116 | ;;>>>S MAPARY="^TMP($J,""MAPVALUES"")"
|
---|
117 | ;;>>>S OUTARY="^TMP($J,""MAPTEST"")"
|
---|
118 | ;;>>>S @MAPARY@("DATA1")="VALUE1"
|
---|
119 | ;;>>>S @MAPARY@("DATA2")="VALUE2"
|
---|
120 | ;;>>>S @MAPARY@("DATA3")="VALUE3"
|
---|
121 | ;;>>>S GXML(4)="<FOURTH>@@DATA1@@ AND @@DATA3@@</FOURTH>"
|
---|
122 | ;;>>>D MAP^C0CXPATH("GXML",MAPARY,OUTARY)
|
---|
123 | ;;>>>D PARY^C0CXPATH(OUTARY)
|
---|
124 | ;;>>?@OUTARY@(4)="<FOURTH>VALUE1 AND VALUE3</FOURTH>"
|
---|
125 | ;;><QUEUE>
|
---|
126 | ;;>>>D QUEUE^C0CXPATH("BTLIST","GXML",2,3)
|
---|
127 | ;;>>>D QUEUE^C0CXPATH("BTLIST","GXML",4,5)
|
---|
128 | ;;>>?$P(BTLIST(2),";",2)=4
|
---|
129 | ;;><BUILD>
|
---|
130 | ;;>>>D ZTEST^C0CXPATH("INITXML")
|
---|
131 | ;;>>>D QUERY^C0CXPATH("GXML","//FIRST/SECOND/THIRD/FOURTH","G2")
|
---|
132 | ;;>>>D ZTEST^C0CXPATH("QUEUE")
|
---|
133 | ;;>>>D BUILD^C0CXPATH("BTLIST","G3")
|
---|
134 | ;;><CP>
|
---|
135 | ;;>>>D ZTEST^C0CXPATH("INITXML")
|
---|
136 | ;;>>>D CP^C0CXPATH("GXML","G2")
|
---|
137 | ;;>>?G2(0)=13
|
---|
138 | ;;><QOPEN>
|
---|
139 | ;;>>>K G2,GBL
|
---|
140 | ;;>>>D ZTEST^C0CXPATH("INITXML")
|
---|
141 | ;;>>>D QOPEN^C0CXPATH("GBL","GXML")
|
---|
142 | ;;>>?$P(GBL(1),";",3)=12
|
---|
143 | ;;>>>D BUILD^C0CXPATH("GBL","G2")
|
---|
144 | ;;>>?G2(G2(0))="</SECOND>"
|
---|
145 | ;;><QOPEN2>
|
---|
146 | ;;>>>K G2,GBL
|
---|
147 | ;;>>>D ZTEST^C0CXPATH("INITXML")
|
---|
148 | ;;>>>D QOPEN^C0CXPATH("GBL","GXML","//FIRST/SECOND")
|
---|
149 | ;;>>?$P(GBL(1),";",3)=11
|
---|
150 | ;;>>>D BUILD^C0CXPATH("GBL","G2")
|
---|
151 | ;;>>?G2(G2(0))="</SECOND>"
|
---|
152 | ;;><QCLOSE>
|
---|
153 | ;;>>>K G2,GBL
|
---|
154 | ;;>>>D ZTEST^C0CXPATH("INITXML")
|
---|
155 | ;;>>>D QCLOSE^C0CXPATH("GBL","GXML")
|
---|
156 | ;;>>?$P(GBL(1),";",3)=13
|
---|
157 | ;;>>>D BUILD^C0CXPATH("GBL","G2")
|
---|
158 | ;;>>?G2(G2(0))="</FIRST>"
|
---|
159 | ;;><QCLOSE2>
|
---|
160 | ;;>>>K G2,GBL
|
---|
161 | ;;>>>D ZTEST^C0CXPATH("INITXML")
|
---|
162 | ;;>>>D QCLOSE^C0CXPATH("GBL","GXML","//FIRST/SECOND/THIRD")
|
---|
163 | ;;>>?$P(GBL(1),";",3)=13
|
---|
164 | ;;>>>D BUILD^C0CXPATH("GBL","G2")
|
---|
165 | ;;>>?G2(G2(0))="</FIRST>"
|
---|
166 | ;;>>?G2(1)="</THIRD>"
|
---|
167 | ;;><INSERT>
|
---|
168 | ;;>>>K G2,GBL,G3,G4
|
---|
169 | ;;>>>D ZTEST^C0CXPATH("INITXML")
|
---|
170 | ;;>>>D QUERY^C0CXPATH("GXML","//FIRST/SECOND/THIRD/FIFTH","G2")
|
---|
171 | ;;>>>D INSERT^C0CXPATH("GXML","G2","//FIRST/SECOND/THIRD")
|
---|
172 | ;;>>>D INSERT^C0CXPATH("G3","G2","//")
|
---|
173 | ;;>>?G2(1)=GXML(9)
|
---|
174 | ;;><REPLACE>
|
---|
175 | ;;>>>K G2,GBL,G3
|
---|
176 | ;;>>>D ZTEST^C0CXPATH("INITXML")
|
---|
177 | ;;>>>D QUERY^C0CXPATH("GXML","//FIRST/SECOND/THIRD/FIFTH","G2")
|
---|
178 | ;;>>>D REPLACE^C0CXPATH("GXML","G2","//FIRST/SECOND")
|
---|
179 | ;;>>?GXML(2)="<FIFTH>"
|
---|
180 | ;;><INSINNER>
|
---|
181 | ;;>>>K GXML,G2,GBL,G3
|
---|
182 | ;;>>>D ZTEST^C0CXPATH("INITXML")
|
---|
183 | ;;>>>D QUERY^C0CXPATH("GXML","//FIRST/SECOND/THIRD","G2")
|
---|
184 | ;;>>>D INSINNER^C0CXPATH("GXML","G2","//FIRST/SECOND/THIRD")
|
---|
185 | ;;>>?GXML(10)="<FIFTH>"
|
---|
186 | ;;><INSINNER2>
|
---|
187 | ;;>>>K GXML,G2,GBL,G3
|
---|
188 | ;;>>>D ZTEST^C0CXPATH("INITXML")
|
---|
189 | ;;>>>D QUERY^C0CXPATH("GXML","//FIRST/SECOND/THIRD","G2")
|
---|
190 | ;;>>>D INSINNER^C0CXPATH("G2","G2")
|
---|
191 | ;;>>?G2(8)="<FIFTH>"
|
---|
192 | ;;><PUSHA>
|
---|
193 | ;;>>>K GTMP,GTMP2
|
---|
194 | ;;>>>N GTMP,GTMP2
|
---|
195 | ;;>>>D PUSH^C0CXPATH("GTMP","A")
|
---|
196 | ;;>>>D PUSH^C0CXPATH("GTMP2","B")
|
---|
197 | ;;>>>D PUSH^C0CXPATH("GTMP2","C")
|
---|
198 | ;;>>>D PUSHA^C0CXPATH("GTMP","GTMP2")
|
---|
199 | ;;>>?GTMP(3)="C"
|
---|
200 | ;;>>?GTMP(0)=3
|
---|
201 | ;;><H2ARY>
|
---|
202 | ;;>>>K GTMP,GTMP2
|
---|
203 | ;;>>>S GTMP("TEST1")=1
|
---|
204 | ;;>>>D H2ARY^C0CXPATH("GTMP2","GTMP")
|
---|
205 | ;;>>?GTMP2(0)=1
|
---|
206 | ;;>>?GTMP2(1)="^TEST1^1"
|
---|
207 | ;;><XVARS>
|
---|
208 | ;;>>>K GTMP,GTMP2
|
---|
209 | ;;>>>D PUSH^C0CXPATH("GTMP","<VALUE>@@VAR1@@</VALUE>")
|
---|
210 | ;;>>>D XVARS^C0CXPATH("GTMP2","GTMP")
|
---|
211 | ;;>>?GTMP2(1)="^VAR1^1"
|
---|
212 | ;;></TEST>
|
---|