diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2011-03-11 23:07:08 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2011-03-11 23:07:08 +0000 |
commit | 0254234328ab8a438aac649234bd5e12614f8ff9 (patch) | |
tree | 41ad8758e6697ac64881e3df471030d4921c4bac /test | |
parent | 8f245d95f683dec681ea98406c438da32409c088 (diff) | |
download | scala-0254234328ab8a438aac649234bd5e12614f8ff9.tar.gz scala-0254234328ab8a438aac649234bd5e12614f8ff9.tar.bz2 scala-0254234328ab8a438aac649234bd5e12614f8ff9.zip |
Fixes the broken test, introduced in the view p...
Fixes the broken test, introduced in the view patch commit.
No review.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala | 20 |
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 |