Skip to content

Commit

Permalink
Add ExampleMap()
Browse files Browse the repository at this point in the history
  • Loading branch information
flyingmutant committed Jan 8, 2023
1 parent 29bc927 commit c6b9526
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions combinators_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package rapid_test

import (
"fmt"
"strconv"

"pgregory.net/rapid"
)
Expand Down Expand Up @@ -56,6 +57,19 @@ func ExampleDeferred() {
// true
}

func ExampleMap() {
gen := rapid.Map(rapid.Int(), strconv.Itoa)
for i := 0; i < 5; i++ {
fmt.Printf("%#v\n", gen.Example(i))
}
// Output:
// "-3"
// "-186981"
// "4"
// "-2"
// "43"
}

func ExampleJust() {
gen := rapid.Just(42)

Expand Down

0 comments on commit c6b9526

Please sign in to comment.