diff options
author | michelou <michelou@epfl.ch> | 2008-02-18 12:50:04 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2008-02-18 12:50:04 +0000 |
commit | 5879e8e98bd2fbab75c45fecbe5a89568c88a60b (patch) | |
tree | fa026d04c646fc054b3e966f647cb8eb6e336276 /test | |
parent | c0fd2c90d082918f20047b6ca7531a822347c8ed (diff) | |
download | scala-5879e8e98bd2fbab75c45fecbe5a89568c88a60b.tar.gz scala-5879e8e98bd2fbab75c45fecbe5a89568c88a60b.tar.bz2 scala-5879e8e98bd2fbab75c45fecbe5a89568c88a60b.zip |
fixed test
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/t0485.check | 49 | ||||
-rw-r--r-- | test/files/run/t0485.scala | 63 |
2 files changed, 56 insertions, 56 deletions
diff --git a/test/files/run/t0485.check b/test/files/run/t0485.check index d370403f09..8da59a2f19 100644 --- a/test/files/run/t0485.check +++ b/test/files/run/t0485.check @@ -1,28 +1,37 @@ -m1={20=30, 10=20} -m2={10=20} -m1 == m2 is false - -m1={10=20, 20=30} -m2={10=20} -m1 == m2 is false +m1={(10,20), (20,30)} +m2={(10,20)} +m1.size > m2.size is true +m1 equals m2 is true -m1={10=20, 20=30} -m2={10=20} -m1 == m2 is false +m1={(10,20), (20,30)} +m2={(10,20)} +m1.size > m2.size is true +m1 equals m2 is true -java.lang.CloneNotSupportedException: The underlying map doesn't implement the Cloneable interface +m1={(10,20), (20,30)} +m2={(10,20)} +m1.size > m2.size is true +m1 equals m2 is true +m1={(10,20), (20,30)} +m2={(10,20)} m1.size > m2.size is true +m1 equals m2 is true + +java.lang.CloneNotSupportedException: The underlying map doesn't implement the Cloneable interface -m1=[20, 10] -m2=[10] -m1 == m2 is false +s1=[10, 20] +s2=[10] +s1.size > s2 is true +s1 equals s2 is true -m1=[10, 20] -m2=[10] -m1 == m2 is false +s1=[10, 20] +s2=[10] +s1.size > s2 is true +s1 equals s2 is true -m1=[10, 20] -m2=[10] -m1 == m2 is false +s1=[10, 20] +s2=[10] +s1.size > s2 is true +s1 equals s2 is true diff --git a/test/files/run/t0485.scala b/test/files/run/t0485.scala index def5a504df..c114f15ce4 100644 --- a/test/files/run/t0485.scala +++ b/test/files/run/t0485.scala @@ -1,4 +1,4 @@ -import scala.collection.jcl._ +import scala.collection.jcl object Test extends Application { testMap @@ -6,27 +6,18 @@ object Test extends Application { } object testMap { - def test(m1: Map[Int, Int]) { - try { - m1.put(10, 20) - val m2 = m1.clone() - m1.put(20, 30) - println("m1="+m1) - println("m2="+m2) - println("m1 == m2 is "+ (m1 == m2)) - println() - } - catch { - case e: Exception => - println(e); println() - } - } - def test1(m1: Map[Int, Int]) { + def toString(m1: collection.Map[Int, Int]): String = + m1.toList.sort((x, y) => x < y).mkString("{", ", ", "}") + def test(m1: jcl.Map[Int, Int]) { try { m1.put(10, 20) val m2 = m1.clone() m1.put(20, 30) + println("m1="+toString(m1)) + println("m2="+toString(m2)) println("m1.size > m2.size is "+ (m1.size > m2.size)) + m1.remove((20, 30)) + println("m1 equals m2 is "+ (m1 equals m2)) println() } catch { @@ -34,28 +25,28 @@ object testMap { println(e); println() } } - test(new HashMap[Int, Int]) - test(new LinkedHashMap[Int, Int]) - // NB. class IdentityHashMap makes no guarantees as to the order - // of the map; in particular, it does not guarantee that the order - // will remain constant over time (see Java API docs). - //test1(new IdentityHashMap[Int, Int]) - test(new TreeMap[Int, Int]) - test(new WeakHashMap[Int, Int]) - test1(new IdentityHashMap[Int, Int]) + test(new jcl.HashMap[Int, Int]) + test(new jcl.IdentityHashMap[Int, Int]) + test(new jcl.LinkedHashMap[Int, Int]) + test(new jcl.TreeMap[Int, Int]) + test(new jcl.WeakHashMap[Int, Int]) } object testSet { - def test(m1: Set[Int]) { - m1.add(10) - val m2 = m1.clone() - m1.add(20) - println("m1="+m1) - println("m2="+m2) - println("m1 == m2 is "+ (m1 == m2)) + def toString(s1: collection.Set[Int]): String = + s1.toList.sort((x, y) => x < y).mkString("[", ", ", "]") + def test(s1: jcl.Set[Int]) { + s1.add(10) + val s2 = s1.clone() + s1.add(20) + println("s1="+toString(s1)) + println("s2="+toString(s2)) + println("s1.size > s2 is "+ (s1.size > s2.size)) + s1.remove(20) + println("s1 equals s2 is "+ (s1 equals s2)) println() } - test(new HashSet[Int]) - test(new LinkedHashSet[Int]) - test(new TreeSet[Int]) + test(new jcl.HashSet[Int]) + test(new jcl.LinkedHashSet[Int]) + test(new jcl.TreeSet[Int]) } |