summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2007-03-20 17:59:27 +0000
committermichelou <michelou@epfl.ch>2007-03-20 17:59:27 +0000
commit9715d09e8069e5a7ea62ef06d9cefe342b5f1c8b (patch)
tree831fea75fb219fca7341efb41695109c6216e1b8 /test/files/run
parent3c1e6d6ce35246894bf96db35749956d59ff6885 (diff)
downloadscala-9715d09e8069e5a7ea62ef06d9cefe342b5f1c8b.tar.gz
scala-9715d09e8069e5a7ea62ef06d9cefe342b5f1c8b.tar.bz2
scala-9715d09e8069e5a7ea62ef06d9cefe342b5f1c8b.zip
added Array.deepEquals, improved external links...
added Array.deepEquals, improved external links to sources in API doc
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/deepToString.scala41
-rw-r--r--test/files/run/deeps.check (renamed from test/files/run/deepToString.check)26
-rw-r--r--test/files/run/deeps.scala84
3 files changed, 110 insertions, 41 deletions
diff --git a/test/files/run/deepToString.scala b/test/files/run/deepToString.scala
deleted file mode 100644
index 1fb73fe5a5..0000000000
--- a/test/files/run/deepToString.scala
+++ /dev/null
@@ -1,41 +0,0 @@
-object Test extends Application {
-
- def sweep(s: String) =
- s.replaceAll("D@[0-9a-fA-F]+", "D@0000000")
- .replaceAll("Z@[0-9a-fA-F]+", "Z@0000000")
- .replaceAll(";@[0-9a-fA-F]+", ";@0000000")
-
- def test[A](a: Array[A]) {
- Console.println(sweep(a.toString))
- Console.println(a.deepToString)
- Console.println(a.deepMkString("[", ";", "]"))
- Console.println(a.deepMkString(";"))
- Console.println
- }
-
- val ba1 = Array(true, false)
- val ba2 = Array(ba1, ba1)
- val ba3 = Array(ba2, ba2)
- test(ba1)
- test(ba2)
- test(ba3)
-
- val da1 = Array(1.0d, 0.0d)
- val da2 = Array(da1, da1)
- val da3 = Array(da2, da2)
- test(da1)
- test(da2)
- test(da3)
-
- val sa1 = Array("a", "b")
- val sa2 = Array(sa1, sa1)
- val sa3 = Array(sa2, sa2)
- test(sa1)
- test(sa2)
- test(sa3)
-
- Console.println(Array(Array(true, false), Array(false)).deepMkString("[", "; ", "]"))
- Console.println(Array(Array('1', '2'), Array('3')).deepMkString("[", "; ", "]"))
- Console.println(Array(Array(1, 2), Array(3)).deepMkString("[", "; ", "]"))
- Console.println
-}
diff --git a/test/files/run/deepToString.check b/test/files/run/deeps.check
index fcc0e04575..abcd5b52c3 100644
--- a/test/files/run/deepToString.check
+++ b/test/files/run/deeps.check
@@ -1,3 +1,29 @@
+false
+false
+true
+
+false
+false
+true
+
+x=Array(1)
+y=Array(1)
+false
+false
+true
+
+x=Array(Array(1),Array(1))
+y=Array(Array(1),Array(1))
+false
+false
+true
+
+x=Array(Array(Array(1),Array(1)),Array(Array(1),Array(1)))
+y=Array(Array(Array(1),Array(1)),Array(Array(1),Array(1)))
+false
+false
+true
+
Array(true,false)
Array(true,false)
[true;false]
diff --git a/test/files/run/deeps.scala b/test/files/run/deeps.scala
new file mode 100644
index 0000000000..46377b1523
--- /dev/null
+++ b/test/files/run/deeps.scala
@@ -0,0 +1,84 @@
+object Test extends Application {
+
+ def testEquals1 {
+ Console.println(Array(1) == Array(1))
+ Console.println(Array(1) equals Array(1))
+ Console.println(Array(1) deepEquals Array(1))
+ Console.println
+ }
+
+ def testEquals2 {
+ Console.println(Array(Array(1), Array(2)) == Array(Array(1), Array(2)))
+ Console.println(Array(Array(1), Array(2)) equals Array(Array(1), Array(2)))
+ Console.println(Array(Array(1), Array(2)) deepEquals Array(Array(1), Array(2)))
+ Console.println
+ }
+
+ def testEquals3 {
+ val a1 = Array(1)
+ val b1 = Array(1)
+ val a2 = Array(a1, b1)
+ val b2 = Array(a1, b1)
+ val a3 = Array(a2, b2)
+ val b3 = Array(a2, b2)
+ def test[T](x: Array[T], y: Array[T]) {
+ Console.println("x=" + x.deepToString)
+ Console.println("y=" + y.deepToString)
+ Console.println(x == y)
+ Console.println(x equals y)
+ Console.println(x deepEquals y)
+ Console.println
+ }
+ test(a1, b1)
+ test(a2, b2)
+ test(a3, b3)
+ }
+
+ def testToString1 {
+ def sweep(s: String) =
+ s.replaceAll("D@[0-9a-fA-F]+", "D@0000000")
+ .replaceAll("Z@[0-9a-fA-F]+", "Z@0000000")
+ .replaceAll(";@[0-9a-fA-F]+", ";@0000000")
+ def test[T](a: Array[T]) {
+ Console.println(sweep(a.toString))
+ Console.println(a.deepToString)
+ Console.println(a.deepMkString("[", ";", "]"))
+ Console.println(a.deepMkString(";"))
+ Console.println
+ }
+
+ val ba1 = Array(true, false)
+ val ba2 = Array(ba1, ba1)
+ val ba3 = Array(ba2, ba2)
+ test(ba1)
+ test(ba2)
+ test(ba3)
+
+ val da1 = Array(1.0d, 0.0d)
+ val da2 = Array(da1, da1)
+ val da3 = Array(da2, da2)
+ test(da1)
+ test(da2)
+ test(da3)
+
+ val sa1 = Array("a", "b")
+ val sa2 = Array(sa1, sa1)
+ val sa3 = Array(sa2, sa2)
+ test(sa1)
+ test(sa2)
+ test(sa3)
+ }
+
+ def testToString2 {
+ Console.println(Array(Array(true, false), Array(false)).deepMkString("[", "; ", "]"))
+ Console.println(Array(Array('1', '2'), Array('3')).deepMkString("[", "; ", "]"))
+ Console.println(Array(Array(1, 2), Array(3)).deepMkString("[", "; ", "]"))
+ Console.println
+ }
+
+ testEquals1
+ testEquals2
+ testEquals3
+ testToString1
+ testToString2
+}