mbeckerle commented on a change in pull request #79: TDMLRunner explicit 
roundTrip="twoPass" feature.
URL: https://github.com/apache/incubator-daffodil/pull/79#discussion_r202360628
 
 

 ##########
 File path: 
daffodil-tdml/src/main/scala/org/apache/daffodil/tdml/TDMLRunner.scala
 ##########
 @@ -77,12 +77,43 @@ import org.apache.daffodil.api.DaffodilTunables
 import org.apache.daffodil.processors.charset.NBitsWidth_BitsCharset
 import org.apache.daffodil.processors.charset.NBitsWidth_BitsCharsetEncoder
 import java.nio.charset.{ Charset => JavaCharset }
+import java.io.OutputStream
 
 /**
  * Parses and runs tests expressed in IBM's contributed tdml "Test Data Markup 
Language"
  */
 
+sealed trait RoundTrip
+
+/**
+ * Test is just a parse test, or just an unparse, with no round trip involved.
+ */
+case object NoRoundTrip extends RoundTrip
+
+/**
+ * Test round trips simply. Unparse produces exactly the original data.
+ */
+case object SimpleRoundTrip extends RoundTrip
+
+/**
+ * Unparse doesn't produce original data, but equivalent canonical data which
+ * if reparsed in a second parse pass, produces the same infoset as the first
+ * parse.
+ */
+case object TwoPassRoundTrip extends RoundTrip
+
 private[tdml] object DFDLTestSuite {
+
+  /**
+   * Use to convert round trip default into enum value
+   */
+  def standardizeRoundTrip(enumStr: String): RoundTrip =
+    enumStr match {
+      case "false" | "none" => NoRoundTrip
+      case "true" | "simple" => SimpleRoundTrip
+      case "twoPass" => TwoPassRoundTrip
+    }
 
 Review comment:
   If I did it that way I'd still have to override the stringToEnum methods to 
accomodate the backward compatibility for false and true string values. 
   
   This usage is so simple I'm inclined to just leave it. It is true that it is 
not consistent in that our code is not doing ALL enums the same way, but this 
isn't the only example of inconsistency there, and this is one of the idiomatic 
ways to do enumerated objects in scala. 
   

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