New Upstream Snapshot - golang-github-leanovate-gopter

Ready changes

Summary

Merged new upstream version: 0.2.9+git20210531.90cc76d+ds (was: 0.2.9+git20210201.bbbf00e).

Resulting package

Built on 2022-11-21T14:50 (took 7m32s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-snapshots golang-github-leanovate-gopter-dev

Lintian Result

Diff

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
deleted file mode 100644
index bc58b96..0000000
--- a/.github/workflows/build.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-on: [push, pull_request]
-jobs:
-  build:
-    runs-on: ubuntu-16.04
-    strategy:
-      matrix:
-        go: [ '1.15', '1.14', '1.13' ]
-    name: Build on go ${{ matrix.go }}
-    steps:
-      - uses: actions/checkout@v2
-      - name: Setup go
-        uses: actions/setup-go@v1
-        with:
-          go-version: ${{ matrix.go }}
-      - run: go build -v ./...
-      - run: go test -v ./...
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 45371a9..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,30 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
-
-bin/
-*.iml
-.idea/
-coverage.txt
-.pkg.coverage
diff --git a/commands/actions.go b/commands/actions.go
index 1b47f78..28e2ff3 100644
--- a/commands/actions.go
+++ b/commands/actions.go
@@ -9,12 +9,13 @@ import (
 )
 
 type shrinkableCommand struct {
-	command  Command
-	shrinker gopter.Shrinker
+	command      Command
+	commandSieve func(v interface{}) bool
+	shrinker     gopter.Shrinker
 }
 
 func (s shrinkableCommand) shrink() gopter.Shrink {
-	return s.shrinker(s.command).Map(func(command Command) shrinkableCommand {
+	return s.shrinker(s.command).Filter(s.commandSieve).Map(func(command Command) shrinkableCommand {
 		return shrinkableCommand{
 			command:  command,
 			shrinker: s.shrinker,
@@ -126,8 +127,9 @@ func genSizedCommands(commands Commands, initialStateProvider func() State) gopt
 						sizedCommands{
 							state: command.NextState(prev.state),
 							commands: append(prev.commands, shrinkableCommand{
-								command:  command,
-								shrinker: result.Shrinker,
+								command:      command,
+								commandSieve: result.Sieve,
+								shrinker:     result.Shrinker,
 							}),
 						},
 						gopter.NoShrinker,
diff --git a/debian/changelog b/debian/changelog
index e275c69..52aab63 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+golang-github-leanovate-gopter (0.2.9+git20210531.90cc76d+ds-1) UNRELEASED; urgency=low
+
+  * New upstream snapshot.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Mon, 21 Nov 2022 14:44:19 -0000
+
 golang-github-leanovate-gopter (0.2.9+git20210201.bbbf00e-2) unstable; urgency=medium
 
   [ Debian Janitor ]
diff --git a/example_flatmap_test.go b/example_flatmap_test.go
new file mode 100644
index 0000000..037be87
--- /dev/null
+++ b/example_flatmap_test.go
@@ -0,0 +1,50 @@
+package gopter_test
+
+import (
+	"reflect"
+
+	"github.com/leanovate/gopter"
+	"github.com/leanovate/gopter/gen"
+	"github.com/leanovate/gopter/prop"
+)
+
+func Example_flatmap() {
+
+	type IntPair struct {
+		Fst int
+		Snd int
+	}
+
+	// Generate a pair of integers, such that the first
+	// is in the range of 10-20 and the second in the
+	// in the range of 2k-50, depending on the value of
+	// the first.
+	genIntPair := func() gopter.Gen {
+		return gen.IntRange(10, 20).FlatMap(func(v interface{}) gopter.Gen {
+			k := v.(int)
+			return gen.IntRange(2*k, 50).Map(func(m int) IntPair {
+				return IntPair{Fst: k, Snd: m}
+			})
+		},
+			reflect.TypeOf(int(0)))
+	}
+
+	parameters := gopter.DefaultTestParameters()
+	parameters.Rng.Seed(1234) // Just for this example to generate reproducible results
+	properties := gopter.NewProperties(parameters)
+
+	properties.Property("Generate a dependent pair of integers", prop.ForAll(
+		func(p IntPair) bool {
+			a := p.Fst
+			b := p.Snd
+			return a*2 <= b
+		},
+		genIntPair(),
+	))
+
+	// When using testing.T you might just use: properties.TestingRun(t)
+	properties.Run(gopter.ConsoleReporter(false))
+
+	// Output:
+	// + Generate a dependent pair of integers: OK, passed 100 tests.
+}
diff --git a/gen/struct.go b/gen/struct.go
index 5a2c5b2..7940109 100644
--- a/gen/struct.go
+++ b/gen/struct.go
@@ -9,7 +9,7 @@ import (
 
 // Struct generates a given struct type.
 // rt has to be the reflect type of the struct, gens contains a map of field generators.
-// Note that the result types of the generators in gen have to match the type of the correspoinding
+// Note that the result types of the generators in gen have to match the type of the corresponding
 // field in the struct. Also note that only public fields of a struct can be generated
 func Struct(rt reflect.Type, gens map[string]gopter.Gen) gopter.Gen {
 	if rt.Kind() == reflect.Ptr {
@@ -77,7 +77,7 @@ func Struct(rt reflect.Type, gens map[string]gopter.Gen) gopter.Gen {
 // Note that StructPtr does not generate nil, if you want to include nil in your
 // testing you should combine gen.PtrOf with gen.Struct.
 // rt has to be the reflect type of the struct, gens contains a map of field generators.
-// Note that the result types of the generators in gen have to match the type of the correspoinding
+// Note that the result types of the generators in gen have to match the type of the corresponding
 // field in the struct. Also note that only public fields of a struct can be generated
 func StructPtr(rt reflect.Type, gens map[string]gopter.Gen) gopter.Gen {
 	if rt.Kind() == reflect.Ptr {

Debdiff

[The following lists of changes regard files as different if they have different names, permissions or owners.]

Files in second set of .debs but not in first

-rw-r--r--  root/root   /usr/share/gocode/src/github.com/leanovate/gopter/example_flatmap_test.go

No differences were encountered in the control files

More details

Full run details