stevedlawrence commented on code in PR #1664:
URL: https://github.com/apache/daffodil/pull/1664#discussion_r3195536557
##########
daffodil-test/src/test/resources/org/apache/daffodil/section05/facets/Facets.tdml:
##########
@@ -7016,5 +7016,753 @@
<tdml:error>'.3' is not a valid value for 'integer'</tdml:error>
</tdml:errors>
</tdml:parserTestCase>
-
+
+
+ <tdml:defineSchema name="binaryFloatFacetSchema">
+ <xs:include
schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+ <dfdl:format ref="tns:GeneralFormat" representation="binary"/>,
+
+ <xs:element name="floatMinInc0" dfdl:lengthKind="implicit">
+ <xs:simpleType>
+ <xs:restriction base="xs:float">
+ <xs:minInclusive value="0.0"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="floatMaxInc0" dfdl:lengthKind="implicit">
+ <xs:simpleType>
+ <xs:restriction base="xs:float">
+ <xs:maxInclusive value="0.0"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="floatMinExc0" dfdl:lengthKind="implicit">
+ <xs:simpleType>
+ <xs:restriction base="xs:float">
+ <xs:minExclusive value="0.0"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="floatMaxExc0" dfdl:lengthKind="implicit">
+ <xs:simpleType>
+ <xs:restriction base="xs:float">
+ <xs:maxExclusive value="0.0"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="doubleMinInc0" dfdl:lengthKind="implicit">
+ <xs:simpleType>
+ <xs:restriction base="xs:double">
+ <xs:minInclusive value="0.0"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="doubleMaxInc0" dfdl:lengthKind="implicit">
+ <xs:simpleType>
+ <xs:restriction base="xs:double">
+ <xs:maxInclusive value="0.0"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="doubleMinExc0" dfdl:lengthKind="implicit">
+ <xs:simpleType>
+ <xs:restriction base="xs:double">
+ <xs:minExclusive value="0.0"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="doubleMaxExc0" dfdl:lengthKind="implicit">
+ <xs:simpleType>
+ <xs:restriction base="xs:double">
+ <xs:maxExclusive value="0.0"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ </tdml:defineSchema>
+
+ <!--
+ Test name: floatMinInclusiveNaNFail
+ Schema: binaryFloatFacetSchema
+ Purpose: This test should fail because NaN is incomparable to all values
per XSD — must fail all facets.
+ -->
+
+ <tdml:parserTestCase name="floatMinInclusiveNaNFail" root="floatMinInc0"
validation="limited"
+ model="binaryFloatFacetSchema" description="Section 5 -
Facets - floatMinInclusiveNaNFail">
+ <tdml:document>
+ <tdml:documentPart type="byte">7f c0 00 00</tdml:documentPart>
+ </tdml:document>
+ <tdml:infoset>
+ <tdml:dfdlInfoset>
+ <floatMinInc0>NaN</floatMinInc0>
+ </tdml:dfdlInfoset>
+ </tdml:infoset>
+ <tdml:validationErrors>
+ <tdml:error>
+ minInclusive
+ </tdml:error>
+ </tdml:validationErrors>
+ </tdml:parserTestCase>
+
+ <!--
+ Test name: floatMinInclusivePosINFPass
+ Schema: binaryFloatFacetSchema
+ Purpose: This test should pass because +INF >= 0.0.
+ -->
+
+ <tdml:parserTestCase name="floatMinInclusivePosINFPass" root="floatMinInc0"
validation="limited"
+ model="binaryFloatFacetSchema" description="Section 5 -
Facets -float minInclusive +INF passes">
+ <tdml:document>
+ <tdml:documentPart type="byte">7f 80 00 00</tdml:documentPart>
+ </tdml:document>
+ <tdml:infoset>
+ <tdml:dfdlInfoset>
+ <floatMinInc0>INF</floatMinInc0>
+ </tdml:dfdlInfoset>
+ </tdml:infoset>
+ </tdml:parserTestCase>
Review Comment:
By default the TDML runner ignores unexpected validation errors. So if
things were broken and this test created a validation error when it shouldn't
then we wouldn't know it. So for these tests that pass and don't expect an
error, we need to add `ignoreUnexpectedValidationErrors="false"` to the
parserTestCases's, or we could set it for all tests in this file by adding
`defaultIgnoreUnexpectedValidationErrors="false"` to the `testSuite` element.
The later is probably preferred so we don't have to update all these tests, but
if it breaks other tests we can do the former.
--
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]