From 11dfc5a64dd8bbcb7fca7d608a23b513316de6cc Mon Sep 17 00:00:00 2001 From: Aleksandar Pokopec Date: Thu, 9 Dec 2010 10:08:24 +0000 Subject: Made parallel collections serializable. No review. --- test/files/jvm/serialization.scala | 57 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'test/files/jvm/serialization.scala') diff --git a/test/files/jvm/serialization.scala b/test/files/jvm/serialization.scala index 2e34079505..8c4df8fc37 100644 --- a/test/files/jvm/serialization.scala +++ b/test/files/jvm/serialization.scala @@ -397,6 +397,7 @@ object Test3_mutable { } } + //############################################################################ // Test classes in package "scala.xml" @@ -587,8 +588,64 @@ object Test { Test6 Test7 Test8 + Test9_parallel } } //############################################################################ + +//############################################################################ +// Test classes in package "scala.collection.parallel" and subpackages +object Test9_parallel { + import scala.collection.parallel._ + + try { + println() + + // UnrolledBuffer + val ub = new UnrolledBuffer[String] + ub ++= List("one", "two") + val _ub: UnrolledBuffer[String] = read(write(ub)) + check(ub, _ub) + + // mutable.ParArray + val pa = mutable.ParArray("abc", "def", "etc") + val _pa: mutable.ParArray[String] = read(write(pa)) + check(pa, _pa) + + // mutable.ParHashMap + val mpm = mutable.ParHashMap(1 -> 2, 2 -> 4) + val _mpm: mutable.ParHashMap[Int, Int] = read(write(mpm)) + check(mpm, _mpm) + + // mutable.ParHashSet + val mps = mutable.ParHashSet(1, 2, 3) + val _mps: mutable.ParHashSet[Int] = read(write(mps)) + check(mps, _mps) + + // immutable.ParRange + val pr1 = immutable.ParRange(0, 4, 1, true) + val _pr1: immutable.ParRange = read(write(pr1)) + check(pr1, _pr1) + + val pr2 = immutable.ParRange(0, 4, 1, false) + val _pr2: immutable.ParRange = read(write(pr2)) + check(pr2, _pr2) + + // immutable.ParHashMap + val ipm = immutable.ParHashMap(5 -> 1, 10 -> 2) + val _ipm: immutable.ParHashMap[Int, Int] = read(write(ipm)) + check(ipm, _ipm) + + // immutable.ParHashSet + val ips = immutable.ParHashSet("one", "two") + val _ips: immutable.ParHashSet[String] = read(write(ips)) + check(ips, _ips) + + } catch { + case e: Exception => + println("Error in Test5_parallel: " + e) + throw e + } +} -- cgit v1.2.3