You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by ja...@apache.org on 2018/07/09 14:52:45 UTC
[incubator-daffodil] 08/13: Removed comments that aren't relevant
anymore
This is an automated email from the ASF dual-hosted git repository.
jadams pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-daffodil.git
commit 2e16a6d81fd1bc93b0f5d5a4fb89de2f58f2c895
Author: Josh Adams <ja...@tresys.com>
AuthorDate: Wed Jun 13 16:51:10 2018 -0400
Removed comments that aren't relevant anymore
- Removed trace from tests
- Removed unnecessary code for zoned floats/doubles
---
.../processors/parsers/ZonedTextParsers.scala | 50 +++-------------------
.../daffodil/section13/zoned/TestZonedDebug.scala | 4 +-
.../daffodil/section13/zoned/TestZoned.scala | 40 ++++++++---------
3 files changed, 28 insertions(+), 66 deletions(-)
diff --git a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/ZonedTextParsers.scala b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/ZonedTextParsers.scala
index d64a55d..bf273d9 100644
--- a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/ZonedTextParsers.scala
+++ b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/ZonedTextParsers.scala
@@ -77,10 +77,6 @@ case class ConvertZonedNumberParser[S](
}
var checkLength = str.length
- // because of the way the zero rep regular expressions are generated, they
- // will match either all or none of 'str', never part of it. Thus,
- // findFirstIn() either matches and it's a zero rep, or it doesn't and it's
- // not a zero
val numValue = {
val df = nff.getNumFormat(start)
val pos = new ParsePosition(0)
@@ -118,14 +114,6 @@ case class ConvertZonedNumberParser[S](
val asNumber = helper.getNum(num)
Assert.invariant(!asNumber.isInstanceOf[String])
- // The following change was made because of the issues with the float
- // adding a position of precision to the Number object. At some point we
- // will want to revert this back to the actual type but this is a quick fix
- // for the issues we were having with the 0.003 vs 0.0030 error in test_DelimProp_05
- //
- //helper.getStringFormat(asNumber)
- //
- // Above was changed back into the actual number object.
asNumber
}
numValue
@@ -339,38 +327,6 @@ case class ConvertZonedDecimalParserUnparserHelper[S]()
}
}
-case class ConvertZonedDoubleParserUnparserHelper[S]()
- extends ConvertZonedFloatingPointNumberParserUnparserHelper[Double]() {
-
- val MAX_VALUE = new JBigDecimal(Double.MaxValue)
- val MIN_VALUE = new JBigDecimal(Double.MinValue)
-
- override def getNum(num: Number) = num.doubleValue
- override val xsdType = "double"
- override val prettyType = "Double"
- def isInvalidRange(n: java.lang.Number): Boolean = {
- val d = n.doubleValue() // This can truncate the number and void range checking
- val bd = new JBigDecimal(n.toString)
- (d.isNaN || bd.compareTo(MIN_VALUE) < 0 || bd.compareTo(MAX_VALUE) > 0)
- }
-}
-
-case class ConvertZonedFloatParserUnparserHelper[S]()
- extends ConvertZonedFloatingPointNumberParserUnparserHelper[Float]() {
-
- val MAX_VALUE = new JBigDecimal(Float.MaxValue)
- val MIN_VALUE = new JBigDecimal(Float.MinValue)
-
- override def getNum(num: Number) = num.floatValue
- override val xsdType = "float"
- override val prettyType = "Float"
- def isInvalidRange(n: java.lang.Number): Boolean = {
- val f = n.floatValue() // This can truncated the number and void range checking
- val bd = new JBigDecimal(n.toString)
- (f.isNaN || bd.compareTo(MIN_VALUE) < 0 || bd.compareTo(MAX_VALUE) > 0)
- }
-}
-
abstract class ZonedFormatFactoryBase[S](parserHelper: ConvertZonedNumberParserUnparserHelperBase[S]) extends Serializable {
protected def checkUnique(
@@ -395,6 +351,12 @@ abstract class ZonedFormatFactoryBase[S](parserHelper: ConvertZonedNumberParserU
roundingMode: Maybe[TextNumberRoundingMode],
roundingIncrement: MaybeDouble) = {
+ /* Need to remove the '+' from the number pattern as '+' is only
+ * used to indicate which digit of the number is overpunched when
+ * dealing with zoned decimal formats. If the '+' is not removed
+ * DecimalFormat will attempt to use it as an indicator for exponent
+ * numbers, which will most likely not match the zoned number being
+ * parsed */
val df = new DecimalFormat(pattern.replace("+", ""))
val cp = checkPolicy match {
diff --git a/daffodil-test/src/test/scala-debug/org/apache/daffodil/section13/zoned/TestZonedDebug.scala b/daffodil-test/src/test/scala-debug/org/apache/daffodil/section13/zoned/TestZonedDebug.scala
index bdd7fbc..acab1d2 100644
--- a/daffodil-test/src/test/scala-debug/org/apache/daffodil/section13/zoned/TestZonedDebug.scala
+++ b/daffodil-test/src/test/scala-debug/org/apache/daffodil/section13/zoned/TestZonedDebug.scala
@@ -34,6 +34,6 @@ object TestZoned {
class TestZoned {
import TestZoned._
- @Test def testZonedTandemModified02(): Unit = { runner.trace.runOneTest("ZonedTandemModified02") }
- @Test def testZonedTandemModified05(): Unit = { runner.trace.runOneTest("ZonedTandemModified05") }
+ @Test def testZonedTandemModified02(): Unit = { runner.runOneTest("ZonedTandemModified02") }
+ @Test def testZonedTandemModified05(): Unit = { runner.runOneTest("ZonedTandemModified05") }
}
diff --git a/daffodil-test/src/test/scala/org/apache/daffodil/section13/zoned/TestZoned.scala b/daffodil-test/src/test/scala/org/apache/daffodil/section13/zoned/TestZoned.scala
index 4c95029..1fd36f8 100644
--- a/daffodil-test/src/test/scala/org/apache/daffodil/section13/zoned/TestZoned.scala
+++ b/daffodil-test/src/test/scala/org/apache/daffodil/section13/zoned/TestZoned.scala
@@ -42,27 +42,27 @@ class TestZoned {
@Test def testZonedDoubleFail01(): Unit = { runner.runOneTest("zoned_double_fail01") }
//TODO: @Test def testZonedEncodingFail01(): Unit = { runner.runOneTest("zoned_encoding_fail01") }
- @Test def testZonedStandard01(): Unit = { runner.trace.runOneTest("ZonedStandard01") }
- @Test def testZonedStandard02(): Unit = { runner.trace.runOneTest("ZonedStandard02") }
- @Test def testZonedStandard03(): Unit = { runner.trace.runOneTest("ZonedStandard03") }
- @Test def testZonedStandard04(): Unit = { runner.trace.runOneTest("ZonedStandard04") }
- @Test def testZonedStandard05(): Unit = { runner.trace.runOneTest("ZonedStandard05") }
+ @Test def testZonedStandard01(): Unit = { runner.runOneTest("ZonedStandard01") }
+ @Test def testZonedStandard02(): Unit = { runner.runOneTest("ZonedStandard02") }
+ @Test def testZonedStandard03(): Unit = { runner.runOneTest("ZonedStandard03") }
+ @Test def testZonedStandard04(): Unit = { runner.runOneTest("ZonedStandard04") }
+ @Test def testZonedStandard05(): Unit = { runner.runOneTest("ZonedStandard05") }
- @Test def testZonedTranslatedEBCDIC01(): Unit = { runner.trace.runOneTest("ZonedTranslatedEBCDIC01") }
- @Test def testZonedTranslatedEBCDIC02(): Unit = { runner.trace.runOneTest("ZonedTranslatedEBCDIC02") }
- @Test def testZonedTranslatedEBCDIC03(): Unit = { runner.trace.runOneTest("ZonedTranslatedEBCDIC03") }
- @Test def testZonedTranslatedEBCDIC04(): Unit = { runner.trace.runOneTest("ZonedTranslatedEBCDIC04") }
- @Test def testZonedTranslatedEBCDIC05(): Unit = { runner.trace.runOneTest("ZonedTranslatedEBCDIC05") }
+ @Test def testZonedTranslatedEBCDIC01(): Unit = { runner.runOneTest("ZonedTranslatedEBCDIC01") }
+ @Test def testZonedTranslatedEBCDIC02(): Unit = { runner.runOneTest("ZonedTranslatedEBCDIC02") }
+ @Test def testZonedTranslatedEBCDIC03(): Unit = { runner.runOneTest("ZonedTranslatedEBCDIC03") }
+ @Test def testZonedTranslatedEBCDIC04(): Unit = { runner.runOneTest("ZonedTranslatedEBCDIC04") }
+ @Test def testZonedTranslatedEBCDIC05(): Unit = { runner.runOneTest("ZonedTranslatedEBCDIC05") }
- @Test def testZonedCARealiaModified01(): Unit = { runner.trace.runOneTest("ZonedCARealiaModified01") }
- @Test def testZonedCARealiaModified02(): Unit = { runner.trace.runOneTest("ZonedCARealiaModified02") }
- @Test def testZonedCARealiaModified03(): Unit = { runner.trace.runOneTest("ZonedCARealiaModified03") }
- @Test def testZonedCARealiaModified04(): Unit = { runner.trace.runOneTest("ZonedCARealiaModified04") }
- @Test def testZonedCARealiaModified05(): Unit = { runner.trace.runOneTest("ZonedCARealiaModified05") }
+ @Test def testZonedCARealiaModified01(): Unit = { runner.runOneTest("ZonedCARealiaModified01") }
+ @Test def testZonedCARealiaModified02(): Unit = { runner.runOneTest("ZonedCARealiaModified02") }
+ @Test def testZonedCARealiaModified03(): Unit = { runner.runOneTest("ZonedCARealiaModified03") }
+ @Test def testZonedCARealiaModified04(): Unit = { runner.runOneTest("ZonedCARealiaModified04") }
+ @Test def testZonedCARealiaModified05(): Unit = { runner.runOneTest("ZonedCARealiaModified05") }
- @Test def testZonedTandemModified01(): Unit = { runner.trace.runOneTest("ZonedTandemModified01") }
- //@Test def testZonedTandemModified02(): Unit = { runner.trace.runOneTest("ZonedTandemModified02") }
- @Test def testZonedTandemModified03(): Unit = { runner.trace.runOneTest("ZonedTandemModified03") }
- @Test def testZonedTandemModified04(): Unit = { runner.trace.runOneTest("ZonedTandemModified04") }
- //@Test def testZonedTandemModified05(): Unit = { runner.trace.runOneTest("ZonedTandemModified05") }
+ @Test def testZonedTandemModified01(): Unit = { runner.runOneTest("ZonedTandemModified01") }
+ //@Test def testZonedTandemModified02(): Unit = { runner.runOneTest("ZonedTandemModified02") }
+ @Test def testZonedTandemModified03(): Unit = { runner.runOneTest("ZonedTandemModified03") }
+ @Test def testZonedTandemModified04(): Unit = { runner.runOneTest("ZonedTandemModified04") }
+ //@Test def testZonedTandemModified05(): Unit = { runner.runOneTest("ZonedTandemModified05") }
}