scalacheck-effect icon indicating copy to clipboard operation
scalacheck-effect copied to clipboard

Custom Arbitrary[Int] to make collisions extremely unlikely

Open TimWSpence opened this issue 1 year ago • 0 comments

Custom Arbitrary[Int] to make collisions extremely unlikely. We believe that the default Arbitarary[Int]'s bias towards small values was making tests fail.

Test output saved for posterity:

munit.ScalaCheckEffectSuiteSuite:
==> X munit.ScalaCheckEffectSuiteSuite.Correctly slides seed for multi-arg PropF  0.494s munit.FailException: /home/runner/work/scalacheck-effect/scalacheck-effect/munit/shared/src/main/scala/munit/ScalaCheckEffectSuite.scala:62
61:      { case p: PropF[f] =>
62:        super.munitValueTransform(checkPropF[f](p))
63:      }
Failing seed: QRNvpBYUvcWdebEZ0LePM_-Fe0Sb7IpJWfnWwSPTqWA=
You can reproduce this failure by adding the following override to your suite:

  override def scalaCheckInitialSeed = "QRNvpBYUvcWdebEZ0LePM_-Fe0Sb7IpJWfnWwSPTqWA="

Exception raised on property evaluation.
> ARG_0: 2147483647
> ARG_1: -2147483648
> Exception: munit.FailException: /home/runner/work/scalacheck-effect/scalacheck-effect/munit/shared/src/test/scala/munit/ScalaCheckEffectSuiteSuite.scala:49 assertion failed
48:      // generated value from the previous iteration
49:      IO { assert(clue(duplicates) < 10) }
50:    }
Clues {
  duplicates: Int = 10
}

TimWSpence avatar Mar 04 '24 10:03 TimWSpence