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

Add arbitraries for not empty collection/string which do not ever fail to generate value #206

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

matwojcik
Copy link
Contributor

I've observed, that generation of String :| Not[Empty] tends to fail to generate value from time to time (even up to 1.5% from my tests) <- because the generator used underneath from time to time selects 0 size for collection.

This has caused some flaky tests for us when we had many such values generated and combined - then the probability of failing increases to 1 - 0.985^n where n is number of values combined.

Scalacheck has built in function Gen.nonEmptyBuildableOf which can be used here. Not Empty case may be the most useful Length[X] case so it makes sense IMHO to optimise here. Similar thing is done in refined.

@Iltotore Iltotore merged commit 6776639 into Iltotore:main Jan 10, 2024
1 check passed
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.

2 participants