diff options
author | michelou <michelou@epfl.ch> | 2007-08-22 14:17:52 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2007-08-22 14:17:52 +0000 |
commit | 83d4a1b304b83fa97209c7e6db32ab82738d5e1e (patch) | |
tree | 188bdd91fceea9acfe7603137f18f3dc60750a43 /test/files/run | |
parent | 4976d17863e6b2a9bfc6c127ac7c54c5c375ac56 (diff) | |
download | scala-83d4a1b304b83fa97209c7e6db32ab82738d5e1e.tar.gz scala-83d4a1b304b83fa97209c7e6db32ab82738d5e1e.tar.bz2 scala-83d4a1b304b83fa97209c7e6db32ab82738d5e1e.zip |
fixed method slice both in arrays and lists (se...
fixed method slice both in arrays and lists (see run/slices.scala)
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/slices.check | 36 | ||||
-rw-r--r-- | test/files/run/slices.scala | 46 |
2 files changed, 82 insertions, 0 deletions
diff --git a/test/files/run/slices.check b/test/files/run/slices.check new file mode 100644 index 0000000000..6840a029b7 --- /dev/null +++ b/test/files/run/slices.check @@ -0,0 +1,36 @@ +List(2) +List() +List(1) +List() +List(1, 2) + +List(1, 2, 3) +List(1, 2, 3) +List(1, 2) +List() +List() + +List(4) +List() +List() +List() +List() + +Array(2) +Array() +Array(1) +Array() +Array(1, 2) + +Array(1, 2, 3) +Array(1, 2, 3) +Array(1, 2) +Array() +Array() + +Array(4) +Array() +Array() +Array() +Array() + diff --git a/test/files/run/slices.scala b/test/files/run/slices.scala new file mode 100644 index 0000000000..14789d3edc --- /dev/null +++ b/test/files/run/slices.scala @@ -0,0 +1,46 @@ +object Test extends Application { + + // lists + println(List(1, 2, 3, 4).slice(1, 2)) + println(List(1, 2, 3, 4).slice(2, 1)) + println(List(1, 2, 3, 4).slice(-1, 1)) + println(List(1, 2, 3, 4).slice(1, -1)) + println(List(1, 2, 3, 4).slice(-2, 2)) + println + + println(List(1, 2, 3, 4) take 3) + println(List(1, 2, 3) take 3) + println(List(1, 2) take 3) + println((List(): List[Int]) take 3) + println(List[Nothing]() take 3) + println + + println(List(1, 2, 3, 4) drop 3) + println(List(1, 2, 3) drop 3) + println(List(1, 2) drop 3) + println((List(): List[Int]) drop 3) + println(List[Nothing]() drop 3) + println + + // arrays + println(Array(1, 2, 3, 4).slice(1, 2)) + println(Array(1, 2, 3, 4).slice(2, 1)) + println(Array(1, 2, 3, 4).slice(-1, 1)) + println(Array(1, 2, 3, 4).slice(1, -1)) + println(Array(1, 2, 3, 4).slice(-2, 2)) + println + + println(Array(1, 2, 3, 4) take 3) + println(Array(1, 2, 3) take 3) + println(Array(1, 2) take 3) + println((Array(): Array[Int]) take 3) + println(Array[Nothing]() take 3) // contrib #757 + println + + println(Array(1, 2, 3, 4) drop 3) + println(Array(1, 2, 3) drop 3) + println(Array(1, 2) drop 3) + println((Array(): Array[Int]) drop 3) + println(Array[Nothing]() drop 3) + println +} |