stevedlawrence commented on a change in pull request #83: Adding value of 'bcd'
to binaryCalendarRep
URL: https://github.com/apache/incubator-daffodil/pull/83#discussion_r203375347
##########
File path:
daffodil-test/src/test/resources/org/apache/daffodil/section05/simple_types/SimpleTypes.tdml
##########
@@ -2251,7 +2304,244 @@
</tdml:errors>
</tdml:parserTestCase>
- <tdml:parserTestCase name="dateBin2" root="dateBin2"
+ <tdml:parserTestCase name="dateTimeBin20" root="dateTimeBin12"
+ 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: Subset lengthKind='delimited' only
supported for packed binary formats.</tdml:error>
+ </tdml:errors>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="dateBinBCD" root="dateBinBCD"
+ model="SimpleTypes-binary" description="Section 5 Schema types-dateTime -
DFDL-5-016R"
+ roundTrip="true">
+
+ <tdml:document>
+ <tdml:documentPart type="byte">12 14 23</tdml:documentPart>
+ </tdml:document>
+ <tdml:infoset>
+ <tdml:dfdlInfoset>
+ <dateBinBCD>2023-12-14</dateBinBCD>
+ </tdml:dfdlInfoset>
+ </tdml:infoset>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="dateBinBCD2" root="dateBinBCD2"
+ model="SimpleTypes-binary" description="Section 5 Schema types-dateTime -
DFDL-5-016R"
+ roundTrip="true">
+
+ <tdml:document>
+ <tdml:documentPart type="byte">12 14 20 23</tdml:documentPart>
+ </tdml:document>
+ <tdml:infoset>
+ <tdml:dfdlInfoset>
+ <dateBinBCD2>2023-12-14</dateBinBCD2>
+ </tdml:dfdlInfoset>
+ </tdml:infoset>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="dateBinBCD3" root="dateBinBCD"
+ model="SimpleTypes-binary" description="Section 5 Schema types-dateTime -
DFDL-5-016R"
+ roundTrip="false">
+
+ <tdml:document>
+ <tdml:documentPart type="byte">12 0F 23</tdml:documentPart>
+ </tdml:document>
+ <tdml:errors>
+ <tdml:error>Parse Error</tdml:error>
+ <tdml:error>Invalid low nibble</tdml:error>
+ </tdml:errors>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="dateBinBCD4" root="dateBinBCD3"
+ model="SimpleTypes-binary" description="Section 5 Schema types-dateTime -
DFDL-5-016R"
+ roundTrip="false">
+
+ <tdml:document>
+ <tdml:documentPart type="byte">08 17 48</tdml:documentPart>
+ </tdml:document>
+ <tdml:errors>
+ <tdml:error>Schema Definition Error</tdml:error>
+ <tdml:error>Character '-' not allowed in dfdl:calendarPattern for
xs:date with a binaryCalendarRep of 'bcd'</tdml:error>
+ </tdml:errors>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="dateBinBCD5" root="dateBinBCD4"
+ model="SimpleTypes-binary" description="Section 5 Schema types-dateTime -
DFDL-5-016R"
+ roundTrip="false">
+
+ <tdml:document>
+ <tdml:documentPart type="bits">0000000</tdml:documentPart>
+ </tdml:document>
+ <tdml:errors>
+ <tdml:error>Schema Definition Error</tdml:error>
+ <tdml:error>The given length (7 bits) must be a multiple of 4 when using
binaryCalendarRep='bcd'</tdml:error>
+ </tdml:errors>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="dateBinBCD6" root="dateBinBCD"
+ model="SimpleTypes-binary" description="Section 5 Schema types-dateTime -
DFDL-5-016R"
+ roundTrip="true">
+
+ <tdml:document>
+ <tdml:documentPart type="bits">0001 0010 0010 0111 1001
1001</tdml:documentPart>
+ </tdml:document>
+ <tdml:infoset>
+ <tdml:dfdlInfoset>
+ <dateBinBCD>1999-12-27</dateBinBCD>
+ </tdml:dfdlInfoset>
+ </tdml:infoset>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="timeBinBCD" root="timeBinBCD"
+ model="SimpleTypes-binary" description="Section 5 Schema types-dateTime -
DFDL-5-016R"
+ roundTrip="true">
+
+ <tdml:document>
+ <tdml:documentPart type="byte">18 56 03</tdml:documentPart>
+ </tdml:document>
+ <tdml:infoset>
+ <tdml:dfdlInfoset>
+ <timeBinBCD>18:56:03.000000</timeBinBCD>
+ </tdml:dfdlInfoset>
+ </tdml:infoset>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="timeBinBCD2" root="timeBinBCD2"
+ model="SimpleTypes-binary" description="Section 5 Schema types-dateTime -
DFDL-5-016R"
+ roundTrip="twoPass">
+
+ <tdml:document>
+ <tdml:documentPart type="byte">01 45 00 99 87</tdml:documentPart>
+ </tdml:document>
+ <tdml:infoset>
+ <tdml:dfdlInfoset>
+ <timeBinBCD2>01:45:00.998000</timeBinBCD2>
+ </tdml:dfdlInfoset>
+ </tdml:infoset>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="timeBinBCD3" root="timeBinBCD3"
+ model="SimpleTypes-binary" description="Section 5 Schema types-dateTime -
DFDL-5-016R"
+ roundTrip="false">
+
+ <tdml:document>
+ <tdml:documentPart type="byte">01 45 00 99 87</tdml:documentPart>
+ </tdml:document>
+ <tdml:errors>
+ <tdml:error>Schema Definition Error</tdml:error>
+ <tdml:error>calendarPatternKind must be 'explicit' when
binaryCalendarRep='bcd'</tdml:error>
+ </tdml:errors>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="timeBinBCD4" root="timeBinBCD4"
+ model="SimpleTypes-binary" description="Section 5 Schema types-dateTime -
DFDL-5-016R"
+ roundTrip="true">
+
+ <tdml:document>
+ <tdml:documentPart type="byte">18 56 03</tdml:documentPart>
+ </tdml:document>
+ <tdml:errors>
+ <tdml:error>Schema Definition Error</tdml:error>
+ <tdml:error>Size of binary data 'Time' cannot be determined
implicitly</tdml:error>
+ </tdml:errors>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="timeBinBCD5" root="timeBinBCD5"
+ model="SimpleTypes-binary" description="Section 5 Schema types-dateTime -
DFDL-5-016R"
+ roundTrip="true">
+
+ <tdml:document>
+ <tdml:documentPart type="byte">18 56 03 3B</tdml:documentPart>
+ </tdml:document>
+ <tdml:infoset>
+ <tdml:dfdlInfoset>
+ <timeBinBCD5>18:56:03.000000</timeBinBCD5>
+ </tdml:dfdlInfoset>
+ </tdml:infoset>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="timeBinBCD6" root="timeBinBCD6"
+ model="SimpleTypes-binary" description="Section 5 Schema types-dateTime -
DFDL-5-016R"
+ roundTrip="true">
+
+ <tdml:document>
+ <tdml:documentPart type="byte">03 18 56 03</tdml:documentPart>
+ </tdml:document>
+ <tdml:infoset>
+ <tdml:dfdlInfoset>
+ <timeBinBCD6>
+ <length>3</length>
+ <time>18:56:03.000000</time>
+ </timeBinBCD6>
+ </tdml:dfdlInfoset>
+ </tdml:infoset>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="dateTimeBinBCD" root="dateTimeBinBCD"
+ model="SimpleTypes-binary" description="Section 5 Schema types-dateTime -
DFDL-5-016R"
+ roundTrip="true">
+
+ <tdml:document>
+ <tdml:documentPart type="byte">06 14 20 04 18 56 03</tdml:documentPart>
+ </tdml:document>
+ <tdml:infoset>
+ <tdml:dfdlInfoset>
+ <dateTimeBinBCD>2004-06-14T18:56:03.000000</dateTimeBinBCD>
+ </tdml:dfdlInfoset>
+ </tdml:infoset>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="dateTimeBinBCD2" root="dateTimeBinBCD2"
+ model="SimpleTypes-binary" description="Section 5 Schema types-dateTime -
DFDL-5-016R"
+ roundTrip="false">
+
+ <tdml:document>
+ <tdml:documentPart type="byte">01 45 00 99 87</tdml:documentPart>
+ </tdml:document>
+ <tdml:errors>
+ <tdml:error>Schema Definition Error</tdml:error>
+ <tdml:error>Size of binary data 'DateTime' with binaryCalendarRep='bcd'
cannot be determined implicitly</tdml:error>
+ </tdml:errors>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="dateTimeBinBCD3" root="dateTimeBinBCD3"
+ model="SimpleTypes-binary" description="Section 5 Schema types-dateTime -
DFDL-5-016R"
+ roundTrip="true">
+
Review comment:
Yeah, sounds to me like a single pass round trip won't work, since the
unparsed data wont' exactly match the original data. Instead, try setting
roundTrip="twoPass" for this test. The second pass will try parsing the non
matching unparsed data and that should match the infoset.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services