summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/bug3397.scala7
-rw-r--r--test/files/run/numbereq.scala2
-rw-r--r--test/files/run/programmatic-main.check2
-rw-r--r--test/files/run/spec-matrix.check1
-rw-r--r--test/files/run/spec-matrix.scala70
-rw-r--r--test/files/run/stream_length.scala15
-rw-r--r--test/files/run/t2946/Parsers.scala4
-rw-r--r--test/files/run/t2946/ResponseCommon.scala14
-rw-r--r--test/files/run/t2946/Test.scala7
9 files changed, 79 insertions, 43 deletions
diff --git a/test/files/run/bug3397.scala b/test/files/run/bug3397.scala
new file mode 100644
index 0000000000..2c8cbed3ab
--- /dev/null
+++ b/test/files/run/bug3397.scala
@@ -0,0 +1,7 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ val x = Seq(Set(1,2,3),Set(4,5,6),Set(7,8,9)).transpose
+
+ ()
+ }
+}
diff --git a/test/files/run/numbereq.scala b/test/files/run/numbereq.scala
index 52f32cc52a..b07c83dc3e 100644
--- a/test/files/run/numbereq.scala
+++ b/test/files/run/numbereq.scala
@@ -33,7 +33,7 @@ object Test {
val sets = setneg1 ++ setneg2 ++ List(zero) ++ setpos1 ++ setpos2
for (set <- sets ; x <- set ; y <- set) {
- println("'%s' == '%s' (%s == %s) (%s == %s)".format(x, y, x.hashCode, y.hashCode, x.##, y.##))
+ // println("'%s' == '%s' (%s == %s) (%s == %s)".format(x, y, x.hashCode, y.hashCode, x.##, y.##))
assert(x == y, "%s/%s != %s/%s".format(x, x.getClass, y, y.getClass))
assert(x.## == y.##, "%s != %s".format(x.getClass, y.getClass))
}
diff --git a/test/files/run/programmatic-main.check b/test/files/run/programmatic-main.check
index 3429195265..e6c83a6f48 100644
--- a/test/files/run/programmatic-main.check
+++ b/test/files/run/programmatic-main.check
@@ -5,9 +5,7 @@ typer
superaccessors
pickler
refchecks
-selectiveanf
liftcode
-selectivecps
uncurry
tailcalls
specialize
diff --git a/test/files/run/spec-matrix.check b/test/files/run/spec-matrix.check
new file mode 100644
index 0000000000..72e8ffc0db
--- /dev/null
+++ b/test/files/run/spec-matrix.check
@@ -0,0 +1 @@
+*
diff --git a/test/files/run/spec-matrix.scala b/test/files/run/spec-matrix.scala
new file mode 100644
index 0000000000..81e3eaf212
--- /dev/null
+++ b/test/files/run/spec-matrix.scala
@@ -0,0 +1,70 @@
+/** Test matrix multiplication with specialization.
+ */
+
+class Matrix[@specialized A: ClassManifest](val rows: Int, val cols: Int) {
+ private val arr: Array[Array[A]] = new Array[Array[A]](rows, cols)
+
+ def apply(i: Int, j: Int): A = {
+ if (i < 0 || i >= rows || j < 0 || j >= cols)
+ throw new NoSuchElementException("Indexes out of bounds: " + (i, j))
+
+ arr(i)(j)
+ }
+
+ def update(i: Int, j: Int, e: A) {
+ arr(i)(j) = e
+ }
+
+ def rowsIterator: Iterator[Array[A]] = new Iterator[Array[A]] {
+ var idx = 0;
+ def hasNext = idx < rows
+ def next = {
+ idx += 1
+ arr(idx - 1)
+ }
+ }
+}
+
+object Test {
+ def main(args: Array[String]) {
+ val m = randomMatrix(200, 100)
+ val n = randomMatrix(100, 200)
+
+ mult(m, n)
+ println("*")
+ }
+
+ def randomMatrix(n: Int, m: Int) = {
+ val r = new util.Random(10)
+ val x = new Matrix[Int](n, m)
+ for (i <- 0 until n; j <- 0 until m)
+ x(i, j) = r.nextInt
+ x
+ }
+
+
+ def multManifest[@specialized(Int) T](m: Matrix[T], n: Matrix[T])(implicit cm: ClassManifest[T], num: Numeric[T]) {
+ val p = new Matrix[T](m.rows, n.cols)
+ import num._
+
+ for (i <- 0 until m.rows)
+ for (j <- 0 until n.cols) {
+ var sum = num.zero
+ for (k <- 0 until n.rows)
+ sum += m(i, k) * n(k, j)
+ p(i, j) = sum
+ }
+ }
+
+ def mult(m: Matrix[Int], n: Matrix[Int]) {
+ val p = new Matrix[Int](m.rows, n.cols)
+
+ for (i <- 0 until m.rows)
+ for (j <- 0 until n.cols) {
+ var sum = 0
+ for (k <- 0 until n.rows)
+ sum += m(i, k) * n(k, j)
+ p(i, j) = sum
+ }
+ }
+}
diff --git a/test/files/run/stream_length.scala b/test/files/run/stream_length.scala
deleted file mode 100644
index 68e9cad5ac..0000000000
--- a/test/files/run/stream_length.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-object Test {
- def walk(depth: Int, bias: String): Stream[String] = {
- if (depth == 0)
- Stream(bias)
- else {
- Stream.concat(Stream.range(1, 100).map((x: Int) => walk(depth-1, bias + x)))
- }
- }
-
- def main(args: Array[String]) {
- println("Length: " + walk(3, "---").length)
- }
-}
diff --git a/test/files/run/t2946/Parsers.scala b/test/files/run/t2946/Parsers.scala
deleted file mode 100644
index c0961034c4..0000000000
--- a/test/files/run/t2946/Parsers.scala
+++ /dev/null
@@ -1,4 +0,0 @@
-class Parser {
- def parse(t: Any): Unit = {
- }
-}
diff --git a/test/files/run/t2946/ResponseCommon.scala b/test/files/run/t2946/ResponseCommon.scala
deleted file mode 100644
index fa9d8acccb..0000000000
--- a/test/files/run/t2946/ResponseCommon.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-trait ResponseCommon extends Parser {
- private[this] var paramsParser: Parser = null
- def withParamsParser(parser: Parser) = {paramsParser = parser; this}
-
- class Foo {
- println(paramsParser)
- }
-
- override abstract def parse(t: Any): Unit = t match {
- case ("params", value: List[_]) => value.foreach {paramsParser.parse(_)}
- case _ => super.parse(t)
- }
-}
-
diff --git a/test/files/run/t2946/Test.scala b/test/files/run/t2946/Test.scala
deleted file mode 100644
index e9d9896a0e..0000000000
--- a/test/files/run/t2946/Test.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-class Test extends Parser with ResponseCommon
-
-object Test {
- def main(args: Array[String]) {
- new Test
- }
-}