Skip to content

Commit

Permalink
Verify OVC reports data too long error as necessary
Browse files Browse the repository at this point in the history
- currently we have no tests that try to OVC into a too small element. This PR adds in such a test.

DAFFODIL-1595
  • Loading branch information
olabusayoT committed Oct 15, 2024
1 parent d61a1e4 commit bd74fe5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,16 @@
</xs:complexType>
</xs:element>

<xs:element name="ovc_too_large_for_element">
<xs:complexType>
<xs:sequence>
<xs:element name="e" type="xs:double" dfdl:lengthKind="explicit"
dfdl:length="{ 4 }"
dfdl:outputValueCalc="{ 0.555 }"/>
</xs:sequence>
</xs:complexType>
</xs:element>

</tdml:defineSchema>

<tdml:unparserTestCase name="binaryIntegerBigEndian"
Expand Down Expand Up @@ -830,4 +840,21 @@
<tdml:document>1219</tdml:document>
</tdml:unparserTestCase>

<tdml:unparserTestCase name="OVCTooLargeForElem"
root="ovc_too_large_for_element" model="outputValueCalc-Embedded.dfdl.xsd"
roundTrip="false">
<tdml:infoset>
<tdml:dfdlInfoset>
<ex:ovc_too_large_for_element>
<e/>
</ex:ovc_too_large_for_element>
</tdml:dfdlInfoset>
</tdml:infoset>
<tdml:errors>
<tdml:error>Unparse Error</tdml:error>
<tdml:error>data too long</tdml:error>
<tdml:error>truncate</tdml:error>
</tdml:errors>
</tdml:unparserTestCase>

</tdml:testSuite>
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,7 @@ class TestOutputValueCalc {

// DAFFODIL-2167
@Test def test_arrayWithFollowingOVC(): Unit = { runner.runOneTest("arrayWithFollowingOVC") }

// DAFFODIL-1595
@Test def test_OVCTooLargeForElem(): Unit = { runner.runOneTest("OVCTooLargeForElem") }
}

0 comments on commit bd74fe5

Please sign in to comment.