You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by GitBox <gi...@apache.org> on 2019/07/02 20:53:52 UTC

[GitHub] [incubator-daffodil] mbeckerle commented on a change in pull request #258: Adds bitawareness to left over data dump

mbeckerle commented on a change in pull request #258: Adds bitawareness to left over data dump
URL: https://github.com/apache/incubator-daffodil/pull/258#discussion_r299677514
 
 

 ##########
 File path: daffodil-cli/src/it/scala/org/apache/daffodil/parsing/TestCLIParsing.scala
 ##########
 @@ -835,8 +835,64 @@ class TestCLIparsing {
       val cmd = String.format("echo 1,2,3,4,,,| %s parse -s %s -r matrix", Util.binPath, testSchemaFile)
       shell.sendLine(cmd)
       shell.expect(contains("Left over data. Consumed 56 bit(s) with at least"))
-      shell.expect(contains("Data (UTF-8) starting at byte 8 is: ("))
-      shell.expect(contains("Data (Hex) starting at byte 8 is: ("))
+      shell.expect(contains("Left over data (Hex) starting at byte 8 is: ("))
+      shell.expect(contains("Left over data (UTF-8) starting at byte 8 is: ("))
+      shell.sendLine("exit")
+      shell.expect(eof)
+    } finally {
+      shell.close()
+    }
+  }
+
+  @Test def test_CLI_Parsing_BitParse_LSBPartialByte_leftOverData() {
+    val schemaFile = Util.daffodilPath("daffodil-cli/src/it/resources/org/apache/daffodil/CLI/bits_parsing.dfdl.xsd")
+    val testSchemaFile = if (Util.isWindows) Util.cmdConvert(schemaFile) else schemaFile
+    val shell = Util.start("", true)
+
+    try {
+      val cmd = String.format("echo -n stri| %s parse -s %s -r leastFirst", Util.binPath, testSchemaFile)
+      shell.sendLine(cmd)
+      shell.expect(contains("Left over data. Consumed 10 bit(s) with at least 16 bit(s) remaining."
+        + "\nLeft over data (Hex) at byte 2 is: (0b011101xx)"
 
 Review comment:
   So I think this is misleading a bit. This isn't hex.  True you have "0b" after this, but the two juxtaposed is confusing. Technically it is ambiguous since 0B011101 is valid hex. but you meant 0b as binary indicator followed by 8 bits with some as "x". 
   
   Probably there should be a line the whole purpose of which is to describe the partial first byte when there is one. 
   It should say "Left over data starts with partial byte.  Left over data in the first byte (binary) is (0b011101xx)." 
   
   The subsequent lines can present the rest of the left-over data in Hex, or text or both. 

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


With regards,
Apache Git Services