Skip to content

Conversation

AlexCue987
Copy link
Member

add Arb.slice

/**

  • Generates a random slice of the input list, including the empty list.
  • The returned list has the same order as the input list.
    */

@AlexCue987 AlexCue987 requested a review from a team as a code owner February 28, 2025 19:47
@AlexCue987 AlexCue987 merged commit 12206b0 into kotest:alex/Exhaustive-slices Feb 28, 2025
3 checks passed
@AlexCue987 AlexCue987 deleted the alex/add-Arb.slice-draft branch February 28, 2025 19:47
github-merge-queue bot pushed a commit that referenced this pull request Mar 9, 2025
add Arb.slice 

/**
 * Generates a random slice of the input list, including the empty list.
 * The returned list has the same order as the input list. 
 */

also add Exhaustive.slice

```
      test("Exhaustive.slices for strings") {
         Exhaustive.slices(listOf("apple", "orange", "banana")).values shouldContainExactlyInAnyOrder listOf(
            listOf("apple"),
            listOf("apple", "orange"),
            listOf("apple", "orange", "banana"),
            listOf("orange"),
            listOf("orange", "banana"),
            listOf("banana"),
         )
      }
```
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