This is an automated email from the ASF dual-hosted git repository.

olabusayo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil.git


The following commit(s) were added to refs/heads/main by this push:
     new be5394d3f Verify OVC reports data too long error as necessary
be5394d3f is described below

commit be5394d3f1385ee64fd6ade283a578eab1503a33
Author: olabusayoT <[email protected]>
AuthorDate: Sun Oct 13 18:00:57 2024 -0400

    Verify OVC reports data too long error as necessary
    
    - currently we have no tests that try to OVC into a too small element. This 
PR adds in such a test.
    
    DAFFODIL-1595
---
 .../calc_value_properties/outputValueCalc.tdml     | 27 ++++++++++++++++++++++
 .../TestOutputValueCalc.scala                      |  3 +++
 2 files changed, 30 insertions(+)

diff --git 
a/daffodil-test/src/test/resources/org/apache/daffodil/section17/calc_value_properties/outputValueCalc.tdml
 
b/daffodil-test/src/test/resources/org/apache/daffodil/section17/calc_value_properties/outputValueCalc.tdml
index aa3e76d70..a379d3a3c 100644
--- 
a/daffodil-test/src/test/resources/org/apache/daffodil/section17/calc_value_properties/outputValueCalc.tdml
+++ 
b/daffodil-test/src/test/resources/org/apache/daffodil/section17/calc_value_properties/outputValueCalc.tdml
@@ -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"
@@ -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>
diff --git 
a/daffodil-test/src/test/scala/org/apache/daffodil/section17/calc_value_properties/TestOutputValueCalc.scala
 
b/daffodil-test/src/test/scala/org/apache/daffodil/section17/calc_value_properties/TestOutputValueCalc.scala
index d1868ee3a..f903e42a4 100644
--- 
a/daffodil-test/src/test/scala/org/apache/daffodil/section17/calc_value_properties/TestOutputValueCalc.scala
+++ 
b/daffodil-test/src/test/scala/org/apache/daffodil/section17/calc_value_properties/TestOutputValueCalc.scala
@@ -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") }
 }

Reply via email to