Add continuously growing collection Generators #849
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds generators which allow you to generate a collection/list that continuously grows until a condition/predicate is fullfilled (with the input of the condition being the current state of the collection being generated).
I am creating this PR because I currently have a usecase where I need to create a collection that is of specific size (in bytes, not number of elements) due to testing multipart uploads and having to make sure that generated test data is of least a specific chunk size but I suppose the problem is generic enough that it can apply to other issues.
Due to
Gen
being asealed trait
and certain methods insideGen
being private its not that easy to extendGen
with your own generator methods.The naming of the methods can probably be done better, also not sure if I need to add tests for these and if so what I should be testing for/what they should look like. The
failureHint
's approach is also an open question due to the fact that its obviously not possible to figure out the size of the resulting collection.