summaryrefslogtreecommitdiff
path: root/test/files/run/t6052.scala
diff options
context:
space:
mode:
authorAleksandar Prokopec <axel22@gmail.com>2012-07-10 18:05:26 +0200
committerAleksandar Prokopec <axel22@gmail.com>2012-07-10 19:15:18 +0200
commit48b128d239b0e975b9f12e1f3cc5aab2a6963e74 (patch)
tree89cb9b6ab91e228882a750228ec7c69ec365e215 /test/files/run/t6052.scala
parentb08de29331a6f26d06609c640b2fc9d2d38ff525 (diff)
downloadscala-48b128d239b0e975b9f12e1f3cc5aab2a6963e74.tar.gz
scala-48b128d239b0e975b9f12e1f3cc5aab2a6963e74.tar.bz2
scala-48b128d239b0e975b9f12e1f3cc5aab2a6963e74.zip
SI-6052 - fix groupBy on parallel collections
Diffstat (limited to 'test/files/run/t6052.scala')
-rw-r--r--test/files/run/t6052.scala21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/files/run/t6052.scala b/test/files/run/t6052.scala
new file mode 100644
index 0000000000..385d5390d3
--- /dev/null
+++ b/test/files/run/t6052.scala
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+object Test extends App {
+ def seqarr(i: Int) = Array[Int]() ++ (0 until i)
+ def pararr(i: Int) = seqarr(i).par
+
+ def check[T](i: Int, f: Int => T) {
+ val gseq = seqarr(i).toSeq.groupBy(f)
+ val gpar = pararr(i).groupBy(f)
+ assert(gseq == gpar, (gseq, gpar))
+ }
+
+ for (i <- 0 until 20) check(i, _ > 0)
+ for (i <- 0 until 20) check(i, _ % 2)
+ for (i <- 0 until 20) check(i, _ % 4)
+}