diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2011-06-20 13:36:24 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2011-06-20 13:36:24 +0000 |
commit | d2fd3d61d1cceb79c731a4be46977384c7cb7c9b (patch) | |
tree | 2cc87139c1804a66577db96d64e770d2e0398eac /test/files/run | |
parent | 2e29f1475ac750a75090f2b1c241814240043523 (diff) | |
download | scala-d2fd3d61d1cceb79c731a4be46977384c7cb7c9b.tar.gz scala-d2fd3d61d1cceb79c731a4be46977384c7cb7c9b.tar.bz2 scala-d2fd3d61d1cceb79c731a4be46977384c7cb7c9b.zip |
Fixed an overflow which occurs in hashtable siz...
Fixed an overflow which occurs in hashtable size computations. Fixes
#4678.
No review.
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/TestFlatMap.scala | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/files/run/TestFlatMap.scala b/test/files/run/TestFlatMap.scala new file mode 100644 index 0000000000..e6fb696aa2 --- /dev/null +++ b/test/files/run/TestFlatMap.scala @@ -0,0 +1,29 @@ +import scala.collection.parallel.{ ParMap => PMap } +import scala.collection.parallel.mutable.{ ParHashSet => PMHashSet, ParHashMap => PMHashMap, ParArray } +import scala.util.Random +import scala.collection.parallel.CompositeThrowable + +object Test { + + def main(args: Array[String]) { + val N = 1500 + val M = 1500 + var unmatchedLeft = new PMHashSet[Int] + var unmatchedRight = new PMHashSet[Int] + Range(0, N).foreach{ x => unmatchedLeft += x} + Range(0, M).foreach{ x => unmatchedRight += x} + + try { + val matches = unmatchedLeft.flatMap{ lind: Int => + val dists = unmatchedRight.seq.map{ rind: Int => + val dist = Random.nextInt + (rind, dist) + } + dists + } + } catch { + case c: CompositeThrowable => for (t <- c.throwables) println("\n%s\n%s".format(t, t.getStackTrace.mkString("\n"))) + } + } + +} |