From c6b952692ca75fb7972b280b6d5f61ec20604a5e Mon Sep 17 00:00:00 2001 From: Gregory Petrosyan Date: Sun, 8 Jan 2023 19:41:06 +0300 Subject: [PATCH] Add ExampleMap() --- combinators_example_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/combinators_example_test.go b/combinators_example_test.go index 399cbe7..2478bdf 100644 --- a/combinators_example_test.go +++ b/combinators_example_test.go @@ -8,6 +8,7 @@ package rapid_test import ( "fmt" + "strconv" "pgregory.net/rapid" ) @@ -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)