tuxji commented on code in PR #1137:
URL: https://github.com/apache/daffodil/pull/1137#discussion_r1446379845
##########
daffodil-test/src/test/resources/org/apache/daffodil/section23/dfdl_functions/Functions.tdml:
##########
@@ -11390,6 +11417,110 @@
</tdml:infoset>
</tdml:unparserTestCase>
+ <!--
+ Test Name: count_12
+ Schema: XPathFunctions
+ Root: count07
+ Purpose: This test demonstrates the count() function works as
expected
+ when parsing an array of scalars
+ -->
+
+ <tdml:parserTestCase name="count_12" root="count07"
+ model="XPathFunctions" description="Section 23 - Functions - fn:count -
DFDL-23-122R">
+ <tdml:document>
+ <tdml:documentPart type="byte">00 00 00 01 00 00 00
02</tdml:documentPart>
+ </tdml:document>
+ <tdml:infoset>
+ <tdml:dfdlInfoset>
+ <ex:count07 xmlns:ex="http://example.com">
+ <ex:int>1</ex:int>
+ <ex:int>2</ex:int>
+ <ex:count>2</ex:count>
+ </ex:count07>
+ </tdml:dfdlInfoset>
+ </tdml:infoset>
+ </tdml:parserTestCase>
+
+ <!--
+ Test Name: count_13
+ Schema: XPathFunctions
+ Root: count08
+ Purpose: This test demonstrates the count() function works as
expected
+ when parsing a unique scalar element
+ -->
+
+ <tdml:parserTestCase name="count_13" root="count08" roundTrip="true"
+ model="XPathFunctions" description="Section 23 -
Functions - fn:count - DFDL-23-122R">
+ <tdml:document>
+ <tdml:documentPart type="byte">00 00 00 01</tdml:documentPart>
+ </tdml:document>
+ <tdml:errors>
+ <tdml:error>Schema Definition Error</tdml:error>
+ <tdml:error>fn:count</tdml:error>
+ <tdml:error>array</tdml:error>
+ </tdml:errors>
+ </tdml:parserTestCase>
+
+ <!--
+ Test Name: count_14
+ Schema: XPathFunctions
+ Root: count09
+ Purpose: This test demonstrates the count() function works as
expected
+ when parsing an optional element
+ -->
+
+ <tdml:parserTestCase name="count_14" root="count09" roundTrip="true"
+ model="XPathFunctions" description="Section 23 -
Functions - fn:count - DFDL-23-122R">
+ <tdml:document>
+ <tdml:documentPart type="byte">00 00 00 01</tdml:documentPart>
+ </tdml:document>
+ <tdml:errors>
+ <tdml:error>Schema Definition Error</tdml:error>
+ <tdml:error>fn:count</tdml:error>
+ <tdml:error>array</tdml:error>
+ </tdml:errors>
Review Comment:
Oops, the count_14 test should not expect a SDE (I'm sorry I missed that).
The issue says fn:count() should be an SDE if the path is not for an array or
optional element. The element for count_14 is an optional element so the count
should return 0 or 1 depending on whether the input document is empty or has 4
bytes in it (both cases should be tested).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]