summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorGeoffrey Washburn <geoffrey.washburn@epfl.ch>2008-09-08 13:07:31 +0000
committerGeoffrey Washburn <geoffrey.washburn@epfl.ch>2008-09-08 13:07:31 +0000
commit2bd07f72643799391e38805da617565a82f02b53 (patch)
tree88958b73711873298415a1e350b0a66e28e1a39f /test/files/run
parentab1c93a7bd2748c702137836be1bc0ad1be867c0 (diff)
downloadscala-2bd07f72643799391e38805da617565a82f02b53.tar.gz
scala-2bd07f72643799391e38805da617565a82f02b53.tar.bz2
scala-2bd07f72643799391e38805da617565a82f02b53.zip
Bugfix and tests for #1323.
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/t1323.check18
-rw-r--r--test/files/run/t1323.scala25
2 files changed, 43 insertions, 0 deletions
diff --git a/test/files/run/t1323.check b/test/files/run/t1323.check
new file mode 100644
index 0000000000..0d540f71b5
--- /dev/null
+++ b/test/files/run/t1323.check
@@ -0,0 +1,18 @@
+ 1:-1
+ 2:0
+ 3:1
+ 4:2
+ 5:-1
+ 6:-1
+ 7:-1
+ 8:-1
+ 9:-1
+10:0
+11:-1
+12:-1
+13:-1
+14:0
+15:0
+16:-1
+17:-1
+18:3
diff --git a/test/files/run/t1323.scala b/test/files/run/t1323.scala
new file mode 100644
index 0000000000..7a68482101
--- /dev/null
+++ b/test/files/run/t1323.scala
@@ -0,0 +1,25 @@
+object Test extends Application {
+ println(" 1:" + List(1,2,3,4).indexOf(List(0,1))) // -1
+ println(" 2:" + List(1,2,3,4).indexOf(List(1,2))) // 0
+ println(" 3:" + List(1,2,3,4).indexOf(List(2,3))) // 1
+ println(" 4:" + List(1,2,3,4).indexOf(List(3,4))) // 2
+ println(" 5:" + List(1,2,3,4).indexOf(List(4,5))) // -1
+ println(" 6:" + List(1,2,3,4).indexOf(List(2,4))) // -1
+ println(" 7:" + List(1,2,3,4).indexOf(List(4,3))) // -1
+ println(" 8:" + List(1,2,3,4).indexOf(List(1,3))) // -1
+ println(" 9:" + List(1,2,3,4).indexOf(List(1,3))) // -1
+ println("10:" + List(1,2,3,4).indexOf(List(1,2,3,4))) // 0
+ println("11:" + List(1,2,3,4).indexOf(List(4,3,2,1))) // -1
+ println("12:" + List(1,2,3,4).indexOf(List(1,2,3,4,5))) // -1
+ println("13:" + List(1,2,3,4).indexOf(List(5,4,3,2,1))) // -1
+ println("14:" + List(1,2,3,4).indexOf(List())) // 0
+ println("15:" + List().indexOf(List())) // 0
+ println("16:" + List().indexOf(List(1,2,3,4))) // -1
+
+ // Do some testing with infinite sequences
+ def from(n: Int): Stream[Int] = Stream.cons(n, from(n + 1))
+
+ println("17:" + List(1,2,3,4).indexOf(from(1))) // -1
+ println("18:" + from(1).indexOf(List(4,5,6))) // 3
+}
+