Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support customizing parameters on a per PropF basis #8

Open
mpilquist opened this issue Aug 21, 2020 · 3 comments
Open

Support customizing parameters on a per PropF basis #8

mpilquist opened this issue Aug 21, 2020 · 3 comments

Comments

@mpilquist
Copy link
Member

ScalaCheck supports this like so:

scala> val p = Prop.forAll { (x: Int, y: Int) => (x + y) == (y + x) }
val p: org.scalacheck.Prop = Prop

scala> val q = Prop(prm => p(prm.withInitialSeed(0L)))
val q: org.scalacheck.Prop = Prop

To support in PropF, we could add a method like mapParameters(f: Gen.Parameters => Gen.Parameters): PropF[F].

@TonioGela
Copy link
Member

Hi @mpilquist! It seems you're supposing that there's a way to alter parameters on a per ScalaCheckEffectSuite basis, correct?
As far as I see genParameters: Gen.Parameters in ScalaCheckEffectSuite is private so it can't be accessed or modified (in scalacheck-effect-munit 1.0.3).

@mpilquist
Copy link
Member Author

Yeah, the idea is to override scalaCheckTestParameters from the super ScalaCheckSuite:

  protected def scalaCheckTestParameters = ScalaCheckTest.Parameters.default

FS2 does this here:

  override def scalaCheckTestParameters =
    super.scalaCheckTestParameters
      .withMinSuccessfulTests(if (isJVM) 25 else 5)
      .withWorkers(1)

@TonioGela
Copy link
Member

Brilliant! Thanks and sorry for the off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants