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

mbeckerle 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 edf3ca577 Add test that illustrates float text parse bug
edf3ca577 is described below

commit edf3ca57764649e262801a65e4e6bb12a4d863af
Author: Michael Beckerle <[email protected]>
AuthorDate: Thu Dec 21 19:01:34 2023 -0500

    Add test that illustrates float text parse bug
    
    This is a representation="text" xs:float that is
    delimited. Parsing Float.MaxValue i.e., this text string:
    ```
    3.4028235E38
    ```
    I get this error:
    ```
    Parse Error: Value '340282350000000000000000000000000000000' is out of 
range for type: xs:float
    ```
    
    No similar issue for type xs:double.
    
    DAFFODIL-2867
---
 .../daffodil/section05/simple_types/SimpleTypes.tdml       | 14 ++++++++++++++
 .../daffodil/section05/simple_types/TestSimpleTypes.scala  |  4 ++++
 2 files changed, 18 insertions(+)

diff --git 
a/daffodil-test/src/test/resources/org/apache/daffodil/section05/simple_types/SimpleTypes.tdml
 
b/daffodil-test/src/test/resources/org/apache/daffodil/section05/simple_types/SimpleTypes.tdml
index 6c49131d3..2dda07540 100644
--- 
a/daffodil-test/src/test/resources/org/apache/daffodil/section05/simple_types/SimpleTypes.tdml
+++ 
b/daffodil-test/src/test/resources/org/apache/daffodil/section05/simple_types/SimpleTypes.tdml
@@ -139,6 +139,9 @@
       dfdl:textNumberPattern="000000000000000000000" />
     <xs:element name="floatTextFail" type="xs:float"
       dfdl:lengthKind="implicit" />
+    <xs:element name="floatTextDelim" type="xs:float"
+                dfdl:representation="text" dfdl:lengthKind="delimited"
+                dfdl:terminator="%SP;"/>
 
     <xs:element name="nonNegIntBin" type="xs:nonNegativeInteger"
       dfdl:representation="binary" dfdl:lengthKind="explicit" dfdl:length="{ 
16 }" />
@@ -3719,6 +3722,17 @@
     </tdml:infoset>
   </tdml:parserTestCase>
 
+  <tdml:parserTestCase name="float_text_delim" root="floatTextDelim"
+                       model="SimpleTypes-Embedded.dfdl.xsd" 
description="Section 5 Simple type-float - DFDL-5-008R">
+
+    <tdml:document><![CDATA[3.4028235E38]]></tdml:document>
+    <tdml:infoset>
+      <tdml:dfdlInfoset>
+        <floatTextDelim>3.4028235E38</floatTextDelim>
+      </tdml:dfdlInfoset>
+    </tdml:infoset>
+  </tdml:parserTestCase>
+
   <tdml:parserTestCase name="float_text3" root="floatText2"
     model="SimpleTypes-Embedded.dfdl.xsd" description="Section 5 Simple 
type-float - DFDL-5-008R"
     roundTrip="twoPass">
diff --git 
a/daffodil-test/src/test/scala/org/apache/daffodil/section05/simple_types/TestSimpleTypes.scala
 
b/daffodil-test/src/test/scala/org/apache/daffodil/section05/simple_types/TestSimpleTypes.scala
index 283830a09..7e45770d4 100644
--- 
a/daffodil-test/src/test/scala/org/apache/daffodil/section05/simple_types/TestSimpleTypes.scala
+++ 
b/daffodil-test/src/test/scala/org/apache/daffodil/section05/simple_types/TestSimpleTypes.scala
@@ -826,6 +826,10 @@ class TestSimpleTypes {
   @Test def test_float_text(): Unit = { runner.runOneTest("float_text") }
   @Test def test_float_text2(): Unit = { runner.runOneTest("float_text2") }
   @Test def test_float_text3(): Unit = { runner.runOneTest("float_text3") }
+
+  // DAFFODIL-2867
+  // @Test def test_float_text_delim(): Unit = { 
runner.runOneTest("float_text_delim") }
+
   @Test def test_float_text_fail(): Unit = { 
runner.runOneTest("float_text_fail") }
   @Test def test_characterDuringValidFloat(): Unit = {
     runner.runOneTest("characterDuringValidFloat")

Reply via email to