From ea91456310736caed3064c117c5a72f515d59688 Mon Sep 17 00:00:00 2001 From: Tiark Rompf Date: Tue, 13 Apr 2010 11:08:12 +0000 Subject: closes #3241 and improves serialization of hash... closes #3241 and improves serialization of hash tries. review by community. --- test/files/jvm/t1600.scala | 6 +++--- test/files/run/t3241.check | 1 + test/files/run/t3241.scala | 23 +++++++++++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 test/files/run/t3241.check create mode 100644 test/files/run/t3241.scala (limited to 'test') diff --git a/test/files/jvm/t1600.scala b/test/files/jvm/t1600.scala index 1cdcee8547..79391b7e76 100644 --- a/test/files/jvm/t1600.scala +++ b/test/files/jvm/t1600.scala @@ -12,11 +12,11 @@ object Test { def elements = entries.map(_._1) val maps = Seq[Map[Foo, Int]](new mutable.HashMap, new mutable.LinkedHashMap, - new immutable.HashMap).map(_ ++ entries) + immutable.HashMap.empty).map(_ ++ entries) test[Map[Foo, Int]](maps, entries.size, assertMap _) val sets = Seq[Set[Foo]](new mutable.HashSet, new mutable.LinkedHashSet, - new immutable.HashSet).map(_ ++ elements) + immutable.HashSet.empty).map(_ ++ elements) test[Set[Foo]](sets, entries.size, assertSet _) } } @@ -31,7 +31,7 @@ object Test { assertFunction(deserializedCollection, expectedSize) assert(deserializedCollection.getClass == collection.getClass, - "collection class should remain the same after deserialization") + "collection class should remain the same after deserialization ("+deserializedCollection.getClass+" != "+collection.getClass+")") Foo.hashCodeModifier = 0 } } diff --git a/test/files/run/t3241.check b/test/files/run/t3241.check new file mode 100644 index 0000000000..348ebd9491 --- /dev/null +++ b/test/files/run/t3241.check @@ -0,0 +1 @@ +done \ No newline at end of file diff --git a/test/files/run/t3241.scala b/test/files/run/t3241.scala new file mode 100644 index 0000000000..40097a046f --- /dev/null +++ b/test/files/run/t3241.scala @@ -0,0 +1,23 @@ +object Test { + + def main(args : Array[String]) : Unit = { + recurse(Map(1->1, 2->2, 3->3, 4->4, 5->5, 6->6, 7->7)) + recurse(Set(1,2,3,4,5,6,7)) + println("done") + } + + def recurse(map: collection.immutable.Map[Int, Int]): Unit = { + if (!map.isEmpty) { + val x = map.keys.head + recurse(map - x) + } + } + + def recurse(set: collection.immutable.Set[Int]): Unit = { + if (!set.isEmpty) { + val x = set.toStream.head + recurse(set - x) + } + } + +} -- cgit v1.2.3