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

Adding support for partial permutations #3523

Merged
merged 2 commits into from
Jun 3, 2023

Conversation

mickeelm
Copy link
Contributor

@mickeelm mickeelm commented May 8, 2023

Adding length parameter (defaults to list size) to the permutations function, providing the opportunity of creating exhaustives of partial permutations/k-permutations.

Also, changed the assertion of the full permutations test from shouldBe to shouldContainExactlyInAnyOrder, as the order in which the permutations come are not (should not be) relevant. This also makes the test less dependent on the underlying implementation.

This PR does break binary compatibility, due to adding the length parameter.

@mickeelm mickeelm marked this pull request as draft May 9, 2023 07:46
@mickeelm
Copy link
Contributor Author

mickeelm commented May 9, 2023

Converting to draft as partial permutations of length zero aren't correctly handled, needs to be fixed.

@Kantis Kantis marked this pull request as ready for review May 9, 2023 17:38
@Kantis Kantis marked this pull request as draft May 9, 2023 17:39
@mickeelm mickeelm marked this pull request as ready for review May 10, 2023 19:03
@Kantis
Copy link
Member

Kantis commented May 17, 2023

@mickeelm this needs an updated apiDump :)

@mickeelm mickeelm force-pushed the partial_permutations branch 2 times, most recently from a3d63b7 to 15cb353 Compare May 23, 2023 18:27
Adding length parameter (defaults to list size) to the permutations function, providing the opportunity of creating exhaustives of partial permutations/k-permutations.

Also, changed the assertion of the full permutations test from shouldBe to shouldContainExactlyInAnyOrder, as the order in which the permutations come are not (should not be) relevant. This also makes the test less dependent on the underlying implementation.

The empty list check was removed, as an empty list will result in a list of an empty list (as with all permutations of length 0).

This commit does break binary compatibility, due to adding the length parameter.
@sksamuel sksamuel merged commit 67f8064 into kotest:master Jun 3, 2023
19 checks passed
@mickeelm mickeelm deleted the partial_permutations branch June 5, 2023 08:30
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.

None yet

3 participants