summaryrefslogtreecommitdiff
path: root/test/files/scalacheck
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/scalacheck')
-rw-r--r--test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala20
1 files changed, 12 insertions, 8 deletions
diff --git a/test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala b/test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala
index a56cc763a6..4373157311 100644
--- a/test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala
+++ b/test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala
@@ -65,7 +65,7 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe
}
def collectionTripletsWith2Indices: Gen[(Seq[T], CollType, Seq[T], Int, Int)] =
- for (inst <- instances(values); f <- choose(0, inst.size); s <- choose(0, inst.size);
+ for (inst <- instances(values); f <- choose(0, inst.size); s <- choose(0, inst.size - f);
third <- instances(values); sliceStart <- choose(0, inst.size); howMany <- choose(0, inst.size)) yield {
(inst, fromSeq(inst), inst.slice(sliceStart, sliceStart + howMany), f, s)
}
@@ -218,16 +218,20 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe
("modified" |: s.union(collmodif.seq) == coll.union(collmodif)) &&
("empty" |: s.union(Nil) == coll.union(fromSeq(Nil)))
}
+
// This is failing with my views patch: array index out of bounds in the array iterator.
// Couldn't see why this and only this was impacted, could use a second pair of eyes.
//
- // 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)))
- // }
+ // This was failing because some corner cases weren't added to the patch method in ParSeqLike.
+ // Curiously, this wasn't detected before.
+ //
+ 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