Skip to content

Commit 9bcd574

Browse files
authored
Merge pull request #137 from typelevel/topic/fix-size
Fix bug where sample sizes would not grow beyond a single element
2 parents 546e853 + 5b13edc commit 9bcd574

File tree

1 file changed

+3
-2
lines changed
  • core/shared/src/main/scala/org/scalacheck/effect

1 file changed

+3
-2
lines changed

core/shared/src/main/scala/org/scalacheck/effect/PropF.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ sealed trait PropF[F[_]] {
7777
): F[Test.Result] = {
7878

7979
import testParams.{minSuccessfulTests, minSize, maxDiscardRatio, maxSize}
80-
val sizeStep = (maxSize - minSize) / minSuccessfulTests
80+
val sizeStep = (maxSize - minSize) / minSuccessfulTests.toDouble
8181
val maxDiscarded = minSuccessfulTests * maxDiscardRatio
8282

8383
def loop(params: Gen.Parameters, passed: Int, discarded: Int): F[Test.Result] = {
@@ -86,7 +86,8 @@ sealed trait PropF[F[_]] {
8686
else if (discarded >= maxDiscarded)
8787
F.pure(Test.Result(Test.Exhausted, passed, discarded, FreqMap.empty))
8888
else {
89-
val size = minSize.toDouble + sizeStep
89+
val count = passed + discarded
90+
val size = minSize.toDouble + (sizeStep * count)
9091
checkOne(params.withSize(size.round.toInt)).flatMap { result =>
9192
result.status match {
9293
case Prop.True =>

0 commit comments

Comments
 (0)