mbeckerle commented on code in PR #918:
URL: https://github.com/apache/daffodil/pull/918#discussion_r1074048048
##########
daffodil-test/src/test/resources/org/apache/daffodil/section12/lengthKind/ExplicitTests.tdml:
##########
@@ -903,4 +903,37 @@
</tdml:infoset>
</tdml:parserTestCase>
+<!--
+ Test Name: invalidLengthUnits_explicit
+ Schema: invalidLengthUnits_explicit
+ Root: r1
+ Purpose: This test checks that a warning is emitted when a bigint is
used when lengthUnits='bits'.
+-->
+ <tdml:defineSchema name="invalidLengthUnits_explicit">
+ <xs:include
schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+ <dfdl:defineFormat name="Binary">
+ <dfdl:format ref="ex:GeneralFormat" representation="binary"/>
+ </dfdl:defineFormat>
+ <dfdl:format ref="ex:Binary" />
+
+ <xs:element name="r1" dfdl:lengthKind="explicit" type="xs:integer"
dfdl:lengthUnits="bits" dfdl:length="8"/>
+ </tdml:defineSchema>
+
+ <tdml:parserTestCase name="invalidLengthUnits_explicit" root="r1"
model="invalidLengthUnits_explicit"
+ description="">
+ <tdml:document>
+ <tdml:documentPart type="byte">
+ 0f
+ </tdml:documentPart>
+ </tdml:document>
+ <tdml:infoset>
+ <tdml:dfdlInfoset>f
+ <r1>15</r1>
+ </tdml:dfdlInfoset>
+ </tdml:infoset>
+ <tdml:warnings>
+ <tdml:warning>lengthUnits='bits' will only be supported for integer
types of 64 bits or less</tdml:warning>
Review Comment:
I think the message should not say "integer types of 64 bits or less" but
say lengthUnits bits is not supported for xs:integer nor xs:nonNegativeInteger.
Why.. because this is perfectly legal:
`<element name="x" type="xs:integer" dfdl:length="3"
dfdl:lengthUnits="bytes"/>
`
which is a 24-bit integer. So is that an integer of type 64 bits or less?
It's the types that cause the issue, not the 64. The restriction was to make
DFDL easier to implement as a byte-centric big-num library would suffice for
xs:integer and xs:nonNegativeInteger.
--
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]