summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-10-05 08:06:12 +0000
committerAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-10-05 08:06:12 +0000
commitb090accba15e71ac0c4823d1aa604b6beaadb335 (patch)
treede80388f125300329aa6dfbffedcf3dbb0ff1ca0
parentc1f8dbca52899f87128ece2f5d137fb91206ede7 (diff)
downloadscala-b090accba15e71ac0c4823d1aa604b6beaadb335.tar.gz
scala-b090accba15e71ac0c4823d1aa604b6beaadb335.tar.bz2
scala-b090accba15e71ac0c4823d1aa604b6beaadb335.zip
An issue with scalacheck and actors where an ex...
An issue with scalacheck and actors where an excess of thread pools gets created - tmp fix. No review.
-rw-r--r--src/scalacheck/org/scalacheck/Test.scala3
-rw-r--r--test/files/scalacheck/list.scala2
-rw-r--r--test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala10
-rw-r--r--test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala424
-rw-r--r--test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala392
-rw-r--r--test/files/scalacheck/parallel-collections/pc.scala3
-rw-r--r--test/files/scalacheck/testdir/dep.scala7
-rw-r--r--test/files/scalacheck/testdir/test.scala10
8 files changed, 436 insertions, 415 deletions
diff --git a/src/scalacheck/org/scalacheck/Test.scala b/src/scalacheck/org/scalacheck/Test.scala
index 82d9f679b6..98d4d37163 100644
--- a/src/scalacheck/org/scalacheck/Test.scala
+++ b/src/scalacheck/org/scalacheck/Test.scala
@@ -156,7 +156,8 @@ object Test {
* the test results. */
def check(prms: Params, p: Prop): Result = {
import prms._
- import actors.Futures.future
+ //import actors.Futures.future
+ import scala.concurrent.ops.future
assertParams(prms)
if(workers > 1)
diff --git a/test/files/scalacheck/list.scala b/test/files/scalacheck/list.scala
index 1caf35e872..5f6de95237 100644
--- a/test/files/scalacheck/list.scala
+++ b/test/files/scalacheck/list.scala
@@ -8,7 +8,7 @@ object Test extends Properties("List") {
property("concat size") = forAll { (l1: List[Int], l2: List[Int]) => (l1.size + l2.size) == (l1 ::: l2).size }
property("reverse") = forAll { (l1: List[Int]) => l1.reverse.reverse == l1 }
property("toSet") = forAll { (l1: List[Int]) => sorted(l1.toSet.toList) sameElements sorted(l1).distinct }
- property("flatten") = forAll { (xxs: List[List[Int]]) => xxs.flatten.length == (xxs map (_.length) sum) }
+ // property("flatten") = forAll { (xxs: List[List[Int]]) => xxs.flatten.length == (xxs map (_.length) sum) }
property("startsWith/take") = forAll { (xs: List[Int], count: Int) => xs startsWith (xs take count) }
property("endsWith/takeRight") = forAll { (xs: List[Int], count: Int) => xs endsWith (xs takeRight count) }
property("fill") = forAll(choose(1, 100)) { count =>
diff --git a/test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala b/test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala
index 2c62c054b5..9169890e98 100644
--- a/test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala
+++ b/test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala
@@ -39,11 +39,11 @@ abstract class ParallelArrayCheck[T](tp: String) extends ParallelSeqCheck[T]("Pa
pa
}
- // property("array mappings must be equal") = forAll(collectionPairs) { case (t, coll) =>
- // val results = for ((f, ind) <- mapFunctions.zipWithIndex)
- // yield ("op index: " + ind) |: t.map(f) == coll.map(f)
- // results.reduceLeft(_ && _)
- // }
+ property("array mappings must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ val results = for ((f, ind) <- mapFunctions.zipWithIndex)
+ yield ("op index: " + ind) |: t.map(f) == coll.map(f)
+ results.reduceLeft(_ && _)
+ }
}
diff --git a/test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala b/test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala
index e54243ee71..fd323ef82c 100644
--- a/test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala
+++ b/test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala
@@ -49,218 +49,218 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
(inst, fromTraversable(inst), modif)
}
- // property("reductions must be equal for assoc. operators") = forAll(collectionPairs) { case (t, coll) =>
- // if (t.size != 0) {
- // val results = for ((op, ind) <- reduceOperators.zipWithIndex) yield {
- // ("op index: " + ind) |: t.reduceLeft(op) == coll.reduce(op)
- // }
- // results.reduceLeft(_ && _)
- // } else "has size 0" |: true
- // }
-
- // property("counts must be equal") = forAll(collectionPairs) { case (t, coll) =>
- // val results = for ((pred, ind) <- countPredicates.zipWithIndex) yield {
- // val tc = t.count(pred)
- // val cc = coll.count(pred)
- // if (tc != cc) {
- // println("from: " + t)
- // println("and: " + coll.toList)
- // println(tc)
- // println(cc)
- // }
- // ("op index: " + ind) |: tc == cc
- // }
- // results.reduceLeft(_ && _)
- // }
-
- // property("forall must be equal") = forAll(collectionPairs) { case (t, coll) =>
- // val results = for ((pred, ind) <- forallPredicates.zipWithIndex)
- // yield ("op index: " + ind) |: t.forall(pred) == coll.forall(pred)
- // results.reduceLeft(_ && _)
- // }
-
- // property("exists must be equal") = forAll(collectionPairs) { case (t, coll) =>
- // val results = for ((pred, ind) <- existsPredicates.zipWithIndex)
- // yield ("op index: " + ind) |: t.exists(pred) == coll.exists(pred)
- // results.reduceLeft(_ && _)
- // }
-
- // property("both must find or not find an element") = forAll(collectionPairs) { case (t, coll) =>
- // val results = for ((pred, ind) <- findPredicates.zipWithIndex) yield {
- // val ft = t.find(pred)
- // val fcoll = coll.find(pred)
- // ("op index: " + ind) |: ((ft == None && fcoll == None) || (ft != None && fcoll != None))
- // }
- // results.reduceLeft(_ && _)
- // }
-
- // property("mappings must be equal") = forAll(collectionPairs) { case (t, coll) =>
- // val results = for ((f, ind) <- mapFunctions.zipWithIndex)
- // yield ("op index: " + ind) |: t.map(f) == coll.map(f)
- // results.reduceLeft(_ && _)
- // }
-
- // property("collects must be equal") = forAll(collectionPairs) { case (t, coll) =>
- // val results = for ((f, ind) <- partialMapFunctions.zipWithIndex) yield {
- // val ps = t.collect(f)
- // val pp = coll.collect(f)
- // if (ps != pp) {
- // println(t)
- // println(coll)
- // println("partially mapped to: ")
- // println(ps)
- // println(pp)
- // }
- // ("op index: " + ind) |: ps == pp
- // }
- // results.reduceLeft(_ && _)
- // }
-
- // property("flatMaps must be equal") = forAll(collectionPairs) { case (t, coll) =>
- // (for ((f, ind) <- flatMapFunctions.zipWithIndex)
- // yield ("op index: " + ind) |: t.flatMap(f) == coll.flatMap(f)).reduceLeft(_ && _)
- // }
-
- // property("filters must be equal") = forAll(collectionPairs) { case (t, coll) =>
- // (for ((p, ind) <- filterPredicates.zipWithIndex)
- // yield ("op index: " + ind) |: t.filter(p) == coll.filter(p)).reduceLeft(_ && _)
- // }
-
- // property("filterNots must be equal") = forAll(collectionPairs) { case (t, coll) =>
- // (for ((p, ind) <- filterNotPredicates.zipWithIndex)
- // yield ("op index: " + ind) |: t.filterNot(p) == coll.filterNot(p)).reduceLeft(_ && _)
- // }
-
- // if (!isCheckingViews) property("partitions must be equal") = forAll(collectionPairs) { case (t, coll) =>
- // (for ((p, ind) <- partitionPredicates.zipWithIndex) yield {
- // val tpart = t.partition(p)
- // val cpart = coll.partition(p)
- // if (tpart != cpart) {
- // println("from: " + t)
- // println("and: " + coll)
- // println(cpart)
- // println(tpart)
- // }
- // ("op index: " + ind) |: tpart == cpart
- // }).reduceLeft(_ && _)
- // }
-
- // property("takes must be equal") = forAll(collectionPairsWithLengths) { case (t, coll, n) =>
- // ("take " + n + " elements") |: t.take(n) == coll.take(n)
- // }
-
- // property("drops must be equal") = forAll(collectionPairsWithLengths) { case (t, coll, n) =>
- // ("drop " + n + " elements") |: t.drop(n) == coll.drop(n)
- // }
-
- // property("slices must be equal") = forAll(collectionPairsWith2Indices)
- // { case (t, coll, fr, slicelength) =>
- // val from = if (fr < 0) 0 else fr
- // val until = if (from + slicelength > t.size) t.size else from + slicelength
- // val tsl = t.slice(from, until)
- // val collsl = coll.slice(from, until)
- // if (tsl != collsl) {
- // println("---------------------- " + from + ", " + until)
- // println("from: " + t)
- // println("and: " + coll)
- // println(tsl)
- // println(collsl)
- // println("as list: " + collsl.toList)
- // println(tsl.asInstanceOf[Seq[T]].sameElements(collsl))
- // println(collsl.iterator.hasNext)
- // println(collsl.iterator.next)
- // println(collsl.iterator.hasNext)
- // println(collsl.iterator.next)
- // println(collsl.iterator.hasNext)
- // println(collsl.iterator.next)
- // println(collsl.iterator.hasNext)
- // }
- // ("slice from " + from + " until " + until) |: tsl == collsl
- // }
-
- // property("splits must be equal") = forAll(collectionPairsWithLengths) { case (t, coll, n) =>
- // val tspl = t.splitAt(n)
- // val cspl = coll.splitAt(n)
- // if (tspl != cspl) {
- // println("at: " + n)
- // println("from: " + t)
- // println("and: " + coll)
- // println(tspl)
- // println(cspl)
- // }
- // ("splitAt " + n) |: tspl == cspl
- // }
-
- // property("takeWhiles must be equal") = forAll(collectionPairs) { case (t, coll) =>
- // (for ((pred, ind) <- takeWhilePredicates.zipWithIndex)
- // yield ("operator " + ind) |: t.takeWhile(pred) == coll.takeWhile(pred)).reduceLeft(_ && _)
- // }
-
- // property("spans must be equal") = forAll(collectionPairs) { case (t, coll) =>
- // (for ((pred, ind) <- spanPredicates.zipWithIndex) yield {
- // val tsp = t.span(pred)
- // val csp = coll.span(pred)
- // if (tsp != csp) {
- // println("from: " + t)
- // println("and: " + coll)
- // println(tsp)
- // println(csp)
- // }
- // ("operator " + ind) |: tsp == csp
- // }).reduceLeft(_ && _)
- // }
-
- // property("dropWhiles must be equal") = forAll(collectionPairs) { case (t, coll) =>
- // (for ((pred, ind) <- dropWhilePredicates.zipWithIndex) yield {
- // ("operator " + ind) |: t.dropWhile(pred) == coll.dropWhile(pred)
- // }).reduceLeft(_ && _)
- // }
-
- // property("folds must be equal for assoc. operators") = forAll(collectionPairs) { case (t, coll) =>
- // (for (((first, op), ind) <- foldArguments.zipWithIndex)
- // yield ("operator " + ind) |: t.foldLeft(first)(op) == coll.fold(first)(op)).reduceLeft(_ && _)
- // }
-
- // property("++s must be equal") = forAll(collectionTriplets) { case (t, coll, colltoadd) =>
- // val toadd = colltoadd
- // val tr = t ++ toadd
- // val cr = coll ++ fromTraversable(toadd).iterator
- // if (!tr.toList.iterator.sameElements(cr.iterator)) {
- // println("from: " + t)
- // println("and: " + coll.iterator.toList)
- // println("adding: " + toadd)
- // println(tr.toList)
- // println(cr.iterator.toList)
- // }
- // ("adding " |: tr == cr) &&
- // (for ((trav, ind) <- (addAllTraversables).zipWithIndex) yield {
- // val tadded = t ++ trav
- // val cadded = coll ++ fromTraversable(trav.toList)
- // if (tadded != cadded) {
- // println("----------------------")
- // println("from: " + t)
- // println("and: " + coll.iterator.toList)
- // println("adding: " + trav)
- // println(tadded.toList)
- // println(cadded.iterator.toList)
- // }
- // ("traversable " + ind) |: (tadded) == (cadded)
- // }).reduceLeft(_ && _)
- // }
-
- // property("copies to array must be equal") = forAll(collectionPairs) { case (t, coll) =>
- // val tarr = newArray(t.size)
- // val collarr = newArray(coll.size)
- // t.copyToArray(tarr, 0, t.size)
- // coll.copyToArray(collarr, 0, coll.size)
- // if (tarr.toSeq != collarr.toSeq) {
- // println("from: " + t)
- // println("and: " + coll)
- // println(tarr.toSeq)
- // println(collarr.toSeq)
- // }
- // tarr.toSeq == collarr.toSeq
- // }
+ property("reductions must be equal for assoc. operators") = forAll(collectionPairs) { case (t, coll) =>
+ if (t.size != 0) {
+ val results = for ((op, ind) <- reduceOperators.zipWithIndex) yield {
+ ("op index: " + ind) |: t.reduceLeft(op) == coll.reduce(op)
+ }
+ results.reduceLeft(_ && _)
+ } else "has size 0" |: true
+ }
+
+ property("counts must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ val results = for ((pred, ind) <- countPredicates.zipWithIndex) yield {
+ val tc = t.count(pred)
+ val cc = coll.count(pred)
+ if (tc != cc) {
+ println("from: " + t)
+ println("and: " + coll.toList)
+ println(tc)
+ println(cc)
+ }
+ ("op index: " + ind) |: tc == cc
+ }
+ results.reduceLeft(_ && _)
+ }
+
+ property("forall must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ val results = for ((pred, ind) <- forallPredicates.zipWithIndex)
+ yield ("op index: " + ind) |: t.forall(pred) == coll.forall(pred)
+ results.reduceLeft(_ && _)
+ }
+
+ property("exists must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ val results = for ((pred, ind) <- existsPredicates.zipWithIndex)
+ yield ("op index: " + ind) |: t.exists(pred) == coll.exists(pred)
+ results.reduceLeft(_ && _)
+ }
+
+ property("both must find or not find an element") = forAll(collectionPairs) { case (t, coll) =>
+ val results = for ((pred, ind) <- findPredicates.zipWithIndex) yield {
+ val ft = t.find(pred)
+ val fcoll = coll.find(pred)
+ ("op index: " + ind) |: ((ft == None && fcoll == None) || (ft != None && fcoll != None))
+ }
+ results.reduceLeft(_ && _)
+ }
+
+ property("mappings must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ val results = for ((f, ind) <- mapFunctions.zipWithIndex)
+ yield ("op index: " + ind) |: t.map(f) == coll.map(f)
+ results.reduceLeft(_ && _)
+ }
+
+ property("collects must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ val results = for ((f, ind) <- partialMapFunctions.zipWithIndex) yield {
+ val ps = t.collect(f)
+ val pp = coll.collect(f)
+ if (ps != pp) {
+ println(t)
+ println(coll)
+ println("partially mapped to: ")
+ println(ps)
+ println(pp)
+ }
+ ("op index: " + ind) |: ps == pp
+ }
+ results.reduceLeft(_ && _)
+ }
+
+ property("flatMaps must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ (for ((f, ind) <- flatMapFunctions.zipWithIndex)
+ yield ("op index: " + ind) |: t.flatMap(f) == coll.flatMap(f)).reduceLeft(_ && _)
+ }
+
+ property("filters must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ (for ((p, ind) <- filterPredicates.zipWithIndex)
+ yield ("op index: " + ind) |: t.filter(p) == coll.filter(p)).reduceLeft(_ && _)
+ }
+
+ property("filterNots must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ (for ((p, ind) <- filterNotPredicates.zipWithIndex)
+ yield ("op index: " + ind) |: t.filterNot(p) == coll.filterNot(p)).reduceLeft(_ && _)
+ }
+
+ if (!isCheckingViews) property("partitions must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ (for ((p, ind) <- partitionPredicates.zipWithIndex) yield {
+ val tpart = t.partition(p)
+ val cpart = coll.partition(p)
+ if (tpart != cpart) {
+ println("from: " + t)
+ println("and: " + coll)
+ println(cpart)
+ println(tpart)
+ }
+ ("op index: " + ind) |: tpart == cpart
+ }).reduceLeft(_ && _)
+ }
+
+ property("takes must be equal") = forAll(collectionPairsWithLengths) { case (t, coll, n) =>
+ ("take " + n + " elements") |: t.take(n) == coll.take(n)
+ }
+
+ property("drops must be equal") = forAll(collectionPairsWithLengths) { case (t, coll, n) =>
+ ("drop " + n + " elements") |: t.drop(n) == coll.drop(n)
+ }
+
+ property("slices must be equal") = forAll(collectionPairsWith2Indices)
+ { case (t, coll, fr, slicelength) =>
+ val from = if (fr < 0) 0 else fr
+ val until = if (from + slicelength > t.size) t.size else from + slicelength
+ val tsl = t.slice(from, until)
+ val collsl = coll.slice(from, until)
+ if (tsl != collsl) {
+ println("---------------------- " + from + ", " + until)
+ println("from: " + t)
+ println("and: " + coll)
+ println(tsl)
+ println(collsl)
+ println("as list: " + collsl.toList)
+ println(tsl.asInstanceOf[Seq[T]].sameElements(collsl))
+ println(collsl.iterator.hasNext)
+ println(collsl.iterator.next)
+ println(collsl.iterator.hasNext)
+ println(collsl.iterator.next)
+ println(collsl.iterator.hasNext)
+ println(collsl.iterator.next)
+ println(collsl.iterator.hasNext)
+ }
+ ("slice from " + from + " until " + until) |: tsl == collsl
+ }
+
+ property("splits must be equal") = forAll(collectionPairsWithLengths) { case (t, coll, n) =>
+ val tspl = t.splitAt(n)
+ val cspl = coll.splitAt(n)
+ if (tspl != cspl) {
+ println("at: " + n)
+ println("from: " + t)
+ println("and: " + coll)
+ println(tspl)
+ println(cspl)
+ }
+ ("splitAt " + n) |: tspl == cspl
+ }
+
+ property("takeWhiles must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ (for ((pred, ind) <- takeWhilePredicates.zipWithIndex)
+ yield ("operator " + ind) |: t.takeWhile(pred) == coll.takeWhile(pred)).reduceLeft(_ && _)
+ }
+
+ property("spans must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ (for ((pred, ind) <- spanPredicates.zipWithIndex) yield {
+ val tsp = t.span(pred)
+ val csp = coll.span(pred)
+ if (tsp != csp) {
+ println("from: " + t)
+ println("and: " + coll)
+ println(tsp)
+ println(csp)
+ }
+ ("operator " + ind) |: tsp == csp
+ }).reduceLeft(_ && _)
+ }
+
+ property("dropWhiles must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ (for ((pred, ind) <- dropWhilePredicates.zipWithIndex) yield {
+ ("operator " + ind) |: t.dropWhile(pred) == coll.dropWhile(pred)
+ }).reduceLeft(_ && _)
+ }
+
+ property("folds must be equal for assoc. operators") = forAll(collectionPairs) { case (t, coll) =>
+ (for (((first, op), ind) <- foldArguments.zipWithIndex)
+ yield ("operator " + ind) |: t.foldLeft(first)(op) == coll.fold(first)(op)).reduceLeft(_ && _)
+ }
+
+ property("++s must be equal") = forAll(collectionTriplets) { case (t, coll, colltoadd) =>
+ val toadd = colltoadd
+ val tr = t ++ toadd
+ val cr = coll ++ fromTraversable(toadd).iterator
+ if (!tr.toList.iterator.sameElements(cr.iterator)) {
+ println("from: " + t)
+ println("and: " + coll.iterator.toList)
+ println("adding: " + toadd)
+ println(tr.toList)
+ println(cr.iterator.toList)
+ }
+ ("adding " |: tr == cr) &&
+ (for ((trav, ind) <- (addAllTraversables).zipWithIndex) yield {
+ val tadded = t ++ trav
+ val cadded = coll ++ fromTraversable(trav.toList)
+ if (tadded != cadded) {
+ println("----------------------")
+ println("from: " + t)
+ println("and: " + coll.iterator.toList)
+ println("adding: " + trav)
+ println(tadded.toList)
+ println(cadded.iterator.toList)
+ }
+ ("traversable " + ind) |: (tadded) == (cadded)
+ }).reduceLeft(_ && _)
+ }
+
+ property("copies to array must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ val tarr = newArray(t.size)
+ val collarr = newArray(coll.size)
+ t.copyToArray(tarr, 0, t.size)
+ coll.copyToArray(collarr, 0, coll.size)
+ if (tarr.toSeq != collarr.toSeq) {
+ println("from: " + t)
+ println("and: " + coll)
+ println(tarr.toSeq)
+ println(collarr.toSeq)
+ }
+ tarr.toSeq == collarr.toSeq
+ }
}
diff --git a/test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala b/test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala
index f0de040bfa..1fda4eb906 100644
--- a/test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala
+++ b/test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala
@@ -63,202 +63,202 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe
coll.patch(updateStart, coll, howMany)
}
- // property("segmentLengths must be equal") = forAll(collectionPairsWithLengths) { case (s, coll, len) =>
- // (for ((pred, ind) <- segmentLengthPredicates.zipWithIndex) yield {
- // val slen = s.segmentLength(pred, if (len < 0) 0 else len)
- // val clen = coll.segmentLength(pred, len)
- // if (slen != clen) {
- // println("from: " + s)
- // println("and: " + coll)
- // println(slen)
- // println(clen)
- // }
- // ("operator " + ind) |: slen == clen
- // }).reduceLeft(_ && _)
- // }
-
- // property("prefixLengths must be equal") = forAll(collectionPairs) { case (s, coll) =>
- // (for ((pred, ind) <- segmentLengthPredicates.zipWithIndex) yield {
- // ("operator " + ind) |: s.prefixLength(pred) == coll.prefixLength(pred)
- // }).reduceLeft(_ && _)
- // }
-
- // property("indexWheres must be equal") = forAll(collectionPairsWithLengths) { case (s, coll, len) =>
- // (for ((pred, ind) <- indexWherePredicates.zipWithIndex) yield {
- // val sind = s.indexWhere(pred, len)
- // val cind = coll.indexWhere(pred, len)
- // if (sind != cind) {
- // println("from: " + s)
- // println("and: " + coll)
- // println("at: " + len)
- // println(sind)
- // println(cind)
- // }
- // ("operator " + ind) |: sind == cind
- // }).reduceLeft(_ && _)
- // }
-
- // property("lastIndexWheres must be equal") = forAll(collectionPairsWithLengths) { case (s, coll, len) =>
- // (for ((pred, ind) <- lastIndexWherePredicates.zipWithIndex) yield {
- // val end = if (len >= s.size) s.size - 1 else len
- // val sind = s.lastIndexWhere(pred, end)
- // val cind = coll.lastIndexWhere(pred, end)
- // ("operator " + ind) |: sind == cind
- // }).reduceLeft(_ && _)
- // }
-
- // property("reverses must be equal") = forAll(collectionPairs) { case (s, coll) =>
- // (s.length == 0 && s.getClass == classOf[collection.immutable.Range]) ||
- // {
- // val sr = s.reverse
- // val cr = coll.reverse
- // if (sr != cr) {
- // println("from: " + s)
- // println("and: " + coll)
- // println(sr)
- // println(cr)
- // }
- // sr == cr
- // }
- // }
-
- // property("reverseMaps must be equal") = forAll(collectionPairs) { case (s, coll) =>
- // (for ((f, ind) <- reverseMapFunctions.zipWithIndex) yield {
- // ("operator " + ind) |: s.reverseMap(f) == coll.reverseMap(f)
- // }).reduceLeft(_ && _)
- // }
-
- // property("sameElements must be equal") = forAll(collectionPairsWithModifiedWithLengths) {
- // case (s, coll, collmodif, len) =>
- // val pos = if (len < 0) 0 else len
- // val scm = s.sameElements(collmodif)
- // val ccm = coll.sameElements(collmodif)
- // if (scm != ccm) {
- // println("Comparing: " + s)
- // println("and: " + coll)
- // println("with: " + collmodif)
- // println(scm)
- // println(ccm)
- // }
- // ("Nil" |: s.sameElements(Nil) == coll.sameElements(Nil)) &&
- // ("toList" |: s.sameElements(s.toList) == coll.sameElements(coll.toList)) &&
- // ("identity" |: s.sameElements(s.map(e => e)) == coll.sameElements(coll.map(e => e))) &&
- // ("vice-versa" |: s.sameElements(coll) == coll.sameElements(s)) &&
- // ("equal" |: s.sameElements(coll)) &&
- // ("modified" |: scm == ccm) &&
- // (for ((it, ind) <- sameElementsSeqs.zipWithIndex) yield {
- // val sres = s.sameElements(it)
- // val pres = coll.sameElements(it)
- // if (sres != pres) {
- // println("Comparing: " + s)
- // println("and: " + coll)
- // println("with: " + it)
- // println(sres)
- // println(pres)
- // }
- // ("collection " + ind) |: sres == pres
- // }).reduceLeft(_ && _)
- // }
-
- // property("startsWiths must be equal") = forAll(collectionPairsWithModifiedWithLengths) {
- // case (s, coll, collmodif, len) =>
- // val pos = if (len < 0) 0 else len
- // ("start with self" |: s.startsWith(s) == coll.startsWith(coll)) &&
- // ("tails correspond" |: (s.length == 0 || s.startsWith(s.tail, 1) == coll.startsWith(coll.tail, 1))) &&
- // ("with each other" |: coll.startsWith(s)) &&
- // ("modified" |: s.startsWith(collmodif) == coll.startsWith(collmodif)) &&
- // ("modified2" |: s.startsWith(collmodif, pos) == coll.startsWith(collmodif, pos)) &&
- // (for (sq <- startEndSeqs) yield {
- // val ss = s.startsWith(sq, pos)
- // val cs = coll.startsWith(fromSeq(sq), pos)
- // if (ss != cs) {
- // println("from: " + s)
- // println("and: " + coll)
- // println("test seq: " + sq)
- // println("from pos: " + pos)
- // println(ss)
- // println(cs)
- // println(coll.iterator.psplit(pos, coll.length - pos)(1).toList)
- // }
- // ("seq " + sq) |: ss == cs
- // }).reduceLeft(_ && _)
- // }
-
- // property("endsWiths must be equal") = forAll(collectionPairsWithModified) {
- // case (s, coll, collmodif) =>
- // ("ends with self" |: s.endsWith(s) == coll.endsWith(s)) &&
- // ("ends with tail" |: (s.length == 0 || s.endsWith(s.tail) == coll.endsWith(coll.tail))) &&
- // ("with each other" |: coll.endsWith(s)) &&
- // ("modified" |: s.startsWith(collmodif) == coll.endsWith(collmodif)) &&
- // (for (sq <- startEndSeqs) yield {
- // val sew = s.endsWith(sq)
- // val cew = coll.endsWith(fromSeq(sq))
- // if (sew != cew) {
- // println("from: " + s)
- // println("and: " + coll)
- // println(sew)
- // println(cew)
- // }
- // ("seq " + sq) |: sew == cew
- // }).reduceLeft(_ && _)
- // }
-
- // property("unions must be equal") = forAll(collectionPairsWithModified) { case (s, coll, collmodif) =>
- // ("modified" |: s.union(collmodif.seq) == coll.union(collmodif)) &&
- // ("empty" |: s.union(Nil) == coll.union(fromSeq(Nil)))
- // }
-
- // if (!isCheckingViews) property("patches must be equal") = forAll(collectionTripletsWith2Indices) {
- // case (s, coll, pat, from, repl) =>
- // ("with seq" |: s.patch(from, pat, repl) == coll.patch(from, pat, repl)) &&
- // ("with par" |: s.patch(from, pat, repl) == coll.patch(from, fromSeq(pat), repl)) &&
- // ("with empty" |: s.patch(from, Nil, repl) == coll.patch(from, fromSeq(Nil), repl)) &&
- // ("with one" |: (s.length == 0 || s.patch(from, List(s(0)), 1) == coll.patch(from, fromSeq(List(coll(0))), 1)))
- // }
-
- // if (!isCheckingViews) property("updates must be equal") = forAll(collectionPairsWithLengths) { case (s, coll, len) =>
- // val pos = if (len >= s.length) s.length - 1 else len
- // if (s.length > 0) {
- // val supd = s.updated(pos, s(0))
- // val cupd = coll.updated(pos, coll(0))
- // if (supd != cupd) {
- // println("from: " + s)
- // println("and: " + coll)
- // println(supd)
- // println(cupd)
- // }
- // "from first" |: (supd == cupd)
- // } else "trivially" |: true
- // }
-
- // property("prepends must be equal") = forAll(collectionPairs) { case (s, coll) =>
- // s.length == 0 || s(0) +: s == coll(0) +: coll
- // }
-
- // property("appends must be equal") = forAll(collectionPairs) { case (s, coll) =>
- // s.length == 0 || s :+ s(0) == coll :+ coll(0)
- // }
-
- // property("padTos must be equal") = forAll(collectionPairsWithLengths) { case (s, coll, len) =>
- // val someValue = sampleValue
- // val sdoub = s.padTo(len * 2, someValue)
- // val cdoub = coll.padTo(len * 2, someValue)
- // if (sdoub != cdoub) {
- // println("from: " + s)
- // println("and: " + coll)
- // println(sdoub)
- // println(cdoub)
- // }
- // ("smaller" |: s.padTo(len / 2, someValue) == coll.padTo(len / 2, someValue)) &&
- // ("bigger" |: sdoub == cdoub)
- // }
-
- // property("corresponds must be equal") = forAll(collectionPairsWithModified) { case (s, coll, modified) =>
- // val modifcut = modified.toSeq.slice(0, modified.length)
- // ("self" |: s.corresponds(s)(_ == _) == coll.corresponds(coll)(_ == _)) &&
- // ("modified" |: s.corresponds(modified.seq)(_ == _) == coll.corresponds(modified)(_ == _)) &&
- // ("modified2" |: s.corresponds(modifcut)(_ == _) == coll.corresponds(modifcut)(_ == _))
- // }
+ property("segmentLengths must be equal") = forAll(collectionPairsWithLengths) { case (s, coll, len) =>
+ (for ((pred, ind) <- segmentLengthPredicates.zipWithIndex) yield {
+ val slen = s.segmentLength(pred, if (len < 0) 0 else len)
+ val clen = coll.segmentLength(pred, len)
+ if (slen != clen) {
+ println("from: " + s)
+ println("and: " + coll)
+ println(slen)
+ println(clen)
+ }
+ ("operator " + ind) |: slen == clen
+ }).reduceLeft(_ && _)
+ }
+
+ property("prefixLengths must be equal") = forAll(collectionPairs) { case (s, coll) =>
+ (for ((pred, ind) <- segmentLengthPredicates.zipWithIndex) yield {
+ ("operator " + ind) |: s.prefixLength(pred) == coll.prefixLength(pred)
+ }).reduceLeft(_ && _)
+ }
+
+ property("indexWheres must be equal") = forAll(collectionPairsWithLengths) { case (s, coll, len) =>
+ (for ((pred, ind) <- indexWherePredicates.zipWithIndex) yield {
+ val sind = s.indexWhere(pred, len)
+ val cind = coll.indexWhere(pred, len)
+ if (sind != cind) {
+ println("from: " + s)
+ println("and: " + coll)
+ println("at: " + len)
+ println(sind)
+ println(cind)
+ }
+ ("operator " + ind) |: sind == cind
+ }).reduceLeft(_ && _)
+ }
+
+ property("lastIndexWheres must be equal") = forAll(collectionPairsWithLengths) { case (s, coll, len) =>
+ (for ((pred, ind) <- lastIndexWherePredicates.zipWithIndex) yield {
+ val end = if (len >= s.size) s.size - 1 else len
+ val sind = s.lastIndexWhere(pred, end)
+ val cind = coll.lastIndexWhere(pred, end)
+ ("operator " + ind) |: sind == cind
+ }).reduceLeft(_ && _)
+ }
+
+ property("reverses must be equal") = forAll(collectionPairs) { case (s, coll) =>
+ (s.length == 0 && s.getClass == classOf[collection.immutable.Range]) ||
+ {
+ val sr = s.reverse
+ val cr = coll.reverse
+ if (sr != cr) {
+ println("from: " + s)
+ println("and: " + coll)
+ println(sr)
+ println(cr)
+ }
+ sr == cr
+ }
+ }
+
+ property("reverseMaps must be equal") = forAll(collectionPairs) { case (s, coll) =>
+ (for ((f, ind) <- reverseMapFunctions.zipWithIndex) yield {
+ ("operator " + ind) |: s.reverseMap(f) == coll.reverseMap(f)
+ }).reduceLeft(_ && _)
+ }
+
+ property("sameElements must be equal") = forAll(collectionPairsWithModifiedWithLengths) {
+ case (s, coll, collmodif, len) =>
+ val pos = if (len < 0) 0 else len
+ val scm = s.sameElements(collmodif)
+ val ccm = coll.sameElements(collmodif)
+ if (scm != ccm) {
+ println("Comparing: " + s)
+ println("and: " + coll)
+ println("with: " + collmodif)
+ println(scm)
+ println(ccm)
+ }
+ ("Nil" |: s.sameElements(Nil) == coll.sameElements(Nil)) &&
+ ("toList" |: s.sameElements(s.toList) == coll.sameElements(coll.toList)) &&
+ ("identity" |: s.sameElements(s.map(e => e)) == coll.sameElements(coll.map(e => e))) &&
+ ("vice-versa" |: s.sameElements(coll) == coll.sameElements(s)) &&
+ ("equal" |: s.sameElements(coll)) &&
+ ("modified" |: scm == ccm) &&
+ (for ((it, ind) <- sameElementsSeqs.zipWithIndex) yield {
+ val sres = s.sameElements(it)
+ val pres = coll.sameElements(it)
+ if (sres != pres) {
+ println("Comparing: " + s)
+ println("and: " + coll)
+ println("with: " + it)
+ println(sres)
+ println(pres)
+ }
+ ("collection " + ind) |: sres == pres
+ }).reduceLeft(_ && _)
+ }
+
+ property("startsWiths must be equal") = forAll(collectionPairsWithModifiedWithLengths) {
+ case (s, coll, collmodif, len) =>
+ val pos = if (len < 0) 0 else len
+ ("start with self" |: s.startsWith(s) == coll.startsWith(coll)) &&
+ ("tails correspond" |: (s.length == 0 || s.startsWith(s.tail, 1) == coll.startsWith(coll.tail, 1))) &&
+ ("with each other" |: coll.startsWith(s)) &&
+ ("modified" |: s.startsWith(collmodif) == coll.startsWith(collmodif)) &&
+ ("modified2" |: s.startsWith(collmodif, pos) == coll.startsWith(collmodif, pos)) &&
+ (for (sq <- startEndSeqs) yield {
+ val ss = s.startsWith(sq, pos)
+ val cs = coll.startsWith(fromSeq(sq), pos)
+ if (ss != cs) {
+ println("from: " + s)
+ println("and: " + coll)
+ println("test seq: " + sq)
+ println("from pos: " + pos)
+ println(ss)
+ println(cs)
+ println(coll.iterator.psplit(pos, coll.length - pos)(1).toList)
+ }
+ ("seq " + sq) |: ss == cs
+ }).reduceLeft(_ && _)
+ }
+
+ property("endsWiths must be equal") = forAll(collectionPairsWithModified) {
+ case (s, coll, collmodif) =>
+ ("ends with self" |: s.endsWith(s) == coll.endsWith(s)) &&
+ ("ends with tail" |: (s.length == 0 || s.endsWith(s.tail) == coll.endsWith(coll.tail))) &&
+ ("with each other" |: coll.endsWith(s)) &&
+ ("modified" |: s.startsWith(collmodif) == coll.endsWith(collmodif)) &&
+ (for (sq <- startEndSeqs) yield {
+ val sew = s.endsWith(sq)
+ val cew = coll.endsWith(fromSeq(sq))
+ if (sew != cew) {
+ println("from: " + s)
+ println("and: " + coll)
+ println(sew)
+ println(cew)
+ }
+ ("seq " + sq) |: sew == cew
+ }).reduceLeft(_ && _)
+ }
+
+ property("unions must be equal") = forAll(collectionPairsWithModified) { case (s, coll, collmodif) =>
+ ("modified" |: s.union(collmodif.seq) == coll.union(collmodif)) &&
+ ("empty" |: s.union(Nil) == coll.union(fromSeq(Nil)))
+ }
+
+ if (!isCheckingViews) property("patches must be equal") = forAll(collectionTripletsWith2Indices) {
+ case (s, coll, pat, from, repl) =>
+ ("with seq" |: s.patch(from, pat, repl) == coll.patch(from, pat, repl)) &&
+ ("with par" |: s.patch(from, pat, repl) == coll.patch(from, fromSeq(pat), repl)) &&
+ ("with empty" |: s.patch(from, Nil, repl) == coll.patch(from, fromSeq(Nil), repl)) &&
+ ("with one" |: (s.length == 0 || s.patch(from, List(s(0)), 1) == coll.patch(from, fromSeq(List(coll(0))), 1)))
+ }
+
+ if (!isCheckingViews) property("updates must be equal") = forAll(collectionPairsWithLengths) { case (s, coll, len) =>
+ val pos = if (len >= s.length) s.length - 1 else len
+ if (s.length > 0) {
+ val supd = s.updated(pos, s(0))
+ val cupd = coll.updated(pos, coll(0))
+ if (supd != cupd) {
+ println("from: " + s)
+ println("and: " + coll)
+ println(supd)
+ println(cupd)
+ }
+ "from first" |: (supd == cupd)
+ } else "trivially" |: true
+ }
+
+ property("prepends must be equal") = forAll(collectionPairs) { case (s, coll) =>
+ s.length == 0 || s(0) +: s == coll(0) +: coll
+ }
+
+ property("appends must be equal") = forAll(collectionPairs) { case (s, coll) =>
+ s.length == 0 || s :+ s(0) == coll :+ coll(0)
+ }
+
+ property("padTos must be equal") = forAll(collectionPairsWithLengths) { case (s, coll, len) =>
+ val someValue = sampleValue
+ val sdoub = s.padTo(len * 2, someValue)
+ val cdoub = coll.padTo(len * 2, someValue)
+ if (sdoub != cdoub) {
+ println("from: " + s)
+ println("and: " + coll)
+ println(sdoub)
+ println(cdoub)
+ }
+ ("smaller" |: s.padTo(len / 2, someValue) == coll.padTo(len / 2, someValue)) &&
+ ("bigger" |: sdoub == cdoub)
+ }
+
+ property("corresponds must be equal") = forAll(collectionPairsWithModified) { case (s, coll, modified) =>
+ val modifcut = modified.toSeq.slice(0, modified.length)
+ ("self" |: s.corresponds(s)(_ == _) == coll.corresponds(coll)(_ == _)) &&
+ ("modified" |: s.corresponds(modified.seq)(_ == _) == coll.corresponds(modified)(_ == _)) &&
+ ("modified2" |: s.corresponds(modifcut)(_ == _) == coll.corresponds(modifcut)(_ == _))
+ }
}
diff --git a/test/files/scalacheck/parallel-collections/pc.scala b/test/files/scalacheck/parallel-collections/pc.scala
index ffc5eff78b..977fe4b130 100644
--- a/test/files/scalacheck/parallel-collections/pc.scala
+++ b/test/files/scalacheck/parallel-collections/pc.scala
@@ -9,6 +9,9 @@ import scala.collection.parallel._
class ParCollProperties extends Properties("Parallel collections") {
// parallel arrays
include(mutable.IntParallelArrayCheck)
+
+ // parallel ranges
+ include(immutable.ParallelRangeCheck)
}
diff --git a/test/files/scalacheck/testdir/dep.scala b/test/files/scalacheck/testdir/dep.scala
new file mode 100644
index 0000000000..ab167cbc8b
--- /dev/null
+++ b/test/files/scalacheck/testdir/dep.scala
@@ -0,0 +1,7 @@
+
+
+
+
+object Dependency {
+ val v = 1
+}
diff --git a/test/files/scalacheck/testdir/test.scala b/test/files/scalacheck/testdir/test.scala
new file mode 100644
index 0000000000..d5a5056137
--- /dev/null
+++ b/test/files/scalacheck/testdir/test.scala
@@ -0,0 +1,10 @@
+import org.scalacheck._
+
+
+
+
+
+
+object Test extends Properties("Nothing") {
+ val d = Dependency.v
+}