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

Regenerate default seed at every prop iteration #124

Merged
merged 2 commits into from
May 10, 2020

Conversation

gabro
Copy link
Member

@gabro gabro commented May 7, 2020

Fixes #118

This is extremely subtle, but it seems to work now

@gabro gabro requested a review from olafurpg May 7, 2020 16:04
@gabro
Copy link
Member Author

gabro commented May 7, 2020

/cc @barambani

Comment on lines +52 to +59
def seed =
scalaCheckTestParameters.initialSeed.getOrElse(
Seed.fromBase64(scalaCheckInitialSeed).get
)
val result = check(scalaCheckTestParameters, prop.useSeed(test.name, seed))
val result = check(
scalaCheckTestParameters,
Prop(genParams => prop(genParams.withInitialSeed(seed)))
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this way if the user hasn't overridden the default seed, we recompute it in the Prop lambda (which is what viewSeed does in vanilla ScalaCheck)

@barambani
Copy link

Thanks for the fix. This version works for all the tests I had.

@gabro
Copy link
Member Author

gabro commented May 7, 2020

Thanks for confirming and thanks again for the detailed bug report. Having a reproduction test case has been really helpful in tracking this down

Copy link
Member

@olafurpg olafurpg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job tracking down the fix! Can we test this with a framework suite?

@olafurpg
Copy link
Member

olafurpg commented May 7, 2020

It’s possible to use println in framework suites just to check that each iteration has a unique value.

@gabro
Copy link
Member Author

gabro commented May 7, 2020

Whoops, I actually had a test suite I forgot to commit 😅 doing it tomorrow

@gabro
Copy link
Member Author

gabro commented May 8, 2020

Done now @olafurpg

Copy link
Member

@olafurpg olafurpg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Thank you for tracking this down!

@olafurpg olafurpg merged commit 6476e67 into scalameta:master May 10, 2020
@olafurpg
Copy link
Member

This fix has been released as v0.7.6. Thank you @barambani for reporting!

@barambani
Copy link

Brilliant, Thank you both.

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

Successfully merging this pull request may close these issues.

ScalaCheckSuite unexpected behavior
3 participants