diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-01-15 14:13:53 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-01-15 14:13:53 -0800 |
commit | 4f7ff0ad530fee6d75c95194ecec87a8c1ce4486 (patch) | |
tree | 8296f1d33ddb46c61102c40d3ee12a81540f5c4a /test/files/run/is-valid-num.scala | |
parent | 6ea9933e262ab286165511a90f3e1df341e032a4 (diff) | |
parent | 29541ce3961a797836b232ccc12a60cc09f5de3e (diff) | |
download | scala-4f7ff0ad530fee6d75c95194ecec87a8c1ce4486.tar.gz scala-4f7ff0ad530fee6d75c95194ecec87a8c1ce4486.tar.bz2 scala-4f7ff0ad530fee6d75c95194ecec87a8c1ce4486.zip |
Merge pull request #3316 from Ichoran/topic/big-decimal-correctness
Quasi-comprehensive BigDecimal soundness/correctness fix.
Diffstat (limited to 'test/files/run/is-valid-num.scala')
-rw-r--r-- | test/files/run/is-valid-num.scala | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/test/files/run/is-valid-num.scala b/test/files/run/is-valid-num.scala index d314015dd4..65e8ceeca6 100644 --- a/test/files/run/is-valid-num.scala +++ b/test/files/run/is-valid-num.scala @@ -19,25 +19,27 @@ object Test { assert(!x.isValidChar, x) assert(!x.isValidShort, x) assert(!x.isValidByte, x) -// assert(y.isWhole, y) + assert(y.isWhole, y) assert(!y.isValidShort, y) assert(y.isValidChar, y) assert(y.isValidInt, y) - assert(y.isValidFloat, y) - assert(y.isValidDouble, y) + assert(y.isDecimalFloat, y) + assert(y.isDecimalDouble, y) assert(y.isValidLong, y) assert(!y.isValidByte, y) -// assert(!y1.isWhole) + assert(!y1.isWhole) assert(!y1.isValidLong, y1) - assert(!y1.isValidFloat, y1) - assert(!y1.isValidDouble, y1) + assert(y1.isDecimalFloat, y1) + assert(y1.isDecimalDouble, y1) + assert(!y1.isExactFloat, y1) + assert(!y1.isExactDouble, y1) assert(!y1.isValidInt, y1) assert(!y1.isValidChar, y1) assert(!y1.isValidShort, y1) assert(!y1.isValidByte, y1) assert(!y2.isValidLong, y2) - assert(y2.isValidFloat, y2) - assert(y2.isValidDouble, y2) + assert(y2.isExactFloat, y2) + assert(y2.isExactDouble, y2) assert(!l1.isValidInt && (l1 - 1).isValidInt, l1) assert(!l2.isValidInt && (l2 + 1).isValidInt, l2) @@ -170,8 +172,8 @@ object Test { if (!d.isInfinity) { val bd = BigDecimal(new java.math.BigDecimal(d)) // assert(!bd.isWhole, bd) - assert(bd.isValidDouble, bd) - assert(bd.isValidFloat == isFloat, bd) + assert(bd.isExactDouble, bd) + assert(bd.isExactFloat == isFloat, bd) assert(!bd.isValidLong, bd) assert(!bd.isValidInt, bd) assert(!bd.isValidChar, bd) @@ -210,9 +212,9 @@ object Test { val isFloat = !bi.toFloat.isInfinity && bd.compare(BigDecimal(new java.math.BigDecimal(bi.toFloat))) == 0 val isDouble = !bi.toDouble.isInfinity && bd.compare(BigDecimal(new java.math.BigDecimal(bi.toDouble))) == 0 -// assert(bd.isWhole, bd) - assert(bd.isValidDouble == isDouble, bd) - assert(bd.isValidFloat == isFloat, bd) + assert(bd.isWhole, bd) + assert(bd.isBinaryDouble == isDouble, bd) + assert(bd.isBinaryFloat == isFloat, bd) assert(bd.isValidLong == isLong, bd) assert(bd.isValidInt == isInt, bd) assert(bd.isValidChar == isChar, bd) |