mbeckerle commented on a change in pull request #88: Daffodil 1919 separators
URL: https://github.com/apache/incubator-daffodil/pull/88#discussion_r206591116
 
 

 ##########
 File path: 
daffodil-tdml/src/main/scala/org/apache/daffodil/tdml/TDMLRunner.scala
 ##########
 @@ -899,65 +946,90 @@ case class ParserTestCase(ptc: NodeSeq, parentArg: 
DFDLTestSuite)
     // if we get here, the parse test passed. If we don't get here then some 
exception was
     // thrown either during the run of the test or during the comparison.
 
-      roundTrip match {
-        case NoRoundTrip => {
-          // done. Do nothing else.
-        }
-        case OnePassRoundTrip => {
-          val outStream = new java.io.ByteArrayOutputStream()
+    roundTrip match {
+      case NoRoundTrip => {
+        // done. Do nothing else.
+      }
+      case OnePassRoundTrip => {
+        val outStream = new java.io.ByteArrayOutputStream()
 
-          doOnePassRoundTripUnparseExpectSuccess(processor, outStream, 
firstPassInfosetOutputter)
+        doOnePassRoundTripUnparseExpectSuccess(processor, outStream, 
firstPassInfosetOutputter)
 
-          // It has to work, as this is one pass round trip. We expect it to 
unparse
-          // directly back to the original input form.
+        // It has to work, as this is one pass round trip. We expect it to 
unparse
+        // directly back to the original input form.
 
-          VerifyTestCase.verifyUnparserTestData(new 
ByteArrayInputStream(firstParseTestData), outStream)
-        }
-        case TwoPassRoundTrip => {
-          //
-          // In two-pass, the unparse comparison of data from first unparse
-          // to the original input data MUST fail.
-          // We need to unparse, then parse again to have the comparison work
-          // thereby showing that while the output data is different, it is
-          // equivalent in that re-parsing that data produces the same infoset
-          // that parsing the original data did.
-          //
-          val outStream = new java.io.ByteArrayOutputStream()
-          val unparseResult: UnparseResult = 
doOnePassRoundTripUnparseExpectSuccess(processor, outStream, 
firstPassInfosetOutputter)
-          val isUnparseOutputDataMatching =
-            try {
-              VerifyTestCase.verifyUnparserTestData(new 
ByteArrayInputStream(firstParseTestData), outStream)
-              true
-            } catch {
-              case e: TDMLException => {
-                false
-                //
-                // We got the failure we expect for a two-pass test on the 
unparse.
-                //
-              }
+        VerifyTestCase.verifyUnparserTestData(new 
ByteArrayInputStream(firstParseTestData), outStream)
+      }
+      case TwoPassRoundTrip => {
+        //
+        // In two-pass, the unparse comparison of data from first unparse
+        // to the original input data MUST fail.
+        // We need to unparse, then parse again to have the comparison work
+        // thereby showing that while the output data is different, it is
+        // equivalent in that re-parsing that data produces the same infoset
+        // that parsing the original data did.
+        //
+
+        val (outputter, actual, _, reParseTestDataLength) =
+          doTwoPassRoundTripExpectSuccess(
+            processor,
+            firstPassInfosetOutputter,
+            firstParseTestData,
+            testInfoset)
+        verifyParseResults(processor, actual, testInfoset, outputter)
+        verifyLeftOverData(actual, reParseTestDataLength)
+        // if it doesn't pass, it will throw out of here.
+      }
+      case ThreePassRoundTrip => {
+        //
+        // In three-pass, the unparse comparison of data from first unparse
+        // to the original input data MUST fail.
+        // We need to unparse, then parse again and the infoset comparison
+        // must ALSO fail.
+        // Then we unparse again, and get same data as the first unparse.
+        // At that point we're in steady state.
 
 Review comment:
   A test is needed that illustrates masking an error via three-pass.

----------------------------------------------------------------
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

Reply via email to