source: ccr/trunk/p/GPLXPAT0.m@ 340

Last change on this file since 340 was 294, checked in by George Lilly, 16 years ago

GPLXPATH test case update

File size: 7.0 KB
Line 
1GPLXPAT0 ; CCDCCR/GPL - XPATH TEST CASES ; 6/1/08
2 ;;0.2;CCDCCR;nopatch;noreleasedate
3 ;Copyright 2008 WorldVistA. 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 GPL S GPL=""
26 ;;>>>D PUSH^GPLXPATH("GPL","FIRST")
27 ;;>>>D PUSH^GPLXPATH("GPL","SECOND")
28 ;;>>>D PUSH^GPLXPATH("GPL","THIRD")
29 ;;>>>D PUSH^GPLXPATH("GPL","FOURTH")
30 ;;>>?GPL(0)=4
31 ;;><INITXML>
32 ;;>>>K GXML S GXML=""
33 ;;>>>D PUSH^GPLXPATH("GXML","<FIRST>")
34 ;;>>>D PUSH^GPLXPATH("GXML","<SECOND>")
35 ;;>>>D PUSH^GPLXPATH("GXML","<THIRD>")
36 ;;>>>D PUSH^GPLXPATH("GXML","<FOURTH>@@DATA1@@</FOURTH>")
37 ;;>>>D PUSH^GPLXPATH("GXML","<FIFTH>")
38 ;;>>>D PUSH^GPLXPATH("GXML","@@DATA2@@")
39 ;;>>>D PUSH^GPLXPATH("GXML","</FIFTH>")
40 ;;>>>D PUSH^GPLXPATH("GXML","<SIXTH ID=""SELF"" />")
41 ;;>>>D PUSH^GPLXPATH("GXML","</THIRD>")
42 ;;>>>D PUSH^GPLXPATH("GXML","<SECOND>")
43 ;;>>>D PUSH^GPLXPATH("GXML","</SECOND>")
44 ;;>>>D PUSH^GPLXPATH("GXML","</SECOND>")
45 ;;>>>D PUSH^GPLXPATH("GXML","</FIRST>")
46 ;;><INITXML2>
47 ;;>>>K GXML S GXML=""
48 ;;>>>D PUSH^GPLXPATH("GXML","<FIRST>")
49 ;;>>>D PUSH^GPLXPATH("GXML","<SECOND>")
50 ;;>>>D PUSH^GPLXPATH("GXML","<THIRD>")
51 ;;>>>D PUSH^GPLXPATH("GXML","<FOURTH>DATA1</FOURTH>")
52 ;;>>>D PUSH^GPLXPATH("GXML","<FOURTH>")
53 ;;>>>D PUSH^GPLXPATH("GXML","DATA2")
54 ;;>>>D PUSH^GPLXPATH("GXML","</FOURTH>")
55 ;;>>>D PUSH^GPLXPATH("GXML","</THIRD>")
56 ;;>>>D PUSH^GPLXPATH("GXML","<_SECOND>")
57 ;;>>>D PUSH^GPLXPATH("GXML","<FOURTH>DATA3</FOURTH>")
58 ;;>>>D PUSH^GPLXPATH("GXML","</_SECOND>")
59 ;;>>>D PUSH^GPLXPATH("GXML","</SECOND>")
60 ;;>>>D PUSH^GPLXPATH("GXML","</FIRST>")
61 ;;><PUSHPOP>
62 ;;>>>D ZLOAD^GPLUNIT("ZTMP","GPLXPAT0")
63 ;;>>>D ZTEST^GPLUNIT(.ZTMP,"INIT")
64 ;;>>?GPL(GPL(0))="FOURTH"
65 ;;>>>D POP^GPLXPATH("GPL",.GX)
66 ;;>>?GX="FOURTH"
67 ;;>>?GPL(GPL(0))="THIRD"
68 ;;>>>D POP^GPLXPATH("GPL",.GX)
69 ;;>>?GX="THIRD"
70 ;;>>?GPL(GPL(0))="SECOND"
71 ;;><MKMDX>
72 ;;>>>D ZLOAD^GPLUNIT("ZTMP","GPLXPAT0")
73 ;;>>>D ZTEST^GPLUNIT(.ZTMP,"INIT")
74 ;;>>>S GX=""
75 ;;>>>D MKMDX^GPLXPATH("GPL",.GX)
76 ;;>>?GX="//FIRST/SECOND/THIRD/FOURTH"
77 ;;><XNAME>
78 ;;>>?$$XNAME^GPLXPATH("<FOURTH>DATA1</FOURTH>")="FOURTH"
79 ;;>>?$$XNAME^GPLXPATH("<SIXTH ID=""SELF"" />")="SIXTH"
80 ;;>>?$$XNAME^GPLXPATH("</THIRD>")="THIRD"
81 ;;><INDEX>
82 ;;>>>D ZLOAD^GPLUNIT("ZTMP","GPLXPAT0")
83 ;;>>>D ZTEST^GPLUNIT(.ZTMP,"INITXML")
84 ;;>>>D INDEX^GPLXPATH("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^GPLXPATH("INITXML2")
94 ;;>>>D INDEX^GPLXPATH("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^GPLXPATH("INITXML")
103 ;;>>>S OUTARY="^TMP($J,""MISSINGTEST"")"
104 ;;>>>D MISSING^GPLXPATH("GXML",OUTARY)
105 ;;>>?@OUTARY@(1)="DATA1"
106 ;;>>?@OUTARY@(2)="DATA2"
107 ;;><MAP>
108 ;;>>>D ZTEST^GPLXPATH("INITXML")
109 ;;>>>S MAPARY="^TMP($J,""MAPVALUES"")"
110 ;;>>>S OUTARY="^TMP($J,""MAPTEST"")"
111 ;;>>>S @MAPARY@("DATA2")="VALUE2"
112 ;;>>>D MAP^GPLXPATH("GXML",MAPARY,OUTARY)
113 ;;>>?@OUTARY@(6)="VALUE2"
114 ;;><MAP2>
115 ;;>>>D ZTEST^GPLXPATH("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^GPLXPATH("GXML",MAPARY,OUTARY)
123 ;;>>>D PARY^GPLXPATH(OUTARY)
124 ;;>>?@OUTARY@(4)="<FOURTH>VALUE1 AND VALUE3</FOURTH>"
125 ;;><QUEUE>
126 ;;>>>D QUEUE^GPLXPATH("BTLIST","GXML",2,3)
127 ;;>>>D QUEUE^GPLXPATH("BTLIST","GXML",4,5)
128 ;;>>?$P(BTLIST(2),";",2)=4
129 ;;><BUILD>
130 ;;>>>D ZTEST^GPLXPATH("INITXML")
131 ;;>>>D QUERY^GPLXPATH("GXML","//FIRST/SECOND/THIRD/FOURTH","G2")
132 ;;>>>D ZTEST^GPLXPATH("QUEUE")
133 ;;>>>D BUILD^GPLXPATH("BTLIST","G3")
134 ;;><CP>
135 ;;>>>D ZTEST^GPLXPATH("INITXML")
136 ;;>>>D CP^GPLXPATH("GXML","G2")
137 ;;>>?G2(0)=13
138 ;;><QOPEN>
139 ;;>>>K G2,GBL
140 ;;>>>D ZTEST^GPLXPATH("INITXML")
141 ;;>>>D QOPEN^GPLXPATH("GBL","GXML")
142 ;;>>?$P(GBL(1),";",3)=12
143 ;;>>>D BUILD^GPLXPATH("GBL","G2")
144 ;;>>?G2(G2(0))="</SECOND>"
145 ;;><QOPEN2>
146 ;;>>>K G2,GBL
147 ;;>>>D ZTEST^GPLXPATH("INITXML")
148 ;;>>>D QOPEN^GPLXPATH("GBL","GXML","//FIRST/SECOND")
149 ;;>>?$P(GBL(1),";",3)=11
150 ;;>>>D BUILD^GPLXPATH("GBL","G2")
151 ;;>>?G2(G2(0))="</SECOND>"
152 ;;><QCLOSE>
153 ;;>>>K G2,GBL
154 ;;>>>D ZTEST^GPLXPATH("INITXML")
155 ;;>>>D QCLOSE^GPLXPATH("GBL","GXML")
156 ;;>>?$P(GBL(1),";",3)=13
157 ;;>>>D BUILD^GPLXPATH("GBL","G2")
158 ;;>>?G2(G2(0))="</FIRST>"
159 ;;><QCLOSE2>
160 ;;>>>K G2,GBL
161 ;;>>>D ZTEST^GPLXPATH("INITXML")
162 ;;>>>D QCLOSE^GPLXPATH("GBL","GXML","//FIRST/SECOND/THIRD")
163 ;;>>?$P(GBL(1),";",3)=13
164 ;;>>>D BUILD^GPLXPATH("GBL","G2")
165 ;;>>?G2(G2(0))="</FIRST>"
166 ;;>>?G2(1)="</THIRD>"
167 ;;><INSERT>
168 ;;>>>K G2,GBL,G3,G4
169 ;;>>>D ZTEST^GPLXPATH("INITXML")
170 ;;>>>D QUERY^GPLXPATH("GXML","//FIRST/SECOND/THIRD/FIFTH","G2")
171 ;;>>>D INSERT^GPLXPATH("GXML","G2","//FIRST/SECOND/THIRD")
172 ;;>>>D INSERT^GPLXPATH("G3","G2","//")
173 ;;>>?G2(1)=GXML(9)
174 ;;><REPLACE>
175 ;;>>>K G2,GBL,G3
176 ;;>>>D ZTEST^GPLXPATH("INITXML")
177 ;;>>>D QUERY^GPLXPATH("GXML","//FIRST/SECOND/THIRD/FIFTH","G2")
178 ;;>>>D REPLACE^GPLXPATH("GXML","G2","//FIRST/SECOND")
179 ;;>>?GXML(2)="<FIFTH>"
180 ;;><INSINNER>
181 ;;>>>K GXML,G2,GBL,G3
182 ;;>>>D ZTEST^GPLXPATH("INITXML")
183 ;;>>>D QUERY^GPLXPATH("GXML","//FIRST/SECOND/THIRD","G2")
184 ;;>>>D INSINNER^GPLXPATH("GXML","G2","//FIRST/SECOND/THIRD")
185 ;;>>?GXML(10)="<FIFTH>"
186 ;;><INSINNER2>
187 ;;>>>K GXML,G2,GBL,G3
188 ;;>>>D ZTEST^GPLXPATH("INITXML")
189 ;;>>>D QUERY^GPLXPATH("GXML","//FIRST/SECOND/THIRD","G2")
190 ;;>>>D INSINNER^GPLXPATH("G2","G2")
191 ;;>>?G2(8)="<FIFTH>"
192 ;;><PUSHA>
193 ;;>>>K GTMP,GTMP2
194 ;;>>>N GTMP,GTMP2
195 ;;>>>D PUSH^GPLXPATH("GTMP","A")
196 ;;>>>D PUSH^GPLXPATH("GTMP2","B")
197 ;;>>>D PUSH^GPLXPATH("GTMP2","C")
198 ;;>>>D PUSHA^GPLXPATH("GTMP","GTMP2")
199 ;;>>?GTMP(3)="C"
200 ;;>>?GTMP(0)=3
201 ;;><H2ARY>
202 ;;>>>K GTMP,GTMP2
203 ;;>>>S GTMP("TEST1")=1
204 ;;>>>D H2ARY^GPLXPATH("GTMP2","GTMP")
205 ;;>>?GTMP2(0)=1
206 ;;>>?GTMP2(1)="^TEST1^1"
207 ;;><XVARS>
208 ;;>>>K GTMP,GTMP2
209 ;;>>>D PUSH^GPLXPATH("GTMP","<VALUE>@@VAR1@@</VALUE>")
210 ;;>>>D XVARS^GPLXPATH("GTMP2","GTMP")
211 ;;>>?GTMP2(1)="^VAR1^1"
212 ;;></TEST>
Note: See TracBrowser for help on using the repository browser.