summaryrefslogtreecommitdiff
path: root/test/files/run/range.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-03-19 15:27:19 +0000
committerPaul Phillips <paulp@improving.org>2011-03-19 15:27:19 +0000
commit5bb967a3de039830dcc453bb92d3b6a0b794684f (patch)
treecc33748f925b4c0f307bd23b4b442c57f9b2046a /test/files/run/range.scala
parent8f0ff8bc2aaaa5299ebe4f617ab9e28443f994bd (diff)
downloadscala-5bb967a3de039830dcc453bb92d3b6a0b794684f.tar.gz
scala-5bb967a3de039830dcc453bb92d3b6a0b794684f.tar.bz2
scala-5bb967a3de039830dcc453bb92d3b6a0b794684f.zip
Some boundary conditions in range.
infix implicits to Integral and Fractional. As a bonus this patch knocked 10,000 long boxings off a specialized test. Who knew. Closes #4308, #4321, review by community.
Diffstat (limited to 'test/files/run/range.scala')
-rw-r--r--test/files/run/range.scala14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/files/run/range.scala b/test/files/run/range.scala
index 31d90f2d6d..2dc0bae330 100644
--- a/test/files/run/range.scala
+++ b/test/files/run/range.scala
@@ -7,6 +7,17 @@ object Test {
assert(buffer.toList == range.iterator.toList, buffer.toList+"/"+range.iterator.toList)
}
+ def boundaryTests() = {
+ // #4321
+ assert((Int.MinValue to Int.MaxValue by Int.MaxValue).size == 3)
+ // #4308
+ val caught = (
+ try { (Long.MinValue to Long.MaxValue).sum ; false }
+ catch { case _: IllegalArgumentException => true }
+ )
+ assert(caught)
+ }
+
case class GR[T](val x: T)(implicit val num: Integral[T]) {
import num._
@@ -54,5 +65,8 @@ object Test {
rangeForeach(10 until 1 by -1);
rangeForeach(10 to 1 by -3);
rangeForeach(10 until 1 by -3);
+
+ // living on the edges
+ boundaryTests()
}
}