source: ccr/trunk/p/C0CXPAT0.m@ 1643

Last change on this file since 1643 was 1586, checked in by Sam Habiel, 12 years ago

Changed license to AGPL. Some clean-up for XINDEX

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