diff options
author | michelou <michelou@epfl.ch> | 2007-10-19 09:29:16 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2007-10-19 09:29:16 +0000 |
commit | 476606f848423a842b7346bb93ab6e009b2c37b3 (patch) | |
tree | 2549c58d059ee12b53a4112cf1693eb2d5c969cb /test | |
parent | 7a8dc411ac7c04dc17d9e37b045868f5ed9d2dd6 (diff) | |
download | scala-476606f848423a842b7346bb93ab6e009b2c37b3.tar.gz scala-476606f848423a842b7346bb93ab6e009b2c37b3.tar.bz2 scala-476606f848423a842b7346bb93ab6e009b2c37b3.zip |
more tests on arrays..
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/arrays-2.check | 7 | ||||
-rw-r--r-- | test/files/run/arrays-2.scala | 26 |
2 files changed, 33 insertions, 0 deletions
diff --git a/test/files/run/arrays-2.check b/test/files/run/arrays-2.check new file mode 100644 index 0000000000..ce28533c20 --- /dev/null +++ b/test/files/run/arrays-2.check @@ -0,0 +1,7 @@ +a1=Array(3, 2, 1) +a1=[3,2,1] +a2=Array(0, 4, 2, 6) +a2=[0,4,2,6] +a2=[0,7,4,2,1,3,6,5] +a2=[0,1,2,3,4,5,6,7] +true diff --git a/test/files/run/arrays-2.scala b/test/files/run/arrays-2.scala new file mode 100644 index 0000000000..055616d98c --- /dev/null +++ b/test/files/run/arrays-2.scala @@ -0,0 +1,26 @@ +//############################################################################ +// Arrays 2 +//############################################################################ +// $Id: $ + +//############################################################################ + +object Test extends Application { + val a1 = Array(1, 2, 3) + val a2 = Array(0, 7, 4, 2, 1, 3, 6, 5) + val a3 = new Array(1, 2, 3) // ticket #193 (VerifyError) + + def _toString[A](a: Array[A]) = a.mkString("[", ",", "]") + + // slice: see file slices.scala + println("a1=" + a1.reverse) + println("a1=" + _toString(a1.reverse)) + println("a2=" + a2.filter(_ % 2 == 0)) + println("a2=" + _toString(a2.filter(_ % 2 == 0))) + + println("a2=" + _toString(a2)) + util.Sorting.stableSort(a2) + println("a2=" + _toString(a2)) + + println(a1 deepEquals a3) +} |