Skip to content

Commit a5df610

Browse files
committed
Added new test case for occurrence-function.
The test case verifies that the `occurrence`-function in method updates with each inner entity if sameEntity is set and entities are nested.
1 parent 12028c6 commit a5df610

File tree

1 file changed

+54
-0
lines changed
  • src/test/java/org/culturegraph/mf/morph/functions

1 file changed

+54
-0
lines changed

src/test/java/org/culturegraph/mf/morph/functions/Stateful.xml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,60 @@
107107
</result>
108108
</test-case>
109109

110+
<test-case name="Occurrences with sameEntity in nested entities should change with inner entities">
111+
<input type="text/x-cg+xml">
112+
<cgxml:cgxml version="1.0">
113+
<cgxml:records>
114+
<cgxml:record id="1">
115+
<cgxml:entity name="o">
116+
<cgxml:entity name="i">
117+
<cgxml:literal name="data" value="1" />
118+
<cgxml:literal name="data" value="2" />
119+
<cgxml:literal name="data" value="3" />
120+
</cgxml:entity>
121+
<cgxml:entity name="i">
122+
<cgxml:literal name="data" value="1" />
123+
<cgxml:literal name="data" value="2" />
124+
<cgxml:literal name="data" value="3" />
125+
</cgxml:entity>
126+
</cgxml:entity>
127+
</cgxml:record>
128+
</cgxml:records>
129+
</cgxml:cgxml>
130+
</input>
131+
132+
<transformation type="text/x-metamorph+xml">
133+
<mm:metamorph version="1">
134+
<mm:rules>
135+
<mm:data source="o.i.data" name="l2">
136+
<mm:occurrence only="lessThen 2" sameEntity="true" />
137+
</mm:data>
138+
<mm:data source="o.i.data" name="2">
139+
<mm:occurrence only="2" sameEntity="true" />
140+
</mm:data>
141+
<mm:data source="o.i.data" name="g2">
142+
<mm:occurrence only="moreThen 2" sameEntity="true" />
143+
</mm:data>
144+
</mm:rules>
145+
</mm:metamorph>
146+
</transformation>
147+
148+
<result type="text/x-cg+xml">
149+
<cgxml:cgxml version="1.0">
150+
<cgxml:records>
151+
<cgxml:record id="1">
152+
<cgxml:literal name="l2" value="1" />
153+
<cgxml:literal name="2" value="2" />
154+
<cgxml:literal name="g2" value="3" />
155+
<cgxml:literal name="l2" value="1" />
156+
<cgxml:literal name="2" value="2" />
157+
<cgxml:literal name="g2" value="3" />
158+
</cgxml:record>
159+
</cgxml:records>
160+
</cgxml:cgxml>
161+
</result>
162+
</test-case>
163+
110164
<test-case name="count">
111165
<input type="text/x-cg+xml">
112166
<cgxml:cgxml version="1.0">

0 commit comments

Comments
 (0)