git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] efinnegan commented on a change in pull request #70: Adding property binaryCalendarRep with values "binarySeconds" and "bi…


efinnegan commented on a change in pull request #70: Adding property binaryCalendarRep with values "binarySeconds" and "bi…
URL: https://github.com/apache/incubator-daffodil/pull/70#discussion_r190653896
 
 

 ##########
 File path: daffodil-test/src/test/resources/org/apache/daffodil/section05/simple_types/SimpleTypes.tdml
 ##########
 @@ -1951,6 +1966,87 @@
     </tdml:infoset>
   </tdml:parserTestCase>
 
+  <!-- xs:dateTime with binaryCalendarRep='binarySeconds' -->
+  <tdml:parserTestCase name="dateTimeBin" root="dateTimeBin"
+    model="SimpleTypes-binary" description="Section 5 Schema types-dateTime - DFDL-5-016R"
+    roundTrip="true">
+
+    <tdml:document>
+      <tdml:documentPart type="bits">00000000 00000000 00000000 00111110</tdml:documentPart>
+    </tdml:document>
+    <tdml:infoset>
+      <tdml:dfdlInfoset>
+        <dateTimeBin>1977-01-01T00:01:09.000000+00:00</dateTimeBin>
+      </tdml:dfdlInfoset>
+    </tdml:infoset>
+  </tdml:parserTestCase>
+
+  <tdml:parserTestCase name="dateTimeBin2" root="dateTimeBin2"
+    model="SimpleTypes-binary" description="Section 5 Schema types-dateTime - DFDL-5-016R"
+    roundTrip="false">
+
+    <tdml:document>
+      <tdml:documentPart type="bits">00000000 00000000 00000000 00111101</tdml:documentPart>
+    </tdml:document>
+    <tdml:errors>
+      <tdml:error>Schema Definition Error: lengthUnits must be 'bytes' when binaryCalendarRep='binarySeconds'</tdml:error>
+    </tdml:errors>
+  </tdml:parserTestCase>
+
+  <tdml:parserTestCase name="dateTimeBin3" root="dateTimeBin3"
+    model="SimpleTypes-binary" description="Section 5 Schema types-dateTime - DFDL-5-016R"
+    roundTrip="false">
+
+    <tdml:document>
+      <tdml:documentPart type="bits">00000000 00000000 00000000 00111101</tdml:documentPart>
+    </tdml:document>
+    <tdml:errors>
+      <tdml:error>Schema Definition Error: binary xs:dateTime must be 32 bits when binaryCalendarRep='binarySeconds'</tdml:error>
+    </tdml:errors>
+  </tdml:parserTestCase>
+
+  <!-- xs:dateTime with binaryCalendarRep='binarySeconds' with implicit length -->
+  <tdml:parserTestCase name="dateTimeBin4" root="dateTimeBin4"
+    model="SimpleTypes-binary" description="Section 5 Schema types-dateTime - DFDL-5-016R"
+    roundTrip="true">
+
+    <tdml:document>
+      <tdml:documentPart type="bits">11111111 11111110 10101110 10000000</tdml:documentPart>
+    </tdml:document>
+    <tdml:infoset>
+      <tdml:dfdlInfoset>
+        <dateTimeBin4>1869-12-31T00:05:00.000000+00:00</dateTimeBin4>
+      </tdml:dfdlInfoset>
+    </tdml:infoset>
+  </tdml:parserTestCase>
+
+  <!-- xs:dateTime with binaryCalendarRep='binaryMillieconds' -->
+  <tdml:parserTestCase name="dateTimeBin5" root="dateTimeBin5"
 
 Review comment:
   For very large binaryMilliseconds, I don't see anything in the spec about expected behavior. Right now if adding puts it over the max long it will have a negative date.
   
   Also, a Calendar object can either be in strict or lenient mode. When in strict mode, an IllegalIcuArgumentException  will be thrown for calling setTimeInMillis with a long that is outside of the permitted range. In lenient mode it will give the min or max date permitted (-5838269-09-20 or 5828963-12-20). Default is lenient.
   
   i.e. With binaryCalendarEpoch="2000-06-15T03:25:19" and binaryMilliseconds (as a long) = 9223372036854775807 the resulting date is "-5838269-09-20T00:00:00"
   
   So which do we want:
   1. Very large numbers will "loop", using the min and max where necessary.
   2. Very large numbers should not loop and should cap at max/min.
   3. Make everything strict and throw errors if the date would be higher/lower than the max/min.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@xxxxxxxxxxxxxxxx


With regards,
Apache Git Services