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

3 new sequence-based operators #29

Merged
merged 8 commits into from
Jan 25, 2022
Merged

3 new sequence-based operators #29

merged 8 commits into from
Jan 25, 2022

Conversation

nicorichard
Copy link
Contributor

@nicorichard nicorichard commented Jan 15, 2022

startWith

Another form of support for EdgeCase testing and a way of assuring that certain conditions transpire during a generation cycle.

Allows us to start the stream of generated values with a predefined sequence.

e.g. Int.arbitrary.startWith([-1, 0, 1]) would be an option for ensuring that certain edge cases are handled and will produce: -1, 0, 1, RANDOM_INT, RANDOM_INT, RANDOM_INT...

iterate

Allows iteration over a finite over an infinite sequence, if the sequence is exhausted then (exactly like the sequence protocol) the generator will begin to produce nil

e.g. Gen.iterate([0,1,2]) will always produce: 0, 1, 2, nil, nil, nil, nil...

looping

Allows iteration over a finite over an infinite sequence, if the sequence is exhausted then the sequence will be restarted

e.g. Gen.looping([0,1,2]) will always produce: 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2....

Base automatically changed from edgecases to main January 25, 2022 16:27
# Conflicts:
#	Sources/Genything/gen/combine/Gen+edgeCases.swift
#	Tests/GenythingTests/arbitrary/FoundationArbitraryTests.swift
@nicorichard nicorichard merged commit 7c73a52 into main Jan 25, 2022
@nicorichard nicorichard deleted the sequences branch February 11, 2022 20:29
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.

1 participant