diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-12-09 10:08:11 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-12-09 10:08:11 +0000 |
commit | a730fb5cc6cea39a29e9ff4cd666fa8498f6adec (patch) | |
tree | a271e1b7cdd2bd044344fa7aef19d6820637b3a5 /test/files/scalacheck/parallel-collections/IntOperators.scala | |
parent | 4dbe72f83f7ade1517bad7444009d3d0c8a69bd5 (diff) | |
download | scala-a730fb5cc6cea39a29e9ff4cd666fa8498f6adec.tar.gz scala-a730fb5cc6cea39a29e9ff4cd666fa8498f6adec.tar.bz2 scala-a730fb5cc6cea39a29e9ff4cd666fa8498f6adec.zip |
Fixing jvm 1.5 support for parallel collections.
Special cased with thread pool executor scheduling. Fixed an ugly
concurrency bug where futures returned by a thread pool executor didn't
remove the task from the queue when cancel was called. Note to self and
others: don't cancel futures returned by thread pool executors, it might
lead to unexpected behaviour. Modified the executor to add new threads
if all the active threads are syncing, in order to avoid deadlocks.
Fixed a hidden bug in AdaptiveWorkStealingTasks, where correct behaviour
depended on the execution order of the tasks. This didn't fail before
with ForkJoinTasks, since there the execution order is well-defined.
Scalachecked 1.5 & 1.6 support.
No review.
Diffstat (limited to 'test/files/scalacheck/parallel-collections/IntOperators.scala')
-rw-r--r-- | test/files/scalacheck/parallel-collections/IntOperators.scala | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/test/files/scalacheck/parallel-collections/IntOperators.scala b/test/files/scalacheck/parallel-collections/IntOperators.scala index 8d214b614f..690ee34cca 100644 --- a/test/files/scalacheck/parallel-collections/IntOperators.scala +++ b/test/files/scalacheck/parallel-collections/IntOperators.scala @@ -5,8 +5,14 @@ import scala.collection.parallel._ trait IntOperators extends Operators[Int] { - def reduceOperators = List(_ + _, _ * _, math.min(_, _), math.max(_, _)) - def countPredicates = List(_ >= 0, _ < 0, _ < 50, _ < 500, _ < 5000, _ < 50000, _ % 2 == 0, _ == 99) + def reduceOperators = List(_ + _, _ * _, math.min(_, _), math.max(_, _), _ ^ _) + def countPredicates = List( + x => true, + _ >= 0, _ < 0, _ < 50, _ < 500, _ < 5000, _ < 50000, _ % 2 == 0, _ == 99, + x => x > 50 && x < 150, + x => x > 350 && x < 550, + x => (x > 1000 && x < 1500) || (x > 400 && x < 500) + ) def forallPredicates = List(_ >= 0, _ < 0, _ % 2 == 0, _ != 55, _ != 505, _ != 5005) def existsPredicates = List(_ >= 0, _ < 0, _ % 2 == 0, _ == 55, _ == 505, _ == 5005) def findPredicates = List(_ >= 0, _ % 2 == 0, _ < 0, _ == 50, _ == 500, _ == 5000) @@ -18,9 +24,14 @@ trait IntOperators extends Operators[Int] { (n: Int) => if (n == 0) List(1, 2, 3, 4, 5) else if (n < 0) List(1, 2, 3) else List() ) def filterPredicates = List( - _ % 2 == 0, _ % 3 == 0, _ % 4 != 0, _ % 17 != 0, n => n > 50 && n < 100, _ >= 0, _ < 0, _ == 99, - _ > 500, _ > 5000, _ > 50000, _ < 500, _ < 50, _ < -50, _ < -5e5, - x => true, x => false, x => x % 53 == 0 && x % 17 == 0 + _ % 2 == 0, _ % 3 == 0, + _ % 4 != 0, _ % 17 != 0, + n => n > 50 && n < 100, + _ >= 0, _ < 0, _ == 99, + _ > 500, _ > 5000, _ > 50000, + _ < 500, _ < 50, _ < -50, _ < -5e5, + x => true, x => false, + x => x % 53 == 0 && x % 17 == 0 ) def filterNotPredicates = filterPredicates def partitionPredicates = filterPredicates @@ -30,7 +41,8 @@ trait IntOperators extends Operators[Int] { _ < -100, _ < -1000, _ > -200, _ > -50, n => -90 < n && n < -10, n => 50 < n && n < 550, - n => 5000 < n && n < 7500 + n => 5000 < n && n < 7500, + n => -50 < n && n < 450 ) def dropWhilePredicates = takeWhilePredicates def spanPredicates = takeWhilePredicates |