typelevel / typelevel/scalacheck

retryUntil fails to produce anything when used to check list size inside a Prop

Open
#413 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
2k
Forks
393
Avg merge
6h 42m
Merged PRs (30d)
4

Description

I'm not sure what to make of it:

scala> Prop.forAll(
  arbitrary[List[Int]].retryUntil(_.nonEmpty)
)(_ => true).check
! Exception raised on property evaluation.
> Exception: org.scalacheck.Gen$RetryUntilException: retryUntil failed after 10001 attempts
org.scalacheck.Gen.loop$2(Gen.scala:131)
org.scalacheck.Gen.$anonfun$retryUntil$1(Gen.scala:135)
org.scalacheck.Gen$Parameters.useInitialSeed(Gen.scala:294)
org.scalacheck.Gen$$anon$3.doApply(Gen.scala:254)
org.scalacheck.Prop$.$anonfun$forAllShrink$1(Prop.scala:757)

From reading the scaladoc, it seems that .retryUntil should basically be the same as .suchThat for the purpose of using it in a Prop, except that it uses some internal filtering to circumvent the maxDiscardRatio. Am I wrong in thinking that?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the ScalaCheck snippet from the issue, then inspect Gen.scala around lines 131-135 and Prop.scala around line 757. Compare retryUntil with suchThat and trace how the generator is applied inside Prop.forAll. Done means the intended behavior is established and the reported failure is either corrected or clearly documented with regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.