Skip to content

Commit

Permalink
Merge pull request #137 from typelevel/topic/fix-size
Browse files Browse the repository at this point in the history
Fix bug where sample sizes would not grow beyond a single element
  • Loading branch information
mpilquist authored Oct 3, 2021
2 parents 546e853 + 5b13edc commit 9bcd574
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/shared/src/main/scala/org/scalacheck/effect/PropF.scala
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ sealed trait PropF[F[_]] {
): F[Test.Result] = {

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

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

0 comments on commit 9bcd574

Please sign in to comment.