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

Arrays are always generated with the same size #396

Closed
wants to merge 1 commit into from

Conversation

mjureczko
Copy link
Contributor

It solves the #387 issue for arrays. I applied the same solution as @benas did in #391 for collections.
The change caused the generatedObjectShouldBeAlwaysTheSameForTheSameSeed to fail. I fixed it in the same way as in PR 391 which raised there some controversy. I extracted from the test the flow regarding arrays to a new test where I generate arrays using the same seed and then assert the equality of the generated arrays. I could adapt the original test by changing the expected array, but such a solution is not clean in my opinion. The expected array is a magic value and it doesn't manifest the test intention. It compares generated array against the magic value whereas the goal is (unless I'm mistaken) to assure that reusing the seed leads to generating the same results.

@fmbenhassine fmbenhassine changed the title #387 random generated arrays size Arrays are always generated with the same size Mar 8, 2020
@fmbenhassine fmbenhassine added this to the 4.2.0 milestone Mar 8, 2020
fmbenhassine pushed a commit that referenced this pull request Mar 8, 2020
@fmbenhassine
Copy link
Member

Hi @mjureczko ,

Thank you for the PR! Indeed, the same issue happens with arrays.

However, the build fails with your PR. But no worries, I fixed that.

I could adapt the original test by changing the expected array, but such a solution is not clean in my opinion. The expected array is a magic value and it doesn't manifest the test intention. It compares generated array against the magic value whereas the goal is (unless I'm mistaken) to assure that reusing the seed leads to generating the same results.

I don't agree. The arrays size does not matter in that case. Different arrays should be generated with different sizes, no matter the value of the array size.

Ensuring that the same array is always generated with the same seed is covered in another test here, which you removed in #391 .

That said, I merged your changes and fixed the build failure. I also added you to the contributors list. Thank you for your contribution!

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

Successfully merging this pull request may close these issues.

2 participants