diff options
author | Paul Phillips <paulp@improving.org> | 2011-05-05 19:04:33 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-05-05 19:04:33 +0000 |
commit | d70e69e8a8a736e2a7f55e2abf651507b0c542a7 (patch) | |
tree | 666fd4fff53adf760db380a5deb7b6ffaddea759 /test/files | |
parent | 5e499c5e4346c0951a3841ce73ccd990d47597cd (diff) | |
download | scala-d70e69e8a8a736e2a7f55e2abf651507b0c542a7.tar.gz scala-d70e69e8a8a736e2a7f55e2abf651507b0c542a7.tar.bz2 scala-d70e69e8a8a736e2a7f55e2abf651507b0c542a7.zip |
Makes BigInt's isValidThing methods make some k...
Makes BigInt's isValidThing methods make some kind of sense. I wish I
hadn't written so much code for the numerical classes which languishes
in git tributaries. Closes #4540, no review.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/is-valid-num.scala | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/files/run/is-valid-num.scala b/test/files/run/is-valid-num.scala new file mode 100644 index 0000000000..6e423e946e --- /dev/null +++ b/test/files/run/is-valid-num.scala @@ -0,0 +1,20 @@ +object Test { + def x = BigInt("10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") + def y = BigDecimal("" + (Short.MaxValue + 1) + ".0") + + def l1 = Int.MaxValue.toLong + 1 + def l2 = Int.MinValue.toLong - 1 + + def main(args: Array[String]): Unit = { + assert(!x.isValidLong, x) + assert(!x.isValidInt, x) + assert(!x.isValidChar, x) + assert(!x.isValidByte, x) + assert(!y.isValidShort, y) + assert(y.isValidChar, y) + assert(y.isValidInt, y) + + assert(!l1.isValidInt && (l1 - 1).isValidInt, l1) + assert(!l2.isValidInt && (l2 + 1).isValidInt, l2) + } +} |