From 68c7d6844151ed5fc40c2369a1d5ccd42500e1a8 Mon Sep 17 00:00:00 2001 From: Dwayne Schultz Date: Sat, 8 Jul 2023 15:40:54 -0600 Subject: [PATCH] Kitchen sink --- .golangci.yaml | 13 + ast/cache.go | 194 +- ast/cache_test.go | 337 +- ast/dsl.go | 49 +- ast/dsl_test.go | 28 +- ast/testpkgs/export/generics.go | 21 + ast/testpkgs/noexport/generics.go | 21 + generator/converter.go | 216 +- generator/generator_test.go | 12 + generator/moqgen.go | 12 +- generator/moqgen_test.go | 66 +- .../exported/moq_exported_testmoqs.go | 12819 +++++++++++----- generator/testmoqs/fnadaptors_test.go | 844 +- generator/testmoqs/moq_testmoqs_test.go | 12819 +++++++++++----- generator/testmoqs/other/types.go | 1 - generator/testmoqs/testmoqs_test.go | 46 + generator/testmoqs/types.go | 55 +- generator/testmoqs/usualadaptors_test.go | 834 + go.mod | 12 +- go.sum | 94 +- pkg/testmoqs/moq_generic_indexlistgentype.go | 1267 ++ pkg/testmoqs/moq_reduced.go | 1 - pkg/testmoqs/types.go | 11 +- pkg/testmoqs/types_test.go | 7 +- 24 files changed, 21866 insertions(+), 7913 deletions(-) create mode 100644 ast/testpkgs/export/generics.go create mode 100644 ast/testpkgs/noexport/generics.go create mode 100644 pkg/testmoqs/moq_generic_indexlistgentype.go diff --git a/.golangci.yaml b/.golangci.yaml index bf062f1..180ac97 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -34,6 +34,10 @@ linters: # Usually disabled but useful for checking everything has godoc - golint +run: + skip-dirs: + - ^testit.* + linters-settings: gci: sections: @@ -70,6 +74,15 @@ issues: - revive - stylecheck - unused + - linters: + - unused + path: generator/testmoqs/fnadaptors_test.go + - linters: + - unused + path: generator/testmoqs/usualadaptors_test.go + - linters: + - inamedparam + path: .*/testmoqs/.* include: # disable excluding of issues about comments from golint. - EXC0002 diff --git a/ast/cache.go b/ast/cache.go index 457a10d..0e5efc1 100644 --- a/ast/cache.go +++ b/ast/cache.go @@ -4,6 +4,7 @@ package ast import ( "errors" "fmt" + "go/token" "io/fs" "os" "path/filepath" @@ -23,9 +24,11 @@ import ( const ( builtinPkg = "builtin" - genTypeSuffix = "_genType" - starGenTypeSuffix = "_starGenType" - testPkgSuffix = "_test" + genTypeSuffix = "_genType" + starGenTypeSuffix = "_starGenType" + indexGenTypeSuffix = "_indexGenType" + indexListGenTypeSuffix = "_indexListGenType" + testPkgSuffix = "_test" ) //go:generate moqueries LoadFn @@ -197,7 +200,7 @@ func (c *Cache) Type(id dst.Ident, contextPkg string, testImport bool) (TypeInfo // IsComparable determines if an expression is comparable. The optional // parentType can be used to supply type parameters. func (c *Cache) IsComparable(expr dst.Expr, parentType TypeInfo) (bool, error) { - return c.isDefaultComparable(expr, &parentType, true) + return c.isDefaultComparable(expr, &parentType, true, false) } // IsDefaultComparable determines if an expression is comparable. Returns the @@ -206,7 +209,7 @@ func (c *Cache) IsComparable(expr dst.Expr, parentType TypeInfo) (bool, error) { // map key will panic at runtime and by default pointers use a deep hash to be // comparable). func (c *Cache) IsDefaultComparable(expr dst.Expr, parentType TypeInfo) (bool, error) { - return c.isDefaultComparable(expr, &parentType, false) + return c.isDefaultComparable(expr, &parentType, false, false) } // FindPackage finds the package for a given directory @@ -368,32 +371,75 @@ func (c *Cache) isDefaultComparable( expr dst.Expr, parentType *TypeInfo, interfacePointerDefault bool, + genericType bool, ) (bool, error) { + subInterfaceDefault := interfacePointerDefault + if genericType { + subInterfaceDefault = false + } switch e := expr.(type) { case *dst.ArrayType: if e.Len == nil { return false, nil } - return c.isDefaultComparable(e.Elt, parentType, interfacePointerDefault) + + return c.isDefaultComparable(e.Elt, parentType, interfacePointerDefault, genericType) + case *dst.BinaryExpr: + comp, err := c.isDefaultComparable(e.X, parentType, interfacePointerDefault, genericType) + if err != nil || !comp { + return comp, err + } + + return c.isDefaultComparable(e.Y, parentType, interfacePointerDefault, genericType) case *dst.Ellipsis: return false, nil case *dst.FuncType: return false, nil case *dst.InterfaceType: - return interfacePointerDefault, nil - case *dst.Ident: - if e.Obj != nil { - typ, ok := e.Obj.Decl.(*dst.TypeSpec) - if !ok { - return false, fmt.Errorf("%q: %w", e.String(), ErrInvalidType) + if e.Methods == nil || len(e.Methods.List) == 0 { + // Basically an "any" interface + return subInterfaceDefault, nil + } + hasTypeConstraints := false + for _, m := range e.Methods.List { + if _, ok := m.Type.(*dst.FuncType); ok { + // Skip methods as they don't change whether something is + // comparable + continue } - if typ.Name.Name == "string" && typ.Name.Path == "" { - return true, nil + hasTypeConstraints = true + + comp, err := c.isDefaultComparable(m.Type, parentType, subInterfaceDefault, genericType) + if err != nil || !comp { + return comp, err } + } - return c.isDefaultComparable(typ.Type, parentType, interfacePointerDefault) + if hasTypeConstraints { + // If an interface has type constraints and none of them were not + // comparable (none were because we would have returned early + // above), then it is always comparable + return true, nil } + + return subInterfaceDefault, nil + case *dst.Ident: + // if e.Obj != nil { + // var tExpr dst.Expr + // switch typ := e.Obj.Decl.(type) { + // case *dst.TypeSpec: + // tExpr = typ.Type + // case *dst.Field: + // tExpr = typ.Type + // default: + // return false, fmt.Errorf("identity expression %q: %w", e.String(), ErrInvalidType) + // } + // + // return c.isDefaultComparable(tExpr, parentType, "", interfacePointerDefault, false) + // } + // TODO: Generic type parameters should trump types in the cache (call + // findGenericType first) pkgPath := e.Path typ, ok := c.typesByIdent[e.String()] if !ok && e.Path == "" && parentType != nil { @@ -407,15 +453,27 @@ func (c *Cache) isDefaultComparable( Exported: isExported(e.Name, pkgPath), Fabricated: false, } - return c.isDefaultComparable(typ.typ.Type, tInfo, interfacePointerDefault) + return c.isDefaultComparable( + typ.typ.Type, tInfo, interfacePointerDefault, genericType) } - // Builtin type? - if e.Path == "" { - // error is the one builtin type that may not be comparable (it's + // Builtin or generic type? + if e.Path == "" || (parentType != nil && parentType.Type != nil && e.Path == parentType.Type.Name.Path) { + // Precedence is given to a generic type + gType := c.findGenericType(parentType, e.Name) + if gType != nil { + return c.isDefaultComparable(gType, parentType, interfacePointerDefault, true) + } + + // error is a builtin type that may not be comparable (it's // an interface so return the same result as an interface) if e.Name == "error" { - return interfacePointerDefault, nil + return subInterfaceDefault, nil + } + + // any is an alias for interface{}, so again the default + if e.Name == "any" { + return subInterfaceDefault, nil } return true, nil @@ -434,7 +492,7 @@ func (c *Cache) isDefaultComparable( Exported: isExported(e.Name, e.Path), Fabricated: false, } - return c.isDefaultComparable(typ.typ.Type, tInfo, interfacePointerDefault) + return c.isDefaultComparable(typ.typ.Type, tInfo, interfacePointerDefault, genericType) } return true, nil @@ -443,7 +501,7 @@ func (c *Cache) isDefaultComparable( case *dst.SelectorExpr: ex, ok := e.X.(*dst.Ident) if !ok { - return false, fmt.Errorf("%q: %w", e.X, ErrInvalidType) + return false, fmt.Errorf("selector expression %q: %w", e.X, ErrInvalidType) } path := ex.Name _, err := c.loadPackage(path, false) @@ -453,7 +511,7 @@ func (c *Cache) isDefaultComparable( typ, ok := c.typesByIdent[IdPath(e.Sel.Name, path).String()] if ok { - return c.isDefaultComparable(typ.typ.Type, parentType, interfacePointerDefault) + return c.isDefaultComparable(typ.typ.Type, nil, interfacePointerDefault, genericType) } // Builtin type? @@ -462,16 +520,96 @@ func (c *Cache) isDefaultComparable( return interfacePointerDefault, nil case *dst.StructType: for _, f := range e.Fields.List { - comp, err := c.isDefaultComparable(f.Type, parentType, interfacePointerDefault) + comp, err := c.isDefaultComparable(f.Type, parentType, interfacePointerDefault, genericType) if err != nil || !comp { return false, err } } + case *dst.UnaryExpr: + if e.Op != token.TILDE { + return false, fmt.Errorf( + "unexpected unary operator %s: %w", e.Op.String(), ErrInvalidType) + } + // This is a type constraint and for determining comparability, we + // don't care if the constraint is for a type or underlying types + return c.isDefaultComparable(e.X, parentType, interfacePointerDefault, genericType) } return true, nil } +func (c *Cache) findGenericType(parentType *TypeInfo, paramTypeName string) dst.Expr { + if parentType == nil || parentType.Type == nil || parentType.Type.TypeParams == nil { + return nil + } + + for _, p := range parentType.Type.TypeParams.List { + for _, n := range p.Names { + if n.Name == paramTypeName { + return p.Type + } + } + } + + return nil +} + +// func (c *Cache) findMethodGenericType(fn *dst.FuncDecl, paramTypeName string) (dst.Expr, error) { +// // Only handle methods here. Functions and structs have their Obj's intact +// // and don't need to be looked up in another declaration +// for _, r := range fn.Recv.List { +// switch idxType := r.Type.(type) { +// case *dst.IndexListExpr: +// for n, iExpr := range idxType.Indices { +// xId, ok := idxType.X.(*dst.Ident) +// if !ok { +// return nil, fmt.Errorf( +// "expecting *dst.Ident in IndexListExpr.X: %w", ErrInvalidType) +// } +// gType, err := c.findIndexedGenericType(iExpr, paramTypeName, xId, n) +// if err != nil || gType != nil { +// return gType, err +// } +// } +// case *dst.IndexExpr: +// xId, ok := idxType.X.(*dst.Ident) +// if !ok { +// return nil, fmt.Errorf( +// "expecting *dst.Ident in IndexExpr.X: %w", ErrInvalidType) +// } +// return c.findIndexedGenericType(idxType.Index, paramTypeName, xId, 0) +// default: +// return nil, fmt.Errorf( +// "unexpected index type %#v: %w", idxType, ErrInvalidType) +// } +// } +// +// return nil, nil +// } + +// func (c *Cache) findIndexedGenericType( +// iExpr dst.Expr, paramTypeName string, xId *dst.Ident, idx int, +// ) (dst.Expr, error) { +// if id, ok := iExpr.(*dst.Ident); ok && id.Name != paramTypeName { +// return nil, nil +// } +// +// if xId.Obj == nil { +// return nil, fmt.Errorf( +// "expecting Obj: %w", ErrInvalidType) +// } +// tSpec, ok := xId.Obj.Decl.(*dst.TypeSpec) +// if !ok { +// return nil, fmt.Errorf( +// "expecting *dst.TypeSpec: %w", ErrInvalidType) +// } +// if tSpec.TypeParams == nil || len(tSpec.TypeParams.List) <= idx { +// return nil, fmt.Errorf( +// "base type to method type param mismatch: %w", ErrInvalidType) +// } +// return tSpec.TypeParams.List[idx].Type, nil +// } + func (c *Cache) loadPackage(path string, testImport bool) (string, error) { indexPath := path if strings.HasPrefix(path, ".") { @@ -706,6 +844,14 @@ func (c *Cache) storeFuncDecl(decl *dst.FuncDecl, pkg *pkgInfo) { suffix = starGenTypeSuffix expr = sExpr.X } + if iExpr, ok := expr.(*dst.IndexExpr); ok { + suffix = indexGenTypeSuffix + expr = iExpr.X + } + if ilExpr, ok := expr.(*dst.IndexListExpr); ok { + suffix = indexListGenTypeSuffix + expr = ilExpr.X + } exprId, ok := expr.(*dst.Ident) if !ok { logs.Panicf("%s has a non-Ident (or StarExpr/Ident) receiver: %#v", diff --git a/ast/cache_test.go b/ast/cache_test.go index 4a60b4c..2e87386 100644 --- a/ast/cache_test.go +++ b/ast/cache_test.go @@ -1106,6 +1106,330 @@ type e struct { }) } }) + + t.Run("generics", func(t *testing.T) { + for name, tc := range map[string]struct { + comparable bool + defaultComparable bool + typeConstraints string + structContents string + typeParams string + errorContains string + alterMethod func(*dst.FuncDecl) + skipNonMethodTest bool + }{ + "[T any, U comparable, V any]": { + comparable: true, + defaultComparable: true, + typeConstraints: "[T any, U comparable, V any]", + structContents: "t T; u U; v V", + typeParams: "T, U, V", + }, + "[T any, U any, V any]": { + comparable: false, + defaultComparable: false, + typeConstraints: "[T any, U any, V any]", + structContents: "t T; u U; v V", + typeParams: "T, U, V", + }, + "[U comparable]": { + comparable: true, + defaultComparable: true, + typeConstraints: "[U comparable]", + }, + "[U any]": { + comparable: false, + defaultComparable: false, + typeConstraints: "[U any]", + }, + "[U interface{}]": { + comparable: false, + defaultComparable: false, + typeConstraints: "[U interface{}]", + }, + "[U []int]": { + comparable: false, + defaultComparable: false, + typeConstraints: "[U []int]", + }, + "[U int]": { + comparable: true, + defaultComparable: true, + typeConstraints: "[U int]", + }, + "[U interface{ []int }]": { + comparable: false, + defaultComparable: false, + typeConstraints: "[U interface{ []int }]", + }, + "[U interface{ int }]": { + comparable: true, + defaultComparable: true, + typeConstraints: "[U interface{ int }]", + }, + "[U notComparable]": { + comparable: false, + defaultComparable: false, + typeConstraints: "[U notComparable]", + }, + "[U isComparable]": { + comparable: true, + defaultComparable: true, + typeConstraints: "[U isComparable]", + }, + "[U ~notComparable]": { + comparable: false, + defaultComparable: false, + typeConstraints: "[U ~notComparable]", + }, + "[U ~isComparable]": { + comparable: true, + defaultComparable: true, + typeConstraints: "[U ~isComparable]", + }, + "[U interface{ ~int | ~string }]": { + comparable: true, + defaultComparable: true, + typeConstraints: "[U interface{ ~int | ~string }]", + }, + "[U interface{ ~int | ~string | ~notComparable }]": { + comparable: false, + defaultComparable: false, + typeConstraints: "[U interface{ ~int | ~string | ~notComparable }]", + }, + "[U interface{ ~notComparable | ~int | ~string }]": { + comparable: false, + defaultComparable: false, + typeConstraints: "[U interface{ ~notComparable | ~int | ~string }]", + }, + "[U interface{ ~int | ~isComparable | ~string }]": { + comparable: true, + defaultComparable: true, + typeConstraints: "[U interface{ ~int | ~isComparable | ~string }]", + }, + "[U interface{ comparable; m() }]": { + comparable: true, + defaultComparable: true, + typeConstraints: "[U interface{ comparable; m() }]", + }, + "no type constraints on struct": { + typeConstraints: "", + errorContains: "base type to method type param mismatch", + // A generic function (not a method) doesn't depend on the + // type params on a struct. Skip + skipNonMethodTest: true, + }, + "non-id IndexListExpr.X": { + typeConstraints: "[T any, U any, V any]", + structContents: "t T; u U; v V", + typeParams: "T, U, V", + alterMethod: func(decl *dst.FuncDecl) { + decl.Recv.List[0].Type.(*dst.IndexListExpr).X = ast.Un(token.AND, ast.Id("hi")) + }, + // There is no index list for a generic function + skipNonMethodTest: true, + errorContains: "expecting *dst.Ident in IndexListExpr.X", + }, + "non-id IndexExpr.X": { + alterMethod: func(decl *dst.FuncDecl) { + decl.Recv.List[0].Type.(*dst.IndexExpr).X = ast.Un(token.AND, ast.Id("hi")) + }, + // There is no index list for a generic function + skipNonMethodTest: true, + errorContains: "expecting *dst.Ident in IndexExpr.X", + }, + "unexpected index type": { + alterMethod: func(decl *dst.FuncDecl) { + decl.Recv.List[0].Type = ast.Un(token.AND, ast.Id("hi")) + }, + // There is no index list for a generic function + skipNonMethodTest: true, + errorContains: "unexpected index type", + }, + "too many method type params": { + typeParams: "A, B, C, U", + errorContains: "base type to method type param mismatch", + // A generic function (not a method) doesn't depend on + // the type params on a struct. Skip + skipNonMethodTest: true, + }, + "no type spec": { + alterMethod: func(decl *dst.FuncDecl) { + decl.Recv.List[0].Type.(*dst.IndexExpr).X.(*dst.Ident).Obj = nil + }, + // There is no index list for a generic function + skipNonMethodTest: true, + errorContains: "expecting Obj", + }, + "non-type spec decl": { + alterMethod: func(decl *dst.FuncDecl) { + decl.Recv.List[0].Type.(*dst.IndexExpr).X.(*dst.Ident).Obj.Decl = "hi" + }, + // There is no index list for a generic function + skipNonMethodTest: true, + errorContains: "expecting *dst.TypeSpec", + }, + "bad underlying type operator": { + typeConstraints: "[U ~int]", + alterMethod: func(decl *dst.FuncDecl) { + decl.Recv.List[0]. + Type.(*dst.IndexExpr). + X.(*dst.Ident).Obj. + Decl.(*dst.TypeSpec).TypeParams.List[0]. + Type.(*dst.UnaryExpr).Op = token.AND + }, + // There is no index list for a generic function + skipNonMethodTest: true, + errorContains: "unexpected unary operator &", + }, + } { + t.Run(name, func(t *testing.T) { + for name, stc := range map[string]struct { + compFn compFn + comparable bool + structable bool + }{ + "IsComparable": { + compFn: isComparable, + comparable: tc.comparable, + structable: false, + }, + "IsDefaultComparable": { + compFn: isDefaultComparable, + comparable: tc.defaultComparable, + structable: true, + }, + } { + t.Run(name, func(t *testing.T) { + for name, fn := range map[string]func(*testing.T) ast.TypeInfo{ + // "struct context": func(t *testing.T, f *dst.File) (dst.Expr, *dst.TypeSpec) { + // if tc.skipNonMethodTest { + // t.Skip() + // } + // + // gen, ok := f.Decls[2].(*dst.GenDecl) + // if !ok { + // t.Fatalf("got %#v, want a generic declaration", f.Decls[1]) + // } + // fields := gen.Specs[0].(*dst.TypeSpec).Type.(*dst.StructType).Fields.List + // var idx int + // // A bit brittle but at least one of the + // // tests puts U in the middle of the list + // if len(fields) == 1 { + // idx = 0 + // } else { + // idx = 1 + // } + // expr := fields[idx].Type + // return expr, nil + // }, + // "method context": func(t *testing.T, f *dst.File) (dst.Expr, *dst.FuncDecl) { + // fn, ok := f.Decls[3].(*dst.FuncDecl) + // if !ok { + // t.Fatalf("got %#v, want a function declaration", f.Decls[1]) + // } + // expr := fn.Type.Params.List[0].Type + // if tc.alterMethod != nil { + // tc.alterMethod(fn) + // } + // return expr, fn + // }, + // "function context": func(t *testing.T, f *dst.File) (dst.Expr, *dst.FuncDecl) { + // if tc.skipNonMethodTest { + // t.Skip() + // } + // + // fn, ok := f.Decls[4].(*dst.FuncDecl) + // if !ok { + // t.Fatalf("got %#v, want a function declaration", f.Decls[1]) + // } + // expr := fn.Type.Params.List[0].Type + // + // return expr, fn + // }, + "type context": func(t *testing.T) ast.TypeInfo { + t.Helper() + tSpec, err := cache.Type(*ast.IdPath("b", "a"), "", false) + if err != nil { + t.Fatalf("got Type error: %#v, want no error", err) + } + + return tSpec + }, + } { + t.Run(name, func(t *testing.T) { + if tc.skipNonMethodTest { + t.Skip() + } + + // ASSEMBLE + beforeEach(t, false) + defer afterEach(t) + + code := `package a + +type notComparable []int + +type isComparable int + +type b%s struct{%s} + +func (b[%s]) c(U) {} + +func d%s(U) {} +` + structContents := tc.structContents + if structContents == "" { + structContents = "u U" + } + typeParams := tc.typeParams + if typeParams == "" { + typeParams = "U" + } + code = fmt.Sprintf(code, tc.typeConstraints, + structContents, typeParams, + tc.typeConstraints) + pkgs := loadPackages(t, map[string]string{ + "code.go": code, + "go.mod": "module a", + }) + + metricsMoq.OnCall().ASTPkgCacheMissesInc().ReturnResults() + loadFnMoq.onCall(loadCfg, "a"). + returnResults(pkgs, nil) + metricsMoq.OnCall().ASTTotalLoadTimeInc(0).Any().D().ReturnResults() + metricsMoq.OnCall().ASTTotalDecorationTimeInc(0).Any().D().ReturnResults() + + tSpec := fn(t) + + // ACT + isComp, err := stc.compFn(cache, ast.Id("U"), tSpec) + // ASSERT + if tc.errorContains == "" { + if err != nil { + t.Errorf("got %#v, want no error", err) + } + if isComp != stc.comparable { + t.Errorf("got %t, want %t", isComp, stc.comparable) + } + } else { + if err == nil { + t.Fatalf("got no error, want err") + } + if !errors.Is(err, ast.ErrInvalidType) { + t.Errorf("got %#v, want ast.ErrInvalidType", err) + } + if !strings.Contains(err.Error(), tc.errorContains) { + t.Errorf("got %s, want to contain %s", err.Error(), tc.errorContains) + } + } + }) + } + }) + } + }) + } + }) }) t.Run("DST ident not comparable", func(t *testing.T) { @@ -1397,8 +1721,8 @@ type e struct { typs := cache.MockableTypes(tc.onlyExported) // ASSERT - if len(typs) != 5 { - t.Fatalf("got %d types, want 5", len(typs)) + if len(typs) != 7 { + t.Fatalf("got %d types, want 7", len(typs)) } typsByName := map[string]dst.Ident{} @@ -1422,6 +1746,7 @@ type e struct { if _, ok := typsByName[tc.widgetPrefix+"_starGenType"]; !ok { t.Errorf("got nothing, want %s_starGenType", tc.widgetPrefix) } + // TODO: Check new extensions }) } }) @@ -1471,8 +1796,8 @@ type e struct { typs := cache.MockableTypes(true) // ASSERT - if len(typs) != 5 { - t.Fatalf("got %d types, want 5", len(typs)) + if len(typs) != 7 { + t.Fatalf("got %d types, want 7", len(typs)) } }) @@ -1500,8 +1825,8 @@ type e struct { typs := cache.MockableTypes(true) // ASSERT - if len(typs) != 5 { - t.Fatalf("got %d types, want 5", len(typs)) + if len(typs) != 7 { + t.Fatalf("got %d types, want 7", len(typs)) } }) }) diff --git a/ast/dsl.go b/ast/dsl.go index 0e50a88..e3d4736 100644 --- a/ast/dsl.go +++ b/ast/dsl.go @@ -231,6 +231,11 @@ func (d FnDSL) Results(fields ...*dst.Field) FnDSL { return d } +func (d FnDSL) TypeParams(fieldList *dst.FieldList) FnDSL { + d.Obj.Type.TypeParams = fieldList + return d +} + // Body specifies the body for a function func (d FnDSL) Body(list ...dst.Stmt) FnDSL { d.Obj.Body = Block(list...).Obj @@ -312,25 +317,6 @@ func IdPath(name, path string) *dst.Ident { return &dst.Ident{Name: name, Path: path} } -// IncStmt creates a dst.IncDecStmt for incrementing an expression -func IncStmt(x dst.Expr) *dst.IncDecStmt { - return &dst.IncDecStmt{X: x, Tok: token.INC} -} - -// IndexDSL translates to a dst.IndexExpr -type IndexDSL struct{ Obj *dst.IndexExpr } - -// Index creates a new IndexDSL -func Index(x dst.Expr) IndexDSL { - return IndexDSL{Obj: &dst.IndexExpr{X: x}} -} - -// Sub specifies the sub-expression -func (d IndexDSL) Sub(index dst.Expr) IndexDSL { - d.Obj.Index = index - return d -} - // IfDSL translates to a dst.IfStmt type IfDSL struct{ Obj *dst.IfStmt } @@ -371,6 +357,25 @@ func IfDecs(after dst.SpaceType) IfDecsDSL { }} } +// IncStmt creates a dst.IncDecStmt for incrementing an expression +func IncStmt(x dst.Expr) *dst.IncDecStmt { + return &dst.IncDecStmt{X: x, Tok: token.INC} +} + +// IndexDSL translates to a dst.IndexListExpr +type IndexDSL struct{ Obj *dst.IndexListExpr } + +// Index creates a new IndexDSL +func Index(x dst.Expr) IndexDSL { + return IndexDSL{Obj: &dst.IndexListExpr{X: x}} +} + +// Sub specifies the sub-expression +func (d IndexDSL) Sub(index ...dst.Expr) IndexDSL { + d.Obj.Indices = index + return d +} + // KeyValueDSL translates to a dst.KeyValueExpr type KeyValueDSL struct{ Obj *dst.KeyValueExpr } @@ -585,6 +590,12 @@ func (d TypeSpecDSL) Type(typ dst.Expr) TypeSpecDSL { return d } +// TypeParams adds type parameters to TypeDeclDSL +func (d TypeSpecDSL) TypeParams(typeParams *dst.FieldList) TypeSpecDSL { + d.Obj.TypeParams = typeParams + return d +} + // TypeDeclDSL translates various types into a dst.GenDecl type TypeDeclDSL struct{ Obj *dst.GenDecl } diff --git a/ast/dsl_test.go b/ast/dsl_test.go index f1f117d..5790809 100644 --- a/ast/dsl_test.go +++ b/ast/dsl_test.go @@ -17,12 +17,15 @@ var ( id4 = dst.NewIdent("id4") id5 = dst.NewIdent("id5") id6 = dst.NewIdent("id6") + id7 = dst.NewIdent("id7") + id8 = dst.NewIdent("id8") field1 = &dst.Field{Type: id1} field2 = &dst.Field{Type: id2} - params = &dst.FieldList{List: []*dst.Field{{Type: id3}, {Type: id4}}} - results = &dst.FieldList{List: []*dst.Field{{Type: id5}, {Type: id6}}} + typeParams = &dst.FieldList{List: []*dst.Field{{Type: id7}, {Type: id8}}} + params = &dst.FieldList{List: []*dst.Field{{Type: id3}, {Type: id4}}} + results = &dst.FieldList{List: []*dst.Field{{Type: id5}, {Type: id6}}} assign1 = &dst.AssignStmt{Lhs: []dst.Expr{id1}} assign2 = &dst.AssignStmt{Lhs: []dst.Expr{id2}} @@ -449,7 +452,11 @@ func TestFn(t *testing.T) { decs := dst.FuncDeclDecorations{NodeDecs: dst.NodeDecs{Before: dst.EmptyLine}} expected := &dst.FuncDecl{ Name: dst.NewIdent("fn1"), - Type: &dst.FuncType{Params: params, Results: results}, + Type: &dst.FuncType{ + Params: params, + Results: results, + TypeParams: typeParams, + }, Recv: &dst.FieldList{List: []*dst.Field{{Type: id1}, {Type: id2}}}, Body: &dst.BlockStmt{List: []dst.Stmt{assign1, assign2}}, Decs: decs, @@ -458,6 +465,7 @@ func TestFn(t *testing.T) { // ACT actual := ast.Fn("fn1"). Recv(ast.Field(id1).Obj, ast.Field(id2).Obj). + TypeParams(typeParams). ParamList(params). ResultList(results). Body(assign1, assign2). @@ -627,7 +635,7 @@ func TestIncStmt(t *testing.T) { func TestIndex(t *testing.T) { t.Run("simple", func(t *testing.T) { // ASSEMBLE - expected := &dst.IndexExpr{X: id1} + expected := &dst.IndexListExpr{X: id1} // ACT actual := ast.Index(id1).Obj @@ -640,10 +648,10 @@ func TestIndex(t *testing.T) { t.Run("complete", func(t *testing.T) { // ASSEMBLE - expected := &dst.IndexExpr{X: id1, Index: id2} + expected := &dst.IndexListExpr{X: id1, Indices: []dst.Expr{id2, id3}} // ACT - actual := ast.Index(id1).Sub(id2).Obj + actual := ast.Index(id1).Sub(id2, id3).Obj // ASSERT if !reflect.DeepEqual(actual, expected) { @@ -1198,10 +1206,14 @@ func TestTypeSpec(t *testing.T) { t.Run("complete", func(t *testing.T) { // ASSEMBLE - expected := &dst.TypeSpec{Name: dst.NewIdent("typ"), Type: id2} + expected := &dst.TypeSpec{ + Name: dst.NewIdent("typ"), + Type: id2, + TypeParams: typeParams, + } // ACT - actual := ast.TypeSpec("typ").Type(id2).Obj + actual := ast.TypeSpec("typ").Type(id2).TypeParams(typeParams).Obj // ASSERT if !reflect.DeepEqual(actual, expected) { diff --git a/ast/testpkgs/export/generics.go b/ast/testpkgs/export/generics.go new file mode 100644 index 0000000..4b71bd4 --- /dev/null +++ b/ast/testpkgs/export/generics.go @@ -0,0 +1,21 @@ +package export + +type Generic[T any] struct{} + +func (g *Generic[T]) DoSomethingPtr() {} + +func (g *Generic[X]) DoSomethingElsePtr() {} + +func (g Generic[T]) DoSomething() {} + +func (g Generic[X]) DoSomethingElse() {} + +type GenericList[T any, V any] struct{} + +func (g *GenericList[T, V]) DoSomethingPtr() {} + +func (g *GenericList[X, Y]) DoSomethingElsePtr() {} + +func (g GenericList[T, V]) DoSomething() {} + +func (g GenericList[X, Y]) DoSomethingElse() {} diff --git a/ast/testpkgs/noexport/generics.go b/ast/testpkgs/noexport/generics.go new file mode 100644 index 0000000..f562aa1 --- /dev/null +++ b/ast/testpkgs/noexport/generics.go @@ -0,0 +1,21 @@ +package noexport + +type generic[T any] struct{} + +func (g *generic[T]) doSomethingPtr() {} + +func (g *generic[X]) doSomethingElsePtr() {} + +func (g generic[T]) doSomething() {} + +func (g generic[X]) doSomethingElse() {} + +type genericList[T any, V any] struct{} + +func (g *genericList[T, V]) doSomethingPtr() {} + +func (g *genericList[X, Y]) doSomethingElsePtr() {} + +func (g genericList[T, V]) doSomething() {} + +func (g genericList[X, Y]) doSomethingElse() {} diff --git a/generator/converter.go b/generator/converter.go index 42766fe..a4ac634 100644 --- a/generator/converter.go +++ b/generator/converter.go @@ -153,7 +153,7 @@ func (c *Converter) BaseDecls() ([]dst.Decl, error) { fields := []*dst.Field{ Field(Star(c.idPath(sceneType, moqPkg))).Names(c.exportId(sceneIdent)).Obj, Field(c.idPath(configType, moqPkg)).Names(c.exportId(configIdent)).Obj, - Field(Star(Id(moqName))).Names(c.exportId(moqIdent)). + Field(Star(c.genericExpr(Id(moqName), clone))).Names(c.exportId(moqIdent)). Decs(FieldDecs(dst.None, dst.EmptyLine).Obj).Obj, } @@ -165,7 +165,8 @@ func (c *Converter) BaseDecls() ([]dst.Decl, error) { fieldSuffix = sep + fn.Name } fields = append(fields, - Field(SliceType(Idf(double, typePrefix, resultsByParamsIdent))). + Field(SliceType(c.genericExpr(Idf( + double, typePrefix, resultsByParamsIdent), clone))). Names(c.exportId(resultsByParamsIdent+fieldSuffix)).Obj) } @@ -188,8 +189,10 @@ func (c *Converter) BaseDecls() ([]dst.Decl, error) { if c.typ.TypeInfo.Fabricated { id = Id(id.Name) } - decls = append(decls, VarDecl(Value(id).Names(Id(blankIdent)). - Values(Call(Paren(Star(Id(moqName)))).Args(Id(nilIdent)).Obj).Obj). + decls = append(decls, VarDecl( + Value(c.genericExpr(id, typeAssertSafe)).Names(Id(blankIdent)). + Values(Call(Paren(Star(c.genericExpr(Id(moqName), typeAssertSafe)))). + Args(Id(nilIdent)).Obj).Obj). Decs(genDeclDec("// The following type assertion assures"+ " that %s is mocked completely", idStr)).Obj, ) @@ -209,7 +212,8 @@ func (c *Converter) BaseDecls() ([]dst.Decl, error) { typeName, msg)).Obj) } - decls = append(decls, TypeDecl(TypeSpec(mName).Type(Struct(fields...)).Obj). + decls = append(decls, TypeDecl( + TypeSpec(mName).Type(Struct(fields...)).TypeParams(c.typeParams()).Obj). Decs(genDeclDec("// %s holds the state of a moq of the %s type", mName, typeName)).Obj) @@ -225,8 +229,8 @@ func (c *Converter) IsolationStruct(suffix string) (*dst.GenDecl, error) { mName := c.moqName() iName := fmt.Sprintf(double, mName, suffix) - decl := TypeDecl(TypeSpec(iName).Type(Struct(Field(Star(Id(mName))). - Names(c.exportId(moqIdent)).Obj)).Obj). + iStruct := TypeDecl(TypeSpec(iName).Type(Struct(Field(Star(c.genericExpr(Id(mName), clone))). + Names(c.exportId(moqIdent)).Obj)).TypeParams(c.typeParams()).Obj). Decs(genDeclDec("// %s isolates the %s interface of the %s type", iName, suffix, c.typ.TypeInfo.Type.Name.Name)).Obj @@ -234,7 +238,7 @@ func (c *Converter) IsolationStruct(suffix string) (*dst.GenDecl, error) { return nil, c.err } - return decl, nil + return iStruct, nil } // MethodStructs generates a structure for storing a set of parameters or @@ -266,23 +270,24 @@ func (c *Converter) NewFunc() (*dst.FuncDecl, error) { mName := c.moqName() decl := Fn(fnName). + TypeParams(c.typeParams()). Params( Field(Star(c.idPath(sceneType, moqPkg))).Names(Id(sceneIdent)).Obj, Field(Star(c.idPath(configType, moqPkg))).Names(Id(configIdent)).Obj, ). - Results(Field(Star(Id(mName))).Obj). + Results(Field(Star(c.genericExpr(Id(mName), clone))).Obj). Body( If(Bin(Id(configIdent)).Op(token.EQL).Y(Id(nilIdent)).Obj).Body( Assign(Id(configIdent)).Tok(token.ASSIGN).Rhs(Un(token.AND, Comp(c.idPath(configType, moqPkg)).Obj)).Obj).Obj, Assign(Id(moqReceiverIdent)).Tok(token.DEFINE). - Rhs(Un(token.AND, Comp(Id(mName)).Elts( + Rhs(Un(token.AND, Comp(c.genericExpr(Id(mName), clone)).Elts( Key(c.exportId(sceneIdent)). Value(Id(sceneIdent)).Decs(kvExprDec(dst.None)).Obj, Key(c.exportId(configIdent)). Value(Star(Id(configIdent))).Decs(kvExprDec(dst.None)).Obj, Key(c.exportId(moqIdent)). - Value(Un(token.AND, Comp(Id(fmt.Sprintf(double, mName, mockIdent))).Obj)).Obj, + Value(Un(token.AND, Comp(c.genericExpr(Id(fmt.Sprintf(double, mName, mockIdent)), clone)).Obj)).Obj, Key(c.exportId(runtimeIdent)). Value(Comp(c.runtimeStruct()). Elts(c.runtimeValues()...).Obj).Decs(kvExprDec(dst.None)). @@ -311,12 +316,12 @@ func (c *Converter) NewFunc() (*dst.FuncDecl, error) { // IsolationAccessor generates a function to access an isolation interface func (c *Converter) IsolationAccessor(suffix, fnName string) (*dst.FuncDecl, error) { mName := c.moqName() - id := Id(fmt.Sprintf(double, mName, suffix)) + iName := c.genericExpr(Id(fmt.Sprintf(double, mName, suffix)), clone) var retVal dst.Expr retVal = Sel(Id(moqReceiverIdent)).Dot(c.exportId(moqIdent)).Obj if fnName != mockFnName { - retVal = Un(token.AND, Comp(cloneExpr(id)).Elts( + retVal = Un(token.AND, Comp(cloneExpr(iName)).Elts( Key(c.exportId(moqIdent)).Value(Id(moqReceiverIdent)). Decs(kvExprDec(dst.None)).Obj).Decs(litDec()).Obj, ) @@ -324,8 +329,8 @@ func (c *Converter) IsolationAccessor(suffix, fnName string) (*dst.FuncDecl, err fnName = c.export(fnName) decl := Fn(fnName). - Recv(Field(Star(Id(mName))).Names(Id(moqReceiverIdent)).Obj). - Results(Field(Star(id)).Obj). + Recv(Field(Star(c.genericExpr(Id(mName), clone))).Names(Id(moqReceiverIdent)).Obj). + Results(Field(Star(iName)).Obj). Body(Return(retVal)). Decs(fnDeclDec("// %s returns the %s implementation of the %s type", fnName, suffix, c.typ.TypeInfo.Type.Name.Name)).Obj @@ -356,14 +361,14 @@ func (c *Converter) FuncClosure(fn Func) (*dst.FuncDecl, error) { } decl := Fn(c.export(mockFnName)). - Recv(Field(Star(Id(mName))).Names(Id(moqReceiverIdent)).Obj). - Results(Field(resType).Obj). + Recv(Field(Star(c.genericExpr(Id(mName), clone))).Names(Id(moqReceiverIdent)).Obj). + Results(Field(c.genericExpr(resType, clone)).Obj). Body(Return(FnLit(FnType(c.cloneAndNameUnnamed(paramPrefix, fn.FuncType.Params, fn.ParentType)). Results(c.cloneFieldList(fn.FuncType.Results, true, fn.ParentType)).Obj). Body(c.helperCallExpr(Id(moqReceiverIdent)), Assign(Id(moqIdent)).Tok(token.DEFINE).Rhs(Un( token.AND, - Comp(Idf(double, mName, mockIdent)). + Comp(c.genericExpr(Idf(double, mName, mockIdent), clone)). Elts(Key(c.exportId(moqIdent)). Value(Id(moqReceiverIdent)).Obj).Obj, )).Obj, @@ -392,7 +397,7 @@ func (c *Converter) MockMethod(fn Func) (*dst.FuncDecl, error) { } decl := Fn(fnName). - Recv(Field(Star(Id(fmt.Sprintf(double, mName, mockIdent)))).Names(Id(moqReceiverIdent)).Obj). + Recv(Field(Star(c.genericExpr(Id(fmt.Sprintf(double, mName, mockIdent)), clone))).Names(Id(moqReceiverIdent)).Obj). ParamList(c.cloneAndNameUnnamed(paramPrefix, fn.FuncType.Params, fn.ParentType)). ResultList(c.cloneAndNameUnnamed(resultPrefix, fn.FuncType.Results, fn.ParentType)). Body(c.mockFunc(typePrefix, fieldSuffix, fn)...). @@ -445,7 +450,7 @@ func (c *Converter) ResetMethod() (*dst.FuncDecl, error) { } decl := Fn(resetFnName). - Recv(Field(Star(Id(c.moqName()))).Names(Id(moqReceiverIdent)).Obj). + Recv(Field(Star(c.genericExpr(Id(c.moqName()), clone))).Names(Id(moqReceiverIdent)).Obj). Body(stmts...). Decs(fnDeclDec("// %s resets the state of the moq", resetFnName)).Obj @@ -502,7 +507,7 @@ func (c *Converter) AssertMethod() (*dst.FuncDecl, error) { } decl := Fn(assertFnName). - Recv(Field(Star(Id(c.moqName()))).Names(Id(moqReceiverIdent)).Obj). + Recv(Field(Star(c.genericExpr(Id(c.moqName()), clone))).Names(Id(moqReceiverIdent)).Obj). Body(stmts...). Decs(fnDeclDec("// %s asserts that all expectations have been met", assertFnName)).Obj @@ -646,7 +651,7 @@ func (c *Converter) paramsStructDecl( } structName := fmt.Sprintf(double, prefix, label) - return TypeDecl(TypeSpec(structName).Type(mStruct).Obj). + return TypeDecl(TypeSpec(structName).Type(mStruct).TypeParams(c.typeParams()).Obj). Decs(genDeclDec("// %s holds the %s of the %s type", structName, goDocDesc, c.typ.TypeInfo.Type.Name.Name)).Obj } @@ -725,10 +730,10 @@ func (c *Converter) resultByParamsStruct(prefix string) *dst.GenDecl { return TypeDecl(TypeSpec(structName).Type(Struct( Field(Id(intType)).Names(c.exportId(anyCountIdent)).Obj, Field(Id("uint64")).Names(c.exportId(anyParamsIdent)).Obj, - Field(MapType(Id(c.export(fmt.Sprintf(double, prefix, paramsKeyIdent)))). - Value(Star(Idf(double, prefix, resultsIdent))).Obj, + Field(MapType(c.genericExpr(Id(c.export(fmt.Sprintf(double, prefix, paramsKeyIdent))), clone)). + Value(Star(c.genericExpr(Idf(double, prefix, resultsIdent), clone))).Obj, ).Names(c.exportId(resultsIdent)).Obj, - )).Obj).Decs(genDeclDec( + )).TypeParams(c.typeParams()).Obj).Decs(genDeclDec( "// %s contains the results for a given set of parameters for the %s type", structName, c.typ.TypeInfo.Type.Name.Name)).Obj @@ -737,7 +742,8 @@ func (c *Converter) resultByParamsStruct(prefix string) *dst.GenDecl { func (c *Converter) doFuncType(prefix string, params *dst.FieldList, parentType TypeInfo) *dst.GenDecl { fnName := fmt.Sprintf(double, prefix, doFnIdent) return TypeDecl(TypeSpec(fnName). - Type(FnType(c.cloneFieldList(params, false, parentType)).Obj).Obj). + Type(FnType(c.cloneFieldList(params, false, parentType)).Obj). + TypeParams(c.typeParams()).Obj). Decs(genDeclDec( "// %s defines the type of function needed when calling %s for the %s type", fnName, @@ -749,7 +755,8 @@ func (c *Converter) doReturnFuncType(prefix string, fn Func) *dst.GenDecl { fnName := fmt.Sprintf(double, prefix, doReturnFnIdent) return TypeDecl(TypeSpec(fnName). Type(FnType(c.cloneFieldList(fn.FuncType.Params, false, fn.ParentType)). - Results(c.cloneFieldList(fn.FuncType.Results, false, fn.ParentType)).Obj).Obj). + Results(c.cloneFieldList(fn.FuncType.Results, false, fn.ParentType)).Obj). + TypeParams(c.typeParams()).Obj). Decs(genDeclDec( "// %s defines the type of function needed when calling %s for the %s type", fnName, @@ -761,15 +768,17 @@ func (c *Converter) resultsStruct(prefix string, results *dst.FieldList, parentT structName := fmt.Sprintf(double, prefix, resultsIdent) return TypeDecl(TypeSpec(structName).Type(Struct( - Field(Idf(double, prefix, paramsIdent)). + Field(c.genericExpr(Idf(double, prefix, paramsIdent), clone)). Names(c.exportId(paramsIdent)).Obj, Field(SliceType(c.innerResultsStruct(prefix, results, parentType))). Names(c.exportId(resultsIdent)).Obj, Field(Id("uint32")).Names(c.exportId(indexIdent)).Obj, - Field(Star(c.idPath(repeatValType, moqPkg))).Names(c.exportId(repeatIdent)).Obj, - )).Obj).Decs(genDeclDec("// %s holds the results of the %s type", - structName, - c.typ.TypeInfo.Type.Name.Name)).Obj + Field(Star(c.idPath(repeatValType, moqPkg))). + Names(c.exportId(repeatIdent)).Obj, + )).TypeParams(c.typeParams()).Obj). + Decs(genDeclDec("// %s holds the results of the %s type", + structName, + c.typ.TypeInfo.Type.Name.Name)).Obj } func (c *Converter) innerResultsStruct(prefix string, results *dst.FieldList, parentType TypeInfo) *dst.StructType { @@ -777,9 +786,9 @@ func (c *Converter) innerResultsStruct(prefix string, results *dst.FieldList, pa Field(Star(c.methodStruct(resultsIdent, results, parentType))). Names(c.exportId(valuesIdent)).Obj, Field(Id("uint32")).Names(c.exportId(sequenceIdent)).Obj, - Field(Idf(double, prefix, doFnIdent)). + Field(c.genericExpr(Idf(double, prefix, doFnIdent), clone)). Names(c.exportId(doFnIdent)).Obj, - Field(Idf(double, prefix, doReturnFnIdent)). + Field(c.genericExpr(Idf(double, prefix, doReturnFnIdent), clone)). Names(c.exportId(doReturnFnIdent)).Obj, ) } @@ -788,23 +797,21 @@ func (c *Converter) fnRecorderStruct(prefix string) *dst.GenDecl { mName := c.moqName() structName := fmt.Sprintf(double, prefix, fnRecorderSuffix) return TypeDecl(TypeSpec(structName).Type(Struct( - Field(Idf(double, prefix, paramsIdent)). - Names(c.exportId(paramsIdent)).Obj, + Field(c.genericExpr(Idf(double, prefix, paramsIdent), clone)).Names(c.exportId(paramsIdent)).Obj, Field(Id("uint64")).Names(c.exportId(anyParamsIdent)).Obj, Field(Id("bool")).Names(c.exportId(sequenceIdent)).Obj, - Field(Star(Idf(double, prefix, resultsIdent))). - Names(c.exportId(resultsIdent)).Obj, - Field(Star(Id(mName))). - Names(c.exportId(moqIdent)).Obj, - )).Obj).Decs(genDeclDec("// %s routes recorded function calls to the %s moq", + Field(Star(c.genericExpr(Idf(double, prefix, resultsIdent), clone))).Names(c.exportId(resultsIdent)).Obj, + Field(Star(c.genericExpr(Id(mName), clone))).Names(c.exportId(moqIdent)).Obj, + )).TypeParams(c.typeParams()).Obj).Decs(genDeclDec( + "// %s routes recorded function calls to the %s moq", structName, mName)).Obj } func (c *Converter) anyParamsStruct(prefix string) *dst.GenDecl { structName := fmt.Sprintf(double, prefix, anyParamsIdent) return TypeDecl(TypeSpec(structName).Type(Struct( - Field(Star(Id(fmt.Sprintf(double, prefix, fnRecorderSuffix)))). - Names(c.exportId(recorderIdent)).Obj)).Obj). + Field(Star(c.genericExpr(Id(fmt.Sprintf(double, prefix, fnRecorderSuffix)), clone))). + Names(c.exportId(recorderIdent)).Obj)).TypeParams(c.typeParams()).Obj). Decs(genDeclDec("// %s isolates the any params functions of the %s type", structName, c.typ.TypeInfo.Type.Name.Name)).Obj } @@ -822,10 +829,10 @@ func (c *Converter) mockFunc(typePrefix, fieldSuffix string, fn Func) []dst.Stmt c.helperCallExpr(Sel(Id(moqReceiverIdent)).Dot(c.exportId(moqIdent)).Obj), Assign(Id(paramsIdent)). Tok(token.DEFINE). - Rhs(Comp(Idf(double, typePrefix, paramsIdent)). + Rhs(Comp(c.genericExpr(Idf(double, typePrefix, paramsIdent), clone)). Elts(c.passthroughElements( fn.FuncType.Params, paramsIdent, "", fn.ParentType)...).Obj).Obj, - Var(Value(Star(Idf(double, typePrefix, resultsIdent))). + Var(Value(Star(c.genericExpr(Idf(double, typePrefix, resultsIdent), clone))). Names(Id(resultsIdent)).Obj), Range(Sel(cloneExpr(stateSelector)). Dot(c.exportId(resultsByParamsIdent+fieldSuffix)).Obj). @@ -977,9 +984,9 @@ func (c *Converter) recorderFn(fn Func) *dst.FuncDecl { } return Fn(fnName). - Recv(Field(Star(Id(recvType))).Names(Id(moqReceiverIdent)).Obj). + Recv(Field(Star(c.genericExpr(Id(recvType), clone))).Names(Id(moqReceiverIdent)).Obj). ParamList(c.cloneAndNameUnnamed(paramPrefix, fn.FuncType.Params, fn.ParentType)). - Results(Field(Star(Id(fnRecName))).Obj). + Results(Field(Star(c.genericExpr(Id(fnRecName), clone))).Obj). Body(c.recorderFnInterfaceBody(fnRecName, c.typePrefix(fn), moqVal, fn)...). Decs(stdFuncDec()).Obj } @@ -989,9 +996,10 @@ func (c *Converter) recorderFnInterfaceBody( ) []dst.Stmt { return []dst.Stmt{Return(Un( token.AND, - Comp(Id(fnRecName)). + Comp(c.genericExpr(Id(fnRecName), clone)). Elts( - Key(c.exportId(paramsIdent)).Value(Comp(Idf(double, typePrefix, paramsIdent)). + Key(c.exportId(paramsIdent)).Value(Comp( + c.genericExpr(Idf(double, typePrefix, paramsIdent), clone)). Elts(c.passthroughElements( fn.FuncType.Params, paramsIdent, "", fn.ParentType)...).Obj, ).Decs(kvExprDec(dst.None)).Obj, @@ -1039,8 +1047,9 @@ func (c *Converter) anyParamAnyFn(fn Func, anyParamsName, fnRecName string) *dst moqSel := Sel(Id(recorderReceiverIdent)).Dot(c.exportId(moqIdent)).Obj return Fn(c.export("any")). - Recv(Field(Star(Id(fnRecName))).Names(Id(recorderReceiverIdent)).Obj). - Results(Field(Star(Id(anyParamsName))).Obj). + Recv(Field(Star(c.genericExpr(Id(fnRecName), clone))). + Names(Id(recorderReceiverIdent)).Obj). + Results(Field(Star(c.genericExpr(Id(anyParamsName), clone))).Obj). Body( c.helperCallExpr(Sel(Id(recorderReceiverIdent)).Dot(c.exportId(moqIdent)).Obj), If(Bin(Sel(Id(recorderReceiverIdent)).Dot(c.exportId(resultsIdent)).Obj). @@ -1058,16 +1067,17 @@ func (c *Converter) anyParamAnyFn(fn Func, anyParamsName, fnRecName string) *dst Return(Id(nilIdent))).Obj, Return(Un( token.AND, - Comp(Id(anyParamsName)).Elts(Key(c.exportId(recorderIdent)). - Value(Id(recorderReceiverIdent)).Obj).Obj)), + Comp(cloneExpr(c.genericExpr(Id(anyParamsName), clone))). + Elts(Key(c.exportId(recorderIdent)). + Value(Id(recorderReceiverIdent)).Obj).Obj)), ). Decs(stdFuncDec()).Obj } func (c *Converter) anyParamFn(anyParamsName, fnRecName, pName string, paramPos int) *dst.FuncDecl { return Fn(c.export(pName)). - Recv(Field(Star(Id(anyParamsName))).Names(Id(anyParamsReceiverIdent)).Obj). - Results(Field(Star(Id(fnRecName))).Obj). + Recv(Field(Star(c.genericExpr(Id(anyParamsName), clone))).Names(Id(anyParamsReceiverIdent)).Obj). + Results(Field(Star(c.genericExpr(Id(fnRecName), clone))).Obj). Body( Assign(Sel(Sel(Id(anyParamsReceiverIdent)). Dot(c.exportId(recorderIdent)).Obj). @@ -1108,9 +1118,9 @@ func (c *Converter) returnFn( resStruct := c.innerResultsStruct(c.typePrefix(fn), fn.FuncType.Results, fn.ParentType) return Fn(c.export(fnName)). - Recv(Field(Star(Id(fnRecName))).Names(Id(recorderReceiverIdent)).Obj). + Recv(Field(Star(c.genericExpr(Id(fnRecName), clone))).Names(Id(recorderReceiverIdent)).Obj). ParamList(params). - Results(Field(Star(Id(fnRecName))).Obj). + Results(Field(Star(c.genericExpr(Id(fnRecName), clone))).Obj). Body( c.helperCallExpr(Sel(Id(recorderReceiverIdent)).Dot(c.exportId(moqIdent)).Obj), Expr(Call(Sel(Id(recorderReceiverIdent)). @@ -1150,9 +1160,9 @@ func (c *Converter) andDoFn(fn Func) *dst.FuncDecl { fnName := fmt.Sprintf(double, typePrefix, doFnIdent) return Fn(c.export(andDoFnName)). - Recv(Field(Star(Id(fnRecName))).Names(Id(recorderReceiverIdent)).Obj). - Params(Field(Id(fnName)).Names(Id(fnFnName)).Obj). - Results(Field(Star(Id(fnRecName))).Obj).Body( + Recv(Field(Star(c.genericExpr(Id(fnRecName), clone))).Names(Id(recorderReceiverIdent)).Obj). + Params(Field(c.genericExpr(Id(fnName), clone)).Names(Id(fnFnName)).Obj). + Results(Field(Star(c.genericExpr(Id(fnRecName), clone))).Obj).Body( c.helperCallExpr(Sel(Id(recorderReceiverIdent)).Dot(c.exportId(moqIdent)).Obj), If(Bin(Sel(Id(recorderReceiverIdent)). Dot(c.exportId(resultsIdent)).Obj). @@ -1175,7 +1185,7 @@ func (c *Converter) andDoFn(fn Func) *dst.FuncDecl { func (c *Converter) doReturnResultsFn(fn Func) *dst.FuncDecl { typePrefix := c.typePrefix(fn) fnName := fmt.Sprintf(double, typePrefix, doReturnFnIdent) - params := FieldList(Field(Id(fnName)).Names(Id(fnFnName)).Obj) + params := FieldList(Field(c.genericExpr(Id(fnName), clone)).Names(Id(fnFnName)).Obj) resExprs := []dst.Expr{ Key(c.exportId(sequenceIdent)).Value(Id(sequenceIdent)).Obj, Key(c.exportId(doReturnFnIdent)).Value(Id(fnFnName)).Obj, @@ -1215,7 +1225,7 @@ func (c *Converter) findResultsFn(fn Func) *dst.FuncDecl { body = append(body, cloneStmt(incrRepeat)) return Fn(c.export(findResultsFnName)). - Recv(Field(Star(Id(fnRecName))).Names(Id(recorderReceiverIdent)).Obj). + Recv(Field(Star(c.genericExpr(Id(fnRecName), clone))).Names(Id(recorderReceiverIdent)).Obj). Body(body...).Decs(stdFuncDec()).Obj } @@ -1244,7 +1254,7 @@ func (c *Converter) findRecorderResults(fn Func) []dst.Stmt { Sel(Id(recorderReceiverIdent)). Dot(c.exportId(anyParamsIdent)).Obj).Obj).Obj, Assign(Id(insertAtIdent)).Tok(token.DEFINE).Rhs(LitInt(-1)).Obj, - Var(Value(Star(Id(resultsByParamsType))). + Var(Value(Star(c.genericExpr(Id(resultsByParamsType), clone))). Names(Id(resultsIdent)).Obj), Range(c.selExport(moqSel, resultsByParams)). Key(Id(nIdent)). @@ -1270,15 +1280,16 @@ func (c *Converter) findRecorderResults(fn Func) []dst.Stmt { ).Obj, If(Bin(Id(resultsIdent)).Op(token.EQL).Y(Id(nilIdent)).Obj).Body( Assign(Id(resultsIdent)).Tok(token.ASSIGN).Rhs(Un( - token.AND, Comp(Id(resultsByParamsType)).Elts( + token.AND, Comp(c.genericExpr(Id(resultsByParamsType), clone)).Elts( Key(c.exportId(anyCountIdent)).Value(Id(anyCountIdent)). Decs(kvExprDec(dst.NewLine)).Obj, Key(c.exportId(anyParamsIdent)). Value(Sel(Id(recorderReceiverIdent)). Dot(c.exportId(anyParamsIdent)).Obj). Decs(kvExprDec(dst.None)).Obj, - Key(c.exportId(resultsIdent)).Value(Comp(MapType(Id(paramsKey)). - Value(Star(Id(results))).Obj).Obj). + Key(c.exportId(resultsIdent)).Value(Comp( + MapType(c.genericExpr(Id(paramsKey), clone)). + Value(Star(c.genericExpr(Id(results), clone))).Obj).Obj). Decs(kvExprDec(dst.NewLine)).Obj, ).Obj)).Obj, Assign(c.selExport(moqSel, resultsByParams)). @@ -1320,7 +1331,7 @@ func (c *Converter) findRecorderResults(fn Func) []dst.Stmt { Tok(token.ASSIGN). Rhs(Un( token.AND, - Comp(c.exportId(results)). + Comp(c.genericExpr(c.exportId(results), clone)). Elts( Key(c.exportId(paramsIdent)). Value(Sel(Id(recorderReceiverIdent)). @@ -1365,9 +1376,9 @@ func (c *Converter) recorderRepeatFn(fn Func) *dst.FuncDecl { ).Obj return Fn(c.export(repeatFnName)). - Recv(Field(Star(Id(fnRecName))).Names(Id(recorderReceiverIdent)).Obj). + Recv(Field(Star(c.genericExpr(Id(fnRecName), clone))).Names(Id(recorderReceiverIdent)).Obj). Params(Field(Ellipsis(c.idPath(repeaterType, moqPkg))).Names(Id(repeatersIdent)).Obj). - Results(Field(Star(Id(fnRecName))).Obj). + Results(Field(Star(c.genericExpr(Id(fnRecName), clone))).Obj). Body( c.helperCallExpr(Sel(Id(recorderReceiverIdent)).Dot(c.exportId(moqIdent)).Obj), If(Bin(Sel(Id(recorderReceiverIdent)). @@ -1454,8 +1465,8 @@ func (c *Converter) prettyParamsFn(fn Func) *dst.FuncDecl { sfmt += ")" pExprs = append([]dst.Expr{LitString(sfmt)}, pExprs...) return Fn(c.export(fnName)). - Recv(Field(Star(Id(mName))).Names(Id(moqReceiverIdent)).Obj). - Params(Field(Id(params)).Names(Id(paramsIdent)).Obj). + Recv(Field(Star(c.genericExpr(Id(mName), clone))).Names(Id(moqReceiverIdent)).Obj). + Params(Field(c.genericExpr(Id(params), clone)).Names(Id(paramsIdent)).Obj). Results(Field(Id("string")).Obj). Body(Return( Call(IdPath("Sprintf", "fmt")). @@ -1502,7 +1513,7 @@ func (c *Converter) paramsKeyFn(fn Func) *dst.FuncDecl { fnName = paramsKeyFnName } - stmts = append(stmts, Return(Comp(Id(paramsKey)).Elts( + stmts = append(stmts, Return(Comp(c.genericExpr(Id(paramsKey), clone)).Elts( Key(c.exportId(paramsIdent)).Value(Comp( c.methodStruct(paramsKeyIdent, fn.FuncType.Params, fn.ParentType)). Elts(c.passthroughElements( @@ -1515,10 +1526,10 @@ func (c *Converter) paramsKeyFn(fn Func) *dst.FuncDecl { Decs(kvExprDec(dst.NewLine)).Obj).Obj)) return Fn(c.export(fnName)). - Recv(Field(Star(Id(mName))).Names(Id(moqReceiverIdent)).Obj). - Params(Field(Id(params)).Names(Id(paramsIdent)).Obj, + Recv(Field(Star(c.genericExpr(Id(mName), clone))).Names(Id(moqReceiverIdent)).Obj). + Params(Field(c.genericExpr(Id(params), clone)).Names(Id(paramsIdent)).Obj, Field(Id("uint64")).Names(Id(anyParamsIdent)).Obj). - Results(Field(Id(paramsKey)).Obj). + Results(Field(c.genericExpr(Id(paramsKey), clone)).Obj). Body(stmts...). Decs(stdFuncDec()).Obj } @@ -1629,8 +1640,8 @@ func (c *Converter) recorderSeqFn(fn Func, fnName, assign string) *dst.FuncDecl fnName = c.export(fnName) return Fn(fnName). - Recv(Field(Star(Id(fnRecName))).Names(Id(recorderReceiverIdent)).Obj). - Results(Field(Star(Id(fnRecName))).Obj). + Recv(Field(Star(c.genericExpr(Id(fnRecName), clone))).Names(Id(recorderReceiverIdent)).Obj). + Results(Field(Star(c.genericExpr(Id(fnRecName), clone))).Obj). Body( c.helperCallExpr(Sel(Id(recorderReceiverIdent)).Dot(c.exportId(moqIdent)).Obj), If(Bin(Sel(Id(recorderReceiverIdent)). @@ -1659,6 +1670,46 @@ func (c *Converter) recorderSeqFn(fn Func, fnName, assign string) *dst.FuncDecl ).Decs(stdFuncDec()).Obj } +func (c *Converter) typeParams() *dst.FieldList { + return c.cloneFieldList(c.typ.TypeInfo.Type.TypeParams, false, c.typ.TypeInfo) +} + +type genericExprMode int + +const ( + // clone clones the generic expression as-is + clone genericExprMode = iota + // typeAssertSafe makes the expression safe for use in a type assertion + // (omitNames is implied) + typeAssertSafe +) + +func (c *Converter) genericExpr(in dst.Expr, mode genericExprMode) dst.Expr { + if c.typ.TypeInfo.Type.TypeParams == nil || len(c.typ.TypeInfo.Type.TypeParams.List) == 0 { + return in + } + + var subs []dst.Expr + for _, p := range c.typ.TypeInfo.Type.TypeParams.List { + for _, n := range p.Names { + var sub dst.Expr + if mode == clone { + sub = Id(n.Name) + } else { + sub = cloneExpr(p.Type) + if mode == typeAssertSafe { + if un, ok := sub.(*dst.UnaryExpr); ok && un.Op == token.TILDE { + sub = un.X + } + } + } + subs = append(subs, c.resolveExpr(sub, c.typ.TypeInfo)) + } + } + + return Index(in).Sub(subs...).Obj +} + func (c *Converter) callPrettyParams(fn Func, moqExpr, paramsExpr dst.Expr) *dst.CallExpr { prettyParamsFn := prettyParamsFnName if fn.Name != "" { @@ -1918,6 +1969,17 @@ func (c *Converter) resolveExpr(expr dst.Expr, parentType TypeInfo) dst.Expr { case *dst.Ellipsis: e.Elt = c.resolveExpr(e.Elt, parentType) case *dst.Ident: + if e.Path == "" && c.typ.TypeInfo.Type.TypeParams != nil { + // Priority is always highest for type params + for _, f := range c.typ.TypeInfo.Type.TypeParams.List { + for _, n := range f.Names { + if n.Name == e.Name { + // So just use the name as is with no path + return e + } + } + } + } typ, err := c.typeCache.Type(*e, parentType.PkgPath, false) if err != nil { if c.err == nil { diff --git a/generator/generator_test.go b/generator/generator_test.go index 5987e9f..c80659b 100644 --- a/generator/generator_test.go +++ b/generator/generator_test.go @@ -55,7 +55,19 @@ func TestGenerating(t *testing.T) { "PassByValueFn", "InterfaceParamFn", "InterfaceResultFn", + "GenericParamsFn", + "PartialGenericParamsFn", + "GenericResultsFn", + "PartialGenericResultsFn", + "GenericInterfaceParamFn", + "GenericInterfaceResultFn", "Usual", + "GenericParams", + "PartialGenericParams", + "GenericResults", + "PartialGenericResults", + "GenericInterfaceParam", + "GenericInterfaceResult", } err := generator.Generate( diff --git a/generator/moqgen.go b/generator/moqgen.go index 10c7bac..cca07d6 100644 --- a/generator/moqgen.go +++ b/generator/moqgen.go @@ -219,6 +219,7 @@ func (g *MoqGenerator) outPackagePath(req GenerateRequest, relPath string) (stri destDir = filepath.Join(destDir, req.Destination) } if strings.HasSuffix(destDir, ".go") { + // TODO: maybe should be more definitive as in always call filepath.Dir if Destination is defined destDir = filepath.Dir(destDir) } outPkgPath, err := g.typeCache.FindPackage(destDir) @@ -227,6 +228,13 @@ func (g *MoqGenerator) outPackagePath(req GenerateRequest, relPath string) (stri } if req.Package == "" || req.Package == "." { if !req.Export { + // TODO: Just because the package wasn't specified and the mock + // isn't going to be exported, we assume the mock is going in + // the test package? What if someone is putting their tests in + // the regular package? Maybe they should specify the package + // instead of leaving it blank and maybe this is a non-issue. + // Make sure this is documented properly at least (and maybe + // leave an explanatory comment here in place of this TODO). outPkgPath += testPkgSuffix } } else { @@ -321,8 +329,8 @@ func (g *MoqGenerator) findFuncs(tInfo ast.TypeInfo, fInfo *funcInfo) error { } if fInfo.excludeNonExported && !fully { - return fmt.Errorf("%w: %s mocked type is not exported", - ErrNonExported, tInfo.Type.Name.String()) + return fmt.Errorf("%w: %s (%s) mocked type is not exported", + ErrNonExported, tInfo.Type.Name.String(), tInfo.PkgPath) } fInfo.funcs = append(fInfo.funcs, fn) diff --git a/generator/moqgen_test.go b/generator/moqgen_test.go index da8fb32..82fb8be 100644 --- a/generator/moqgen_test.go +++ b/generator/moqgen_test.go @@ -49,7 +49,15 @@ func TestMoqGenerator(t *testing.T) { getwdFnMoq = newMoqGetwdFunc(scene, nil) newConverterFnMoq = newMoqNewConverterFunc(scene, nil) converter1Moq = newMoqConverterer(scene, nil) + converter1Moq.runtime.parameterIndexing.MethodStructs.fn = moq.ParamIndexByHash + converter1Moq.runtime.parameterIndexing.MockMethod.fn = moq.ParamIndexByHash + converter1Moq.runtime.parameterIndexing.RecorderMethods.fn = moq.ParamIndexByHash + converter1Moq.runtime.parameterIndexing.FuncClosure.fn = moq.ParamIndexByHash converter2Moq = newMoqConverterer(scene, nil) + converter2Moq.runtime.parameterIndexing.MethodStructs.fn = moq.ParamIndexByHash + converter2Moq.runtime.parameterIndexing.MockMethod.fn = moq.ParamIndexByHash + converter2Moq.runtime.parameterIndexing.RecorderMethods.fn = moq.ParamIndexByHash + converter2Moq.runtime.parameterIndexing.FuncClosure.fn = moq.ParamIndexByHash gen = generator.New( typeCacheMoq.mock(), @@ -783,7 +791,7 @@ func TestMoqGenerator(t *testing.T) { }, "mocking a function": { typeInfo: &fnInfo, - errorMsg: "PublicFn mocked type is not exported", + errorMsg: "PublicFn (moqueries.org/cli/generator) mocked type is not exported", }, } { t.Run(name, func(t *testing.T) { @@ -1040,6 +1048,56 @@ func TestMoqGenerator(t *testing.T) { t.Errorf("got %s, wanted nothing", resp.OutPkgPath) } }) + + t.Run("mocking a function", func(t *testing.T) { + // ASSEMBLE + beforeEach(t) + defer afterEach(t) + + typeCacheMoq.onCall().FindPackage("."). + returnResults("destdir", nil) + getwdFnMoq.onCall().returnResults("/some-nice-path", nil) + + typeCacheMoq.onCall().Type(*ast.IdPath("MyFunc", "."), ".", false). + returnResults(fnInfo, nil) + typeCacheMoq.onCall().Type(*ast.IdPath("string", ""), genPkg, false). + returnResults(ast.TypeInfo{Exported: false}, nil) + req := generator.GenerateRequest{ + Types: []string{"MyFunc"}, + Export: true, + Destination: "file_test.go", + Package: "", + Import: ".", + TestImport: false, + WorkingDir: "/some-nice-path", + ExcludeNonExported: true, + } + + // ACT + resp, err := gen.Generate(req) + + // ASSERT + if err == nil { + t.Fatal("got no error, wanted error") + } + expectedMsg := fmt.Sprintf("non-exported types: PublicFn (%s) mocked type is not exported", + genPkg) + if err.Error() != expectedMsg { + t.Errorf("got %s, want %s", err.Error(), expectedMsg) + } + if !errors.Is(err, generator.ErrNonExported) { + t.Errorf("got %#v, want %#v", err, generator.ErrNonExported) + } + if resp.File != nil { + t.Errorf("got %#v, wanted nil", resp.File) + } + if resp.DestPath != "" { + t.Errorf("got %s, wanted nothing", resp.DestPath) + } + if resp.OutPkgPath != "" { + t.Errorf("got %s, wanted nothing", resp.OutPkgPath) + } + }) }) t.Run("successfully navigates type aliases", func(t *testing.T) { @@ -1616,10 +1674,10 @@ func TestMoqGenerator(t *testing.T) { typeCacheMoq.onCall().FindPackage(".").returnResults("thispkg", nil) getwdFnMoq.onCall().returnResults("/some-nice-path", nil) - fnInfo.Type.Name.Path = "where-the-fn-lives" + fnInfo.PkgPath = "where-the-fn-lives" typeCacheMoq.onCall().Type(*ast.IdPath("PublicFn", "."), ".", false). returnResults(fnInfo, nil) - typeCacheMoq.onCall().Type(*ast.IdPath("string", ""), genPkg, false). + typeCacheMoq.onCall().Type(*ast.IdPath("string", ""), "where-the-fn-lives", false). returnResults(ast.TypeInfo{Exported: true}, nil) fnFuncs := []generator.Func{{ FuncType: &dst.FuncType{Params: func1Params}, @@ -1628,7 +1686,7 @@ func TestMoqGenerator(t *testing.T) { newConverterFnMoq.onCall(generator.Type{ TypeInfo: ast.TypeInfo{ Type: fnInfo.Type, - PkgPath: genPkg, + PkgPath: "where-the-fn-lives", Exported: true, }, Funcs: fnFuncs, diff --git a/generator/testmoqs/exported/moq_exported_testmoqs.go b/generator/testmoqs/exported/moq_exported_testmoqs.go index cb6f705..081a294 100644 --- a/generator/testmoqs/exported/moq_exported_testmoqs.go +++ b/generator/testmoqs/exported/moq_exported_testmoqs.go @@ -7708,1683 +7708,5164 @@ func (m *MoqInterfaceResultFn) AssertExpectationsMet() { } } -// The following type assertion assures that testmoqs.Usual is mocked -// completely -var _ testmoqs.Usual = (*MoqUsual_mock)(nil) - -// MoqUsual holds the state of a moq of the Usual type -type MoqUsual struct { +// MoqGenericParamsFn holds the state of a moq of the GenericParamsFn type +type MoqGenericParamsFn[S, B any] struct { Scene *moq.Scene Config moq.Config - Moq *MoqUsual_mock + Moq *MoqGenericParamsFn_mock[S, B] - ResultsByParams_Usual []MoqUsual_Usual_resultsByParams - ResultsByParams_NoNames []MoqUsual_NoNames_resultsByParams - ResultsByParams_NoResults []MoqUsual_NoResults_resultsByParams - ResultsByParams_NoParams []MoqUsual_NoParams_resultsByParams - ResultsByParams_Nothing []MoqUsual_Nothing_resultsByParams - ResultsByParams_Variadic []MoqUsual_Variadic_resultsByParams - ResultsByParams_RepeatedIds []MoqUsual_RepeatedIds_resultsByParams - ResultsByParams_Times []MoqUsual_Times_resultsByParams - ResultsByParams_DifficultParamNames []MoqUsual_DifficultParamNames_resultsByParams - ResultsByParams_DifficultResultNames []MoqUsual_DifficultResultNames_resultsByParams - ResultsByParams_PassByArray []MoqUsual_PassByArray_resultsByParams - ResultsByParams_PassByChan []MoqUsual_PassByChan_resultsByParams - ResultsByParams_PassByEllipsis []MoqUsual_PassByEllipsis_resultsByParams - ResultsByParams_PassByMap []MoqUsual_PassByMap_resultsByParams - ResultsByParams_PassByReference []MoqUsual_PassByReference_resultsByParams - ResultsByParams_PassBySlice []MoqUsual_PassBySlice_resultsByParams - ResultsByParams_PassByValue []MoqUsual_PassByValue_resultsByParams - ResultsByParams_InterfaceParam []MoqUsual_InterfaceParam_resultsByParams - ResultsByParams_InterfaceResult []MoqUsual_InterfaceResult_resultsByParams - ResultsByParams_FnParam []MoqUsual_FnParam_resultsByParams - ResultsByParams_Other []MoqUsual_Other_resultsByParams + ResultsByParams []MoqGenericParamsFn_resultsByParams[S, B] Runtime struct { ParameterIndexing struct { - Usual struct { - SParam moq.ParamIndexing - BParam moq.ParamIndexing - } - NoNames struct { - Param1 moq.ParamIndexing - Param2 moq.ParamIndexing - } - NoResults struct { - SParam moq.ParamIndexing - BParam moq.ParamIndexing - } - NoParams struct{} - Nothing struct{} - Variadic struct { - Other moq.ParamIndexing - Args moq.ParamIndexing - } - RepeatedIds struct { - SParam1 moq.ParamIndexing - SParam2 moq.ParamIndexing - BParam moq.ParamIndexing - } - Times struct { - SParam moq.ParamIndexing - Times moq.ParamIndexing - } - DifficultParamNames struct { - Param1 moq.ParamIndexing - Param2 moq.ParamIndexing - Param3 moq.ParamIndexing - Param moq.ParamIndexing - Param5 moq.ParamIndexing - Param6 moq.ParamIndexing - Param7 moq.ParamIndexing - Param8 moq.ParamIndexing - Param9 moq.ParamIndexing - } - DifficultResultNames struct{} - PassByArray struct { - P moq.ParamIndexing - } - PassByChan struct { - P moq.ParamIndexing - } - PassByEllipsis struct { - P moq.ParamIndexing - } - PassByMap struct { - P moq.ParamIndexing - } - PassByReference struct { - P moq.ParamIndexing - } - PassBySlice struct { - P moq.ParamIndexing - } - PassByValue struct { - P moq.ParamIndexing - } - InterfaceParam struct { - W moq.ParamIndexing - } - InterfaceResult struct { - SParam moq.ParamIndexing - BParam moq.ParamIndexing - } - FnParam struct { - Fn moq.ParamIndexing - } - Other struct { - Param1 moq.ParamIndexing - } + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing } } - // MoqUsual_mock isolates the mock interface of the Usual type } -type MoqUsual_mock struct { - Moq *MoqUsual -} - -// MoqUsual_recorder isolates the recorder interface of the Usual type -type MoqUsual_recorder struct { - Moq *MoqUsual +// MoqGenericParamsFn_mock isolates the mock interface of the GenericParamsFn +// type +type MoqGenericParamsFn_mock[S, B any] struct { + Moq *MoqGenericParamsFn[S, B] } -// MoqUsual_Usual_params holds the params of the Usual type -type MoqUsual_Usual_params struct { - SParam string - BParam bool +// MoqGenericParamsFn_params holds the params of the GenericParamsFn type +type MoqGenericParamsFn_params[S, B any] struct { + Param1 S + Param2 B } -// MoqUsual_Usual_paramsKey holds the map key params of the Usual type -type MoqUsual_Usual_paramsKey struct { - Params struct { - SParam string - BParam bool - } +// MoqGenericParamsFn_paramsKey holds the map key params of the GenericParamsFn +// type +type MoqGenericParamsFn_paramsKey[S, B any] struct { + Params struct{} Hashes struct { - SParam hash.Hash - BParam hash.Hash + Param1 hash.Hash + Param2 hash.Hash } } -// MoqUsual_Usual_resultsByParams contains the results for a given set of -// parameters for the Usual type -type MoqUsual_Usual_resultsByParams struct { +// MoqGenericParamsFn_resultsByParams contains the results for a given set of +// parameters for the GenericParamsFn type +type MoqGenericParamsFn_resultsByParams[S, B any] struct { AnyCount int AnyParams uint64 - Results map[MoqUsual_Usual_paramsKey]*MoqUsual_Usual_results + Results map[MoqGenericParamsFn_paramsKey[S, B]]*MoqGenericParamsFn_results[S, B] } -// MoqUsual_Usual_doFn defines the type of function needed when calling AndDo -// for the Usual type -type MoqUsual_Usual_doFn func(sParam string, bParam bool) +// MoqGenericParamsFn_doFn defines the type of function needed when calling +// AndDo for the GenericParamsFn type +type MoqGenericParamsFn_doFn[S, B any] func(S, B) -// MoqUsual_Usual_doReturnFn defines the type of function needed when calling -// DoReturnResults for the Usual type -type MoqUsual_Usual_doReturnFn func(sParam string, bParam bool) (sResult string, err error) +// MoqGenericParamsFn_doReturnFn defines the type of function needed when +// calling DoReturnResults for the GenericParamsFn type +type MoqGenericParamsFn_doReturnFn[S, B any] func(S, B) (string, error) -// MoqUsual_Usual_results holds the results of the Usual type -type MoqUsual_Usual_results struct { - Params MoqUsual_Usual_params +// MoqGenericParamsFn_results holds the results of the GenericParamsFn type +type MoqGenericParamsFn_results[S, B any] struct { + Params MoqGenericParamsFn_params[S, B] Results []struct { Values *struct { - SResult string - Err error + Result1 string + Result2 error } Sequence uint32 - DoFn MoqUsual_Usual_doFn - DoReturnFn MoqUsual_Usual_doReturnFn + DoFn MoqGenericParamsFn_doFn[S, B] + DoReturnFn MoqGenericParamsFn_doReturnFn[S, B] } Index uint32 Repeat *moq.RepeatVal } -// MoqUsual_Usual_fnRecorder routes recorded function calls to the MoqUsual moq -type MoqUsual_Usual_fnRecorder struct { - Params MoqUsual_Usual_params +// MoqGenericParamsFn_fnRecorder routes recorded function calls to the +// MoqGenericParamsFn moq +type MoqGenericParamsFn_fnRecorder[S, B any] struct { + Params MoqGenericParamsFn_params[S, B] AnyParams uint64 Sequence bool - Results *MoqUsual_Usual_results - Moq *MoqUsual + Results *MoqGenericParamsFn_results[S, B] + Moq *MoqGenericParamsFn[S, B] } -// MoqUsual_Usual_anyParams isolates the any params functions of the Usual type -type MoqUsual_Usual_anyParams struct { - Recorder *MoqUsual_Usual_fnRecorder -} - -// MoqUsual_NoNames_params holds the params of the Usual type -type MoqUsual_NoNames_params struct { - Param1 string - Param2 bool +// MoqGenericParamsFn_anyParams isolates the any params functions of the +// GenericParamsFn type +type MoqGenericParamsFn_anyParams[S, B any] struct { + Recorder *MoqGenericParamsFn_fnRecorder[S, B] } -// MoqUsual_NoNames_paramsKey holds the map key params of the Usual type -type MoqUsual_NoNames_paramsKey struct { - Params struct { - Param1 string - Param2 bool +// NewMoqGenericParamsFn creates a new moq of the GenericParamsFn type +func NewMoqGenericParamsFn[S, B any](scene *moq.Scene, config *moq.Config) *MoqGenericParamsFn[S, B] { + if config == nil { + config = &moq.Config{} } - Hashes struct { - Param1 hash.Hash - Param2 hash.Hash + m := &MoqGenericParamsFn[S, B]{ + Scene: scene, + Config: *config, + Moq: &MoqGenericParamsFn_mock[S, B]{}, + + Runtime: struct { + ParameterIndexing struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } + }{ParameterIndexing: struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + }{ + Param1: moq.ParamIndexByHash, + Param2: moq.ParamIndexByHash, + }}, } + m.Moq.Moq = m + + scene.AddMoq(m) + return m } -// MoqUsual_NoNames_resultsByParams contains the results for a given set of -// parameters for the Usual type -type MoqUsual_NoNames_resultsByParams struct { - AnyCount int - AnyParams uint64 - Results map[MoqUsual_NoNames_paramsKey]*MoqUsual_NoNames_results +// Mock returns the moq implementation of the GenericParamsFn type +func (m *MoqGenericParamsFn[S, B]) Mock() testmoqs.GenericParamsFn[S, B] { + return func(param1 S, param2 B) (string, error) { + m.Scene.T.Helper() + moq := &MoqGenericParamsFn_mock[S, B]{Moq: m} + return moq.Fn(param1, param2) + } } -// MoqUsual_NoNames_doFn defines the type of function needed when calling AndDo -// for the Usual type -type MoqUsual_NoNames_doFn func(string, bool) +func (m *MoqGenericParamsFn_mock[S, B]) Fn(param1 S, param2 B) (result1 string, result2 error) { + m.Moq.Scene.T.Helper() + params := MoqGenericParamsFn_params[S, B]{ + Param1: param1, + Param2: param2, + } + var results *MoqGenericParamsFn_results[S, B] + for _, resultsByParams := range m.Moq.ResultsByParams { + paramsKey := m.Moq.ParamsKey(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams(params)) + } + return + } -// MoqUsual_NoNames_doReturnFn defines the type of function needed when calling -// DoReturnResults for the Usual type -type MoqUsual_NoNames_doReturnFn func(string, bool) (string, error) + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } -// MoqUsual_NoNames_results holds the results of the Usual type -type MoqUsual_NoNames_results struct { - Params MoqUsual_NoNames_params - Results []struct { - Values *struct { - Result1 string - Result2 error + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams(params)) } - Sequence uint32 - DoFn MoqUsual_NoNames_doFn - DoReturnFn MoqUsual_NoNames_doReturnFn } - Index uint32 - Repeat *moq.RepeatVal -} -// MoqUsual_NoNames_fnRecorder routes recorded function calls to the MoqUsual -// moq -type MoqUsual_NoNames_fnRecorder struct { - Params MoqUsual_NoNames_params - AnyParams uint64 - Sequence bool - Results *MoqUsual_NoNames_results - Moq *MoqUsual -} - -// MoqUsual_NoNames_anyParams isolates the any params functions of the Usual -// type -type MoqUsual_NoNames_anyParams struct { - Recorder *MoqUsual_NoNames_fnRecorder -} - -// MoqUsual_NoResults_params holds the params of the Usual type -type MoqUsual_NoResults_params struct { - SParam string - BParam bool -} + if result.DoFn != nil { + result.DoFn(param1, param2) + } -// MoqUsual_NoResults_paramsKey holds the map key params of the Usual type -type MoqUsual_NoResults_paramsKey struct { - Params struct { - SParam string - BParam bool + if result.Values != nil { + result1 = result.Values.Result1 + result2 = result.Values.Result2 } - Hashes struct { - SParam hash.Hash - BParam hash.Hash + if result.DoReturnFn != nil { + result1, result2 = result.DoReturnFn(param1, param2) } + return } -// MoqUsual_NoResults_resultsByParams contains the results for a given set of -// parameters for the Usual type -type MoqUsual_NoResults_resultsByParams struct { - AnyCount int - AnyParams uint64 - Results map[MoqUsual_NoResults_paramsKey]*MoqUsual_NoResults_results +func (m *MoqGenericParamsFn[S, B]) OnCall(param1 S, param2 B) *MoqGenericParamsFn_fnRecorder[S, B] { + return &MoqGenericParamsFn_fnRecorder[S, B]{ + Params: MoqGenericParamsFn_params[S, B]{ + Param1: param1, + Param2: param2, + }, + Sequence: m.Config.Sequence == moq.SeqDefaultOn, + Moq: m, + } } -// MoqUsual_NoResults_doFn defines the type of function needed when calling -// AndDo for the Usual type -type MoqUsual_NoResults_doFn func(sParam string, bParam bool) - -// MoqUsual_NoResults_doReturnFn defines the type of function needed when -// calling DoReturnResults for the Usual type -type MoqUsual_NoResults_doReturnFn func(sParam string, bParam bool) - -// MoqUsual_NoResults_results holds the results of the Usual type -type MoqUsual_NoResults_results struct { - Params MoqUsual_NoResults_params - Results []struct { - Values *struct{} - Sequence uint32 - DoFn MoqUsual_NoResults_doFn - DoReturnFn MoqUsual_NoResults_doReturnFn +func (r *MoqGenericParamsFn_fnRecorder[S, B]) Any() *MoqGenericParamsFn_anyParams[S, B] { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams(r.Params)) + return nil } - Index uint32 - Repeat *moq.RepeatVal + return &MoqGenericParamsFn_anyParams[S, B]{Recorder: r} } -// MoqUsual_NoResults_fnRecorder routes recorded function calls to the MoqUsual -// moq -type MoqUsual_NoResults_fnRecorder struct { - Params MoqUsual_NoResults_params - AnyParams uint64 - Sequence bool - Results *MoqUsual_NoResults_results - Moq *MoqUsual +func (a *MoqGenericParamsFn_anyParams[S, B]) Param1() *MoqGenericParamsFn_fnRecorder[S, B] { + a.Recorder.AnyParams |= 1 << 0 + return a.Recorder } -// MoqUsual_NoResults_anyParams isolates the any params functions of the Usual -// type -type MoqUsual_NoResults_anyParams struct { - Recorder *MoqUsual_NoResults_fnRecorder +func (a *MoqGenericParamsFn_anyParams[S, B]) Param2() *MoqGenericParamsFn_fnRecorder[S, B] { + a.Recorder.AnyParams |= 1 << 1 + return a.Recorder } -// MoqUsual_NoParams_params holds the params of the Usual type -type MoqUsual_NoParams_params struct{} - -// MoqUsual_NoParams_paramsKey holds the map key params of the Usual type -type MoqUsual_NoParams_paramsKey struct { - Params struct{} - Hashes struct{} +func (r *MoqGenericParamsFn_fnRecorder[S, B]) Seq() *MoqGenericParamsFn_fnRecorder[S, B] { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams(r.Params)) + return nil + } + r.Sequence = true + return r } -// MoqUsual_NoParams_resultsByParams contains the results for a given set of -// parameters for the Usual type -type MoqUsual_NoParams_resultsByParams struct { - AnyCount int - AnyParams uint64 - Results map[MoqUsual_NoParams_paramsKey]*MoqUsual_NoParams_results +func (r *MoqGenericParamsFn_fnRecorder[S, B]) NoSeq() *MoqGenericParamsFn_fnRecorder[S, B] { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams(r.Params)) + return nil + } + r.Sequence = false + return r } -// MoqUsual_NoParams_doFn defines the type of function needed when calling -// AndDo for the Usual type -type MoqUsual_NoParams_doFn func() +func (r *MoqGenericParamsFn_fnRecorder[S, B]) ReturnResults(result1 string, result2 error) *MoqGenericParamsFn_fnRecorder[S, B] { + r.Moq.Scene.T.Helper() + r.FindResults() -// MoqUsual_NoParams_doReturnFn defines the type of function needed when -// calling DoReturnResults for the Usual type -type MoqUsual_NoParams_doReturnFn func() (sResult string, err error) + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } -// MoqUsual_NoParams_results holds the results of the Usual type -type MoqUsual_NoParams_results struct { - Params MoqUsual_NoParams_params - Results []struct { + r.Results.Results = append(r.Results.Results, struct { Values *struct { - SResult string - Err error + Result1 string + Result2 error } Sequence uint32 - DoFn MoqUsual_NoParams_doFn - DoReturnFn MoqUsual_NoParams_doReturnFn - } - Index uint32 - Repeat *moq.RepeatVal + DoFn MoqGenericParamsFn_doFn[S, B] + DoReturnFn MoqGenericParamsFn_doReturnFn[S, B] + }{ + Values: &struct { + Result1 string + Result2 error + }{ + Result1: result1, + Result2: result2, + }, + Sequence: sequence, + }) + return r } -// MoqUsual_NoParams_fnRecorder routes recorded function calls to the MoqUsual -// moq -type MoqUsual_NoParams_fnRecorder struct { - Params MoqUsual_NoParams_params - AnyParams uint64 - Sequence bool - Results *MoqUsual_NoParams_results - Moq *MoqUsual +func (r *MoqGenericParamsFn_fnRecorder[S, B]) AndDo(fn MoqGenericParamsFn_doFn[S, B]) *MoqGenericParamsFn_fnRecorder[S, B] { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") + return nil + } + last := &r.Results.Results[len(r.Results.Results)-1] + last.DoFn = fn + return r } -// MoqUsual_NoParams_anyParams isolates the any params functions of the Usual -// type -type MoqUsual_NoParams_anyParams struct { - Recorder *MoqUsual_NoParams_fnRecorder -} +func (r *MoqGenericParamsFn_fnRecorder[S, B]) DoReturnResults(fn MoqGenericParamsFn_doReturnFn[S, B]) *MoqGenericParamsFn_fnRecorder[S, B] { + r.Moq.Scene.T.Helper() + r.FindResults() -// MoqUsual_Nothing_params holds the params of the Usual type -type MoqUsual_Nothing_params struct{} + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } -// MoqUsual_Nothing_paramsKey holds the map key params of the Usual type -type MoqUsual_Nothing_paramsKey struct { - Params struct{} - Hashes struct{} + r.Results.Results = append(r.Results.Results, struct { + Values *struct { + Result1 string + Result2 error + } + Sequence uint32 + DoFn MoqGenericParamsFn_doFn[S, B] + DoReturnFn MoqGenericParamsFn_doReturnFn[S, B] + }{Sequence: sequence, DoReturnFn: fn}) + return r } -// MoqUsual_Nothing_resultsByParams contains the results for a given set of -// parameters for the Usual type -type MoqUsual_Nothing_resultsByParams struct { - AnyCount int - AnyParams uint64 - Results map[MoqUsual_Nothing_paramsKey]*MoqUsual_Nothing_results -} +func (r *MoqGenericParamsFn_fnRecorder[S, B]) FindResults() { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Results.Repeat.Increment(r.Moq.Scene.T) + return + } -// MoqUsual_Nothing_doFn defines the type of function needed when calling AndDo -// for the Usual type -type MoqUsual_Nothing_doFn func() + anyCount := bits.OnesCount64(r.AnyParams) + insertAt := -1 + var results *MoqGenericParamsFn_resultsByParams[S, B] + for n, res := range r.Moq.ResultsByParams { + if res.AnyParams == r.AnyParams { + results = &res + break + } + if res.AnyCount > anyCount { + insertAt = n + } + } + if results == nil { + results = &MoqGenericParamsFn_resultsByParams[S, B]{ + AnyCount: anyCount, + AnyParams: r.AnyParams, + Results: map[MoqGenericParamsFn_paramsKey[S, B]]*MoqGenericParamsFn_results[S, B]{}, + } + r.Moq.ResultsByParams = append(r.Moq.ResultsByParams, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams) { + copy(r.Moq.ResultsByParams[insertAt+1:], r.Moq.ResultsByParams[insertAt:0]) + r.Moq.ResultsByParams[insertAt] = *results + } + } -// MoqUsual_Nothing_doReturnFn defines the type of function needed when calling -// DoReturnResults for the Usual type -type MoqUsual_Nothing_doReturnFn func() + paramsKey := r.Moq.ParamsKey(r.Params, r.AnyParams) -// MoqUsual_Nothing_results holds the results of the Usual type -type MoqUsual_Nothing_results struct { - Params MoqUsual_Nothing_params - Results []struct { - Values *struct{} - Sequence uint32 - DoFn MoqUsual_Nothing_doFn - DoReturnFn MoqUsual_Nothing_doReturnFn + var ok bool + r.Results, ok = results.Results[paramsKey] + if !ok { + r.Results = &MoqGenericParamsFn_results[S, B]{ + Params: r.Params, + Results: nil, + Index: 0, + Repeat: &moq.RepeatVal{}, + } + results.Results[paramsKey] = r.Results } - Index uint32 - Repeat *moq.RepeatVal -} -// MoqUsual_Nothing_fnRecorder routes recorded function calls to the MoqUsual -// moq -type MoqUsual_Nothing_fnRecorder struct { - Params MoqUsual_Nothing_params - AnyParams uint64 - Sequence bool - Results *MoqUsual_Nothing_results - Moq *MoqUsual + r.Results.Repeat.Increment(r.Moq.Scene.T) } -// MoqUsual_Nothing_anyParams isolates the any params functions of the Usual -// type -type MoqUsual_Nothing_anyParams struct { - Recorder *MoqUsual_Nothing_fnRecorder +func (r *MoqGenericParamsFn_fnRecorder[S, B]) Repeat(repeaters ...moq.Repeater) *MoqGenericParamsFn_fnRecorder[S, B] { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") + return nil + } + r.Results.Repeat.Repeat(r.Moq.Scene.T, repeaters) + last := r.Results.Results[len(r.Results.Results)-1] + for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { + if r.Sequence { + last = struct { + Values *struct { + Result1 string + Result2 error + } + Sequence uint32 + DoFn MoqGenericParamsFn_doFn[S, B] + DoReturnFn MoqGenericParamsFn_doReturnFn[S, B] + }{ + Values: last.Values, + Sequence: r.Moq.Scene.NextRecorderSequence(), + } + } + r.Results.Results = append(r.Results.Results, last) + } + return r } -// MoqUsual_Variadic_params holds the params of the Usual type -type MoqUsual_Variadic_params struct { - Other bool - Args []string +func (m *MoqGenericParamsFn[S, B]) PrettyParams(params MoqGenericParamsFn_params[S, B]) string { + return fmt.Sprintf("GenericParamsFn(%#v, %#v)", params.Param1, params.Param2) } -// MoqUsual_Variadic_paramsKey holds the map key params of the Usual type -type MoqUsual_Variadic_paramsKey struct { - Params struct{ Other bool } - Hashes struct { - Other hash.Hash - Args hash.Hash +func (m *MoqGenericParamsFn[S, B]) ParamsKey(params MoqGenericParamsFn_params[S, B], anyParams uint64) MoqGenericParamsFn_paramsKey[S, B] { + m.Scene.T.Helper() + var param1UsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.Runtime.ParameterIndexing.Param1 == moq.ParamIndexByValue { + m.Scene.T.Fatalf("The param1 parameter can't be indexed by value") + } + param1UsedHash = hash.DeepHash(params.Param1) + } + var param2UsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.Runtime.ParameterIndexing.Param2 == moq.ParamIndexByValue { + m.Scene.T.Fatalf("The param2 parameter can't be indexed by value") + } + param2UsedHash = hash.DeepHash(params.Param2) + } + return MoqGenericParamsFn_paramsKey[S, B]{ + Params: struct{}{}, + Hashes: struct { + Param1 hash.Hash + Param2 hash.Hash + }{ + Param1: param1UsedHash, + Param2: param2UsedHash, + }, } } -// MoqUsual_Variadic_resultsByParams contains the results for a given set of -// parameters for the Usual type -type MoqUsual_Variadic_resultsByParams struct { - AnyCount int - AnyParams uint64 - Results map[MoqUsual_Variadic_paramsKey]*MoqUsual_Variadic_results +// Reset resets the state of the moq +func (m *MoqGenericParamsFn[S, B]) Reset() { m.ResultsByParams = nil } + +// AssertExpectationsMet asserts that all expectations have been met +func (m *MoqGenericParamsFn[S, B]) AssertExpectationsMet() { + m.Scene.T.Helper() + for _, res := range m.ResultsByParams { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams(results.Params)) + } + } + } } -// MoqUsual_Variadic_doFn defines the type of function needed when calling -// AndDo for the Usual type -type MoqUsual_Variadic_doFn func(other bool, args ...string) +// MoqPartialGenericParamsFn holds the state of a moq of the +// PartialGenericParamsFn type +type MoqPartialGenericParamsFn[S any] struct { + Scene *moq.Scene + Config moq.Config + Moq *MoqPartialGenericParamsFn_mock[S] -// MoqUsual_Variadic_doReturnFn defines the type of function needed when -// calling DoReturnResults for the Usual type -type MoqUsual_Variadic_doReturnFn func(other bool, args ...string) (sResult string, err error) + ResultsByParams []MoqPartialGenericParamsFn_resultsByParams[S] -// MoqUsual_Variadic_results holds the results of the Usual type -type MoqUsual_Variadic_results struct { - Params MoqUsual_Variadic_params - Results []struct { - Values *struct { - SResult string - Err error + Runtime struct { + ParameterIndexing struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing } - Sequence uint32 - DoFn MoqUsual_Variadic_doFn - DoReturnFn MoqUsual_Variadic_doReturnFn } - Index uint32 - Repeat *moq.RepeatVal -} - -// MoqUsual_Variadic_fnRecorder routes recorded function calls to the MoqUsual -// moq -type MoqUsual_Variadic_fnRecorder struct { - Params MoqUsual_Variadic_params - AnyParams uint64 - Sequence bool - Results *MoqUsual_Variadic_results - Moq *MoqUsual } -// MoqUsual_Variadic_anyParams isolates the any params functions of the Usual -// type -type MoqUsual_Variadic_anyParams struct { - Recorder *MoqUsual_Variadic_fnRecorder +// MoqPartialGenericParamsFn_mock isolates the mock interface of the +// PartialGenericParamsFn type +type MoqPartialGenericParamsFn_mock[S any] struct { + Moq *MoqPartialGenericParamsFn[S] } -// MoqUsual_RepeatedIds_params holds the params of the Usual type -type MoqUsual_RepeatedIds_params struct { - SParam1, SParam2 string - BParam bool +// MoqPartialGenericParamsFn_params holds the params of the +// PartialGenericParamsFn type +type MoqPartialGenericParamsFn_params[S any] struct { + Param1 S + Param2 bool } -// MoqUsual_RepeatedIds_paramsKey holds the map key params of the Usual type -type MoqUsual_RepeatedIds_paramsKey struct { - Params struct { - SParam1, SParam2 string - BParam bool - } +// MoqPartialGenericParamsFn_paramsKey holds the map key params of the +// PartialGenericParamsFn type +type MoqPartialGenericParamsFn_paramsKey[S any] struct { + Params struct{ Param2 bool } Hashes struct { - SParam1, SParam2 hash.Hash - BParam hash.Hash + Param1 hash.Hash + Param2 hash.Hash } } -// MoqUsual_RepeatedIds_resultsByParams contains the results for a given set of -// parameters for the Usual type -type MoqUsual_RepeatedIds_resultsByParams struct { +// MoqPartialGenericParamsFn_resultsByParams contains the results for a given +// set of parameters for the PartialGenericParamsFn type +type MoqPartialGenericParamsFn_resultsByParams[S any] struct { AnyCount int AnyParams uint64 - Results map[MoqUsual_RepeatedIds_paramsKey]*MoqUsual_RepeatedIds_results + Results map[MoqPartialGenericParamsFn_paramsKey[S]]*MoqPartialGenericParamsFn_results[S] } -// MoqUsual_RepeatedIds_doFn defines the type of function needed when calling -// AndDo for the Usual type -type MoqUsual_RepeatedIds_doFn func(sParam1, sParam2 string, bParam bool) +// MoqPartialGenericParamsFn_doFn defines the type of function needed when +// calling AndDo for the PartialGenericParamsFn type +type MoqPartialGenericParamsFn_doFn[S any] func(S, bool) -// MoqUsual_RepeatedIds_doReturnFn defines the type of function needed when -// calling DoReturnResults for the Usual type -type MoqUsual_RepeatedIds_doReturnFn func(sParam1, sParam2 string, bParam bool) (sResult1, sResult2 string, err error) +// MoqPartialGenericParamsFn_doReturnFn defines the type of function needed +// when calling DoReturnResults for the PartialGenericParamsFn type +type MoqPartialGenericParamsFn_doReturnFn[S any] func(S, bool) (string, error) -// MoqUsual_RepeatedIds_results holds the results of the Usual type -type MoqUsual_RepeatedIds_results struct { - Params MoqUsual_RepeatedIds_params +// MoqPartialGenericParamsFn_results holds the results of the +// PartialGenericParamsFn type +type MoqPartialGenericParamsFn_results[S any] struct { + Params MoqPartialGenericParamsFn_params[S] Results []struct { Values *struct { - SResult1, SResult2 string - Err error + Result1 string + Result2 error } Sequence uint32 - DoFn MoqUsual_RepeatedIds_doFn - DoReturnFn MoqUsual_RepeatedIds_doReturnFn + DoFn MoqPartialGenericParamsFn_doFn[S] + DoReturnFn MoqPartialGenericParamsFn_doReturnFn[S] } Index uint32 Repeat *moq.RepeatVal } -// MoqUsual_RepeatedIds_fnRecorder routes recorded function calls to the -// MoqUsual moq -type MoqUsual_RepeatedIds_fnRecorder struct { - Params MoqUsual_RepeatedIds_params +// MoqPartialGenericParamsFn_fnRecorder routes recorded function calls to the +// MoqPartialGenericParamsFn moq +type MoqPartialGenericParamsFn_fnRecorder[S any] struct { + Params MoqPartialGenericParamsFn_params[S] AnyParams uint64 Sequence bool - Results *MoqUsual_RepeatedIds_results - Moq *MoqUsual -} - -// MoqUsual_RepeatedIds_anyParams isolates the any params functions of the -// Usual type -type MoqUsual_RepeatedIds_anyParams struct { - Recorder *MoqUsual_RepeatedIds_fnRecorder + Results *MoqPartialGenericParamsFn_results[S] + Moq *MoqPartialGenericParamsFn[S] } -// MoqUsual_Times_params holds the params of the Usual type -type MoqUsual_Times_params struct { - SParam string - Times bool +// MoqPartialGenericParamsFn_anyParams isolates the any params functions of the +// PartialGenericParamsFn type +type MoqPartialGenericParamsFn_anyParams[S any] struct { + Recorder *MoqPartialGenericParamsFn_fnRecorder[S] } -// MoqUsual_Times_paramsKey holds the map key params of the Usual type -type MoqUsual_Times_paramsKey struct { - Params struct { - SParam string - Times bool +// NewMoqPartialGenericParamsFn creates a new moq of the PartialGenericParamsFn +// type +func NewMoqPartialGenericParamsFn[S any](scene *moq.Scene, config *moq.Config) *MoqPartialGenericParamsFn[S] { + if config == nil { + config = &moq.Config{} } - Hashes struct { - SParam hash.Hash - Times hash.Hash + m := &MoqPartialGenericParamsFn[S]{ + Scene: scene, + Config: *config, + Moq: &MoqPartialGenericParamsFn_mock[S]{}, + + Runtime: struct { + ParameterIndexing struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } + }{ParameterIndexing: struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + }{ + Param1: moq.ParamIndexByHash, + Param2: moq.ParamIndexByValue, + }}, } + m.Moq.Moq = m + + scene.AddMoq(m) + return m } -// MoqUsual_Times_resultsByParams contains the results for a given set of -// parameters for the Usual type -type MoqUsual_Times_resultsByParams struct { - AnyCount int - AnyParams uint64 - Results map[MoqUsual_Times_paramsKey]*MoqUsual_Times_results +// Mock returns the moq implementation of the PartialGenericParamsFn type +func (m *MoqPartialGenericParamsFn[S]) Mock() testmoqs.PartialGenericParamsFn[S] { + return func(param1 S, param2 bool) (string, error) { + m.Scene.T.Helper() + moq := &MoqPartialGenericParamsFn_mock[S]{Moq: m} + return moq.Fn(param1, param2) + } } -// MoqUsual_Times_doFn defines the type of function needed when calling AndDo -// for the Usual type -type MoqUsual_Times_doFn func(sParam string, times bool) +func (m *MoqPartialGenericParamsFn_mock[S]) Fn(param1 S, param2 bool) (result1 string, result2 error) { + m.Moq.Scene.T.Helper() + params := MoqPartialGenericParamsFn_params[S]{ + Param1: param1, + Param2: param2, + } + var results *MoqPartialGenericParamsFn_results[S] + for _, resultsByParams := range m.Moq.ResultsByParams { + paramsKey := m.Moq.ParamsKey(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams(params)) + } + return + } -// MoqUsual_Times_doReturnFn defines the type of function needed when calling -// DoReturnResults for the Usual type -type MoqUsual_Times_doReturnFn func(sParam string, times bool) (sResult string, err error) + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } -// MoqUsual_Times_results holds the results of the Usual type -type MoqUsual_Times_results struct { - Params MoqUsual_Times_params - Results []struct { - Values *struct { - SResult string - Err error + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams(params)) } - Sequence uint32 - DoFn MoqUsual_Times_doFn - DoReturnFn MoqUsual_Times_doReturnFn } - Index uint32 - Repeat *moq.RepeatVal -} -// MoqUsual_Times_fnRecorder routes recorded function calls to the MoqUsual moq -type MoqUsual_Times_fnRecorder struct { - Params MoqUsual_Times_params - AnyParams uint64 - Sequence bool - Results *MoqUsual_Times_results - Moq *MoqUsual -} - -// MoqUsual_Times_anyParams isolates the any params functions of the Usual type -type MoqUsual_Times_anyParams struct { - Recorder *MoqUsual_Times_fnRecorder -} - -// MoqUsual_DifficultParamNames_params holds the params of the Usual type -type MoqUsual_DifficultParamNames_params struct { - Param1, Param2 bool - Param3 string - Param, Param5, Param6 int - Param7, Param8, Param9 float32 -} + if result.DoFn != nil { + result.DoFn(param1, param2) + } -// MoqUsual_DifficultParamNames_paramsKey holds the map key params of the Usual -// type -type MoqUsual_DifficultParamNames_paramsKey struct { - Params struct { - Param1, Param2 bool - Param3 string - Param, Param5, Param6 int - Param7, Param8, Param9 float32 + if result.Values != nil { + result1 = result.Values.Result1 + result2 = result.Values.Result2 } - Hashes struct { - Param1, Param2 hash.Hash - Param3 hash.Hash - Param, Param5, Param6 hash.Hash - Param7, Param8, Param9 hash.Hash + if result.DoReturnFn != nil { + result1, result2 = result.DoReturnFn(param1, param2) } + return } -// MoqUsual_DifficultParamNames_resultsByParams contains the results for a -// given set of parameters for the Usual type -type MoqUsual_DifficultParamNames_resultsByParams struct { - AnyCount int - AnyParams uint64 - Results map[MoqUsual_DifficultParamNames_paramsKey]*MoqUsual_DifficultParamNames_results +func (m *MoqPartialGenericParamsFn[S]) OnCall(param1 S, param2 bool) *MoqPartialGenericParamsFn_fnRecorder[S] { + return &MoqPartialGenericParamsFn_fnRecorder[S]{ + Params: MoqPartialGenericParamsFn_params[S]{ + Param1: param1, + Param2: param2, + }, + Sequence: m.Config.Sequence == moq.SeqDefaultOn, + Moq: m, + } } -// MoqUsual_DifficultParamNames_doFn defines the type of function needed when -// calling AndDo for the Usual type -type MoqUsual_DifficultParamNames_doFn func(m, r bool, sequence string, param, params, i int, result, results, _ float32) - -// MoqUsual_DifficultParamNames_doReturnFn defines the type of function needed -// when calling DoReturnResults for the Usual type -type MoqUsual_DifficultParamNames_doReturnFn func(m, r bool, sequence string, param, params, i int, result, results, _ float32) - -// MoqUsual_DifficultParamNames_results holds the results of the Usual type -type MoqUsual_DifficultParamNames_results struct { - Params MoqUsual_DifficultParamNames_params - Results []struct { - Values *struct{} - Sequence uint32 - DoFn MoqUsual_DifficultParamNames_doFn - DoReturnFn MoqUsual_DifficultParamNames_doReturnFn +func (r *MoqPartialGenericParamsFn_fnRecorder[S]) Any() *MoqPartialGenericParamsFn_anyParams[S] { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams(r.Params)) + return nil } - Index uint32 - Repeat *moq.RepeatVal + return &MoqPartialGenericParamsFn_anyParams[S]{Recorder: r} } -// MoqUsual_DifficultParamNames_fnRecorder routes recorded function calls to -// the MoqUsual moq -type MoqUsual_DifficultParamNames_fnRecorder struct { - Params MoqUsual_DifficultParamNames_params - AnyParams uint64 - Sequence bool - Results *MoqUsual_DifficultParamNames_results - Moq *MoqUsual +func (a *MoqPartialGenericParamsFn_anyParams[S]) Param1() *MoqPartialGenericParamsFn_fnRecorder[S] { + a.Recorder.AnyParams |= 1 << 0 + return a.Recorder } -// MoqUsual_DifficultParamNames_anyParams isolates the any params functions of -// the Usual type -type MoqUsual_DifficultParamNames_anyParams struct { - Recorder *MoqUsual_DifficultParamNames_fnRecorder +func (a *MoqPartialGenericParamsFn_anyParams[S]) Param2() *MoqPartialGenericParamsFn_fnRecorder[S] { + a.Recorder.AnyParams |= 1 << 1 + return a.Recorder } -// MoqUsual_DifficultResultNames_params holds the params of the Usual type -type MoqUsual_DifficultResultNames_params struct{} - -// MoqUsual_DifficultResultNames_paramsKey holds the map key params of the -// Usual type -type MoqUsual_DifficultResultNames_paramsKey struct { - Params struct{} - Hashes struct{} +func (r *MoqPartialGenericParamsFn_fnRecorder[S]) Seq() *MoqPartialGenericParamsFn_fnRecorder[S] { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams(r.Params)) + return nil + } + r.Sequence = true + return r } -// MoqUsual_DifficultResultNames_resultsByParams contains the results for a -// given set of parameters for the Usual type -type MoqUsual_DifficultResultNames_resultsByParams struct { - AnyCount int - AnyParams uint64 - Results map[MoqUsual_DifficultResultNames_paramsKey]*MoqUsual_DifficultResultNames_results +func (r *MoqPartialGenericParamsFn_fnRecorder[S]) NoSeq() *MoqPartialGenericParamsFn_fnRecorder[S] { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams(r.Params)) + return nil + } + r.Sequence = false + return r } -// MoqUsual_DifficultResultNames_doFn defines the type of function needed when -// calling AndDo for the Usual type -type MoqUsual_DifficultResultNames_doFn func() +func (r *MoqPartialGenericParamsFn_fnRecorder[S]) ReturnResults(result1 string, result2 error) *MoqPartialGenericParamsFn_fnRecorder[S] { + r.Moq.Scene.T.Helper() + r.FindResults() -// MoqUsual_DifficultResultNames_doReturnFn defines the type of function needed -// when calling DoReturnResults for the Usual type -type MoqUsual_DifficultResultNames_doReturnFn func() (m, r string, sequence error, param, params, i int, result, results, _ float32) + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } -// MoqUsual_DifficultResultNames_results holds the results of the Usual type -type MoqUsual_DifficultResultNames_results struct { - Params MoqUsual_DifficultResultNames_params - Results []struct { + r.Results.Results = append(r.Results.Results, struct { Values *struct { - Result1, Result2 string - Result3 error - Param, Result5, Result6 int - Result7, Result8, Result9 float32 + Result1 string + Result2 error } Sequence uint32 - DoFn MoqUsual_DifficultResultNames_doFn - DoReturnFn MoqUsual_DifficultResultNames_doReturnFn - } - Index uint32 - Repeat *moq.RepeatVal + DoFn MoqPartialGenericParamsFn_doFn[S] + DoReturnFn MoqPartialGenericParamsFn_doReturnFn[S] + }{ + Values: &struct { + Result1 string + Result2 error + }{ + Result1: result1, + Result2: result2, + }, + Sequence: sequence, + }) + return r } -// MoqUsual_DifficultResultNames_fnRecorder routes recorded function calls to -// the MoqUsual moq -type MoqUsual_DifficultResultNames_fnRecorder struct { - Params MoqUsual_DifficultResultNames_params - AnyParams uint64 - Sequence bool - Results *MoqUsual_DifficultResultNames_results - Moq *MoqUsual +func (r *MoqPartialGenericParamsFn_fnRecorder[S]) AndDo(fn MoqPartialGenericParamsFn_doFn[S]) *MoqPartialGenericParamsFn_fnRecorder[S] { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") + return nil + } + last := &r.Results.Results[len(r.Results.Results)-1] + last.DoFn = fn + return r } -// MoqUsual_DifficultResultNames_anyParams isolates the any params functions of -// the Usual type -type MoqUsual_DifficultResultNames_anyParams struct { - Recorder *MoqUsual_DifficultResultNames_fnRecorder -} +func (r *MoqPartialGenericParamsFn_fnRecorder[S]) DoReturnResults(fn MoqPartialGenericParamsFn_doReturnFn[S]) *MoqPartialGenericParamsFn_fnRecorder[S] { + r.Moq.Scene.T.Helper() + r.FindResults() -// MoqUsual_PassByArray_params holds the params of the Usual type -type MoqUsual_PassByArray_params struct{ P [3]testmoqs.Params } + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } -// MoqUsual_PassByArray_paramsKey holds the map key params of the Usual type -type MoqUsual_PassByArray_paramsKey struct { - Params struct{ P [3]testmoqs.Params } - Hashes struct{ P hash.Hash } + r.Results.Results = append(r.Results.Results, struct { + Values *struct { + Result1 string + Result2 error + } + Sequence uint32 + DoFn MoqPartialGenericParamsFn_doFn[S] + DoReturnFn MoqPartialGenericParamsFn_doReturnFn[S] + }{Sequence: sequence, DoReturnFn: fn}) + return r } -// MoqUsual_PassByArray_resultsByParams contains the results for a given set of -// parameters for the Usual type -type MoqUsual_PassByArray_resultsByParams struct { - AnyCount int - AnyParams uint64 - Results map[MoqUsual_PassByArray_paramsKey]*MoqUsual_PassByArray_results -} +func (r *MoqPartialGenericParamsFn_fnRecorder[S]) FindResults() { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Results.Repeat.Increment(r.Moq.Scene.T) + return + } -// MoqUsual_PassByArray_doFn defines the type of function needed when calling -// AndDo for the Usual type -type MoqUsual_PassByArray_doFn func(p [3]testmoqs.Params) + anyCount := bits.OnesCount64(r.AnyParams) + insertAt := -1 + var results *MoqPartialGenericParamsFn_resultsByParams[S] + for n, res := range r.Moq.ResultsByParams { + if res.AnyParams == r.AnyParams { + results = &res + break + } + if res.AnyCount > anyCount { + insertAt = n + } + } + if results == nil { + results = &MoqPartialGenericParamsFn_resultsByParams[S]{ + AnyCount: anyCount, + AnyParams: r.AnyParams, + Results: map[MoqPartialGenericParamsFn_paramsKey[S]]*MoqPartialGenericParamsFn_results[S]{}, + } + r.Moq.ResultsByParams = append(r.Moq.ResultsByParams, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams) { + copy(r.Moq.ResultsByParams[insertAt+1:], r.Moq.ResultsByParams[insertAt:0]) + r.Moq.ResultsByParams[insertAt] = *results + } + } -// MoqUsual_PassByArray_doReturnFn defines the type of function needed when -// calling DoReturnResults for the Usual type -type MoqUsual_PassByArray_doReturnFn func(p [3]testmoqs.Params) [3]testmoqs.Results + paramsKey := r.Moq.ParamsKey(r.Params, r.AnyParams) -// MoqUsual_PassByArray_results holds the results of the Usual type -type MoqUsual_PassByArray_results struct { - Params MoqUsual_PassByArray_params - Results []struct { - Values *struct { - Result1 [3]testmoqs.Results + var ok bool + r.Results, ok = results.Results[paramsKey] + if !ok { + r.Results = &MoqPartialGenericParamsFn_results[S]{ + Params: r.Params, + Results: nil, + Index: 0, + Repeat: &moq.RepeatVal{}, } - Sequence uint32 - DoFn MoqUsual_PassByArray_doFn - DoReturnFn MoqUsual_PassByArray_doReturnFn + results.Results[paramsKey] = r.Results } - Index uint32 - Repeat *moq.RepeatVal -} -// MoqUsual_PassByArray_fnRecorder routes recorded function calls to the -// MoqUsual moq -type MoqUsual_PassByArray_fnRecorder struct { - Params MoqUsual_PassByArray_params - AnyParams uint64 - Sequence bool - Results *MoqUsual_PassByArray_results - Moq *MoqUsual + r.Results.Repeat.Increment(r.Moq.Scene.T) } -// MoqUsual_PassByArray_anyParams isolates the any params functions of the -// Usual type -type MoqUsual_PassByArray_anyParams struct { - Recorder *MoqUsual_PassByArray_fnRecorder +func (r *MoqPartialGenericParamsFn_fnRecorder[S]) Repeat(repeaters ...moq.Repeater) *MoqPartialGenericParamsFn_fnRecorder[S] { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") + return nil + } + r.Results.Repeat.Repeat(r.Moq.Scene.T, repeaters) + last := r.Results.Results[len(r.Results.Results)-1] + for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { + if r.Sequence { + last = struct { + Values *struct { + Result1 string + Result2 error + } + Sequence uint32 + DoFn MoqPartialGenericParamsFn_doFn[S] + DoReturnFn MoqPartialGenericParamsFn_doReturnFn[S] + }{ + Values: last.Values, + Sequence: r.Moq.Scene.NextRecorderSequence(), + } + } + r.Results.Results = append(r.Results.Results, last) + } + return r } -// MoqUsual_PassByChan_params holds the params of the Usual type -type MoqUsual_PassByChan_params struct{ P chan testmoqs.Params } - -// MoqUsual_PassByChan_paramsKey holds the map key params of the Usual type -type MoqUsual_PassByChan_paramsKey struct { - Params struct{ P chan testmoqs.Params } - Hashes struct{ P hash.Hash } +func (m *MoqPartialGenericParamsFn[S]) PrettyParams(params MoqPartialGenericParamsFn_params[S]) string { + return fmt.Sprintf("PartialGenericParamsFn(%#v, %#v)", params.Param1, params.Param2) } -// MoqUsual_PassByChan_resultsByParams contains the results for a given set of -// parameters for the Usual type -type MoqUsual_PassByChan_resultsByParams struct { - AnyCount int - AnyParams uint64 - Results map[MoqUsual_PassByChan_paramsKey]*MoqUsual_PassByChan_results +func (m *MoqPartialGenericParamsFn[S]) ParamsKey(params MoqPartialGenericParamsFn_params[S], anyParams uint64) MoqPartialGenericParamsFn_paramsKey[S] { + m.Scene.T.Helper() + var param1UsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.Runtime.ParameterIndexing.Param1 == moq.ParamIndexByValue { + m.Scene.T.Fatalf("The param1 parameter can't be indexed by value") + } + param1UsedHash = hash.DeepHash(params.Param1) + } + var param2Used bool + var param2UsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.Runtime.ParameterIndexing.Param2 == moq.ParamIndexByValue { + param2Used = params.Param2 + } else { + param2UsedHash = hash.DeepHash(params.Param2) + } + } + return MoqPartialGenericParamsFn_paramsKey[S]{ + Params: struct{ Param2 bool }{ + Param2: param2Used, + }, + Hashes: struct { + Param1 hash.Hash + Param2 hash.Hash + }{ + Param1: param1UsedHash, + Param2: param2UsedHash, + }, + } } -// MoqUsual_PassByChan_doFn defines the type of function needed when calling -// AndDo for the Usual type -type MoqUsual_PassByChan_doFn func(p chan testmoqs.Params) - -// MoqUsual_PassByChan_doReturnFn defines the type of function needed when -// calling DoReturnResults for the Usual type -type MoqUsual_PassByChan_doReturnFn func(p chan testmoqs.Params) chan testmoqs.Results +// Reset resets the state of the moq +func (m *MoqPartialGenericParamsFn[S]) Reset() { m.ResultsByParams = nil } -// MoqUsual_PassByChan_results holds the results of the Usual type -type MoqUsual_PassByChan_results struct { - Params MoqUsual_PassByChan_params - Results []struct { - Values *struct { - Result1 chan testmoqs.Results +// AssertExpectationsMet asserts that all expectations have been met +func (m *MoqPartialGenericParamsFn[S]) AssertExpectationsMet() { + m.Scene.T.Helper() + for _, res := range m.ResultsByParams { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams(results.Params)) + } } - Sequence uint32 - DoFn MoqUsual_PassByChan_doFn - DoReturnFn MoqUsual_PassByChan_doReturnFn } - Index uint32 - Repeat *moq.RepeatVal } -// MoqUsual_PassByChan_fnRecorder routes recorded function calls to the -// MoqUsual moq -type MoqUsual_PassByChan_fnRecorder struct { - Params MoqUsual_PassByChan_params - AnyParams uint64 - Sequence bool - Results *MoqUsual_PassByChan_results - Moq *MoqUsual +// MoqGenericResultsFn holds the state of a moq of the GenericResultsFn type +type MoqGenericResultsFn[S ~string, E error] struct { + Scene *moq.Scene + Config moq.Config + Moq *MoqGenericResultsFn_mock[S, E] + + ResultsByParams []MoqGenericResultsFn_resultsByParams[S, E] + + Runtime struct { + ParameterIndexing struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } + } } -// MoqUsual_PassByChan_anyParams isolates the any params functions of the Usual +// MoqGenericResultsFn_mock isolates the mock interface of the GenericResultsFn // type -type MoqUsual_PassByChan_anyParams struct { - Recorder *MoqUsual_PassByChan_fnRecorder +type MoqGenericResultsFn_mock[S ~string, E error] struct { + Moq *MoqGenericResultsFn[S, E] } -// MoqUsual_PassByEllipsis_params holds the params of the Usual type -type MoqUsual_PassByEllipsis_params struct{ P []testmoqs.Params } +// MoqGenericResultsFn_params holds the params of the GenericResultsFn type +type MoqGenericResultsFn_params[S ~string, E error] struct { + Param1 string + Param2 bool +} -// MoqUsual_PassByEllipsis_paramsKey holds the map key params of the Usual type -type MoqUsual_PassByEllipsis_paramsKey struct { - Params struct{} - Hashes struct{ P hash.Hash } +// MoqGenericResultsFn_paramsKey holds the map key params of the +// GenericResultsFn type +type MoqGenericResultsFn_paramsKey[S ~string, E error] struct { + Params struct { + Param1 string + Param2 bool + } + Hashes struct { + Param1 hash.Hash + Param2 hash.Hash + } } -// MoqUsual_PassByEllipsis_resultsByParams contains the results for a given set -// of parameters for the Usual type -type MoqUsual_PassByEllipsis_resultsByParams struct { +// MoqGenericResultsFn_resultsByParams contains the results for a given set of +// parameters for the GenericResultsFn type +type MoqGenericResultsFn_resultsByParams[S ~string, E error] struct { AnyCount int AnyParams uint64 - Results map[MoqUsual_PassByEllipsis_paramsKey]*MoqUsual_PassByEllipsis_results + Results map[MoqGenericResultsFn_paramsKey[S, E]]*MoqGenericResultsFn_results[S, E] } -// MoqUsual_PassByEllipsis_doFn defines the type of function needed when -// calling AndDo for the Usual type -type MoqUsual_PassByEllipsis_doFn func(p ...testmoqs.Params) +// MoqGenericResultsFn_doFn defines the type of function needed when calling +// AndDo for the GenericResultsFn type +type MoqGenericResultsFn_doFn[S ~string, E error] func(string, bool) -// MoqUsual_PassByEllipsis_doReturnFn defines the type of function needed when -// calling DoReturnResults for the Usual type -type MoqUsual_PassByEllipsis_doReturnFn func(p ...testmoqs.Params) (string, error) +// MoqGenericResultsFn_doReturnFn defines the type of function needed when +// calling DoReturnResults for the GenericResultsFn type +type MoqGenericResultsFn_doReturnFn[S ~string, E error] func(string, bool) (S, E) -// MoqUsual_PassByEllipsis_results holds the results of the Usual type -type MoqUsual_PassByEllipsis_results struct { - Params MoqUsual_PassByEllipsis_params +// MoqGenericResultsFn_results holds the results of the GenericResultsFn type +type MoqGenericResultsFn_results[S ~string, E error] struct { + Params MoqGenericResultsFn_params[S, E] Results []struct { Values *struct { - Result1 string - Result2 error + Result1 S + Result2 E } Sequence uint32 - DoFn MoqUsual_PassByEllipsis_doFn - DoReturnFn MoqUsual_PassByEllipsis_doReturnFn + DoFn MoqGenericResultsFn_doFn[S, E] + DoReturnFn MoqGenericResultsFn_doReturnFn[S, E] } Index uint32 Repeat *moq.RepeatVal } -// MoqUsual_PassByEllipsis_fnRecorder routes recorded function calls to the -// MoqUsual moq -type MoqUsual_PassByEllipsis_fnRecorder struct { - Params MoqUsual_PassByEllipsis_params +// MoqGenericResultsFn_fnRecorder routes recorded function calls to the +// MoqGenericResultsFn moq +type MoqGenericResultsFn_fnRecorder[S ~string, E error] struct { + Params MoqGenericResultsFn_params[S, E] AnyParams uint64 Sequence bool - Results *MoqUsual_PassByEllipsis_results - Moq *MoqUsual + Results *MoqGenericResultsFn_results[S, E] + Moq *MoqGenericResultsFn[S, E] } -// MoqUsual_PassByEllipsis_anyParams isolates the any params functions of the -// Usual type -type MoqUsual_PassByEllipsis_anyParams struct { - Recorder *MoqUsual_PassByEllipsis_fnRecorder +// MoqGenericResultsFn_anyParams isolates the any params functions of the +// GenericResultsFn type +type MoqGenericResultsFn_anyParams[S ~string, E error] struct { + Recorder *MoqGenericResultsFn_fnRecorder[S, E] } -// MoqUsual_PassByMap_params holds the params of the Usual type -type MoqUsual_PassByMap_params struct{ P map[string]testmoqs.Params } +// NewMoqGenericResultsFn creates a new moq of the GenericResultsFn type +func NewMoqGenericResultsFn[S ~string, E error](scene *moq.Scene, config *moq.Config) *MoqGenericResultsFn[S, E] { + if config == nil { + config = &moq.Config{} + } + m := &MoqGenericResultsFn[S, E]{ + Scene: scene, + Config: *config, + Moq: &MoqGenericResultsFn_mock[S, E]{}, -// MoqUsual_PassByMap_paramsKey holds the map key params of the Usual type -type MoqUsual_PassByMap_paramsKey struct { - Params struct{} - Hashes struct{ P hash.Hash } + Runtime: struct { + ParameterIndexing struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } + }{ParameterIndexing: struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + }{ + Param1: moq.ParamIndexByValue, + Param2: moq.ParamIndexByValue, + }}, + } + m.Moq.Moq = m + + scene.AddMoq(m) + return m } -// MoqUsual_PassByMap_resultsByParams contains the results for a given set of -// parameters for the Usual type -type MoqUsual_PassByMap_resultsByParams struct { - AnyCount int - AnyParams uint64 - Results map[MoqUsual_PassByMap_paramsKey]*MoqUsual_PassByMap_results +// Mock returns the moq implementation of the GenericResultsFn type +func (m *MoqGenericResultsFn[S, E]) Mock() testmoqs.GenericResultsFn[S, E] { + return func(param1 string, param2 bool) (S, E) { + m.Scene.T.Helper() + moq := &MoqGenericResultsFn_mock[S, E]{Moq: m} + return moq.Fn(param1, param2) + } } -// MoqUsual_PassByMap_doFn defines the type of function needed when calling -// AndDo for the Usual type -type MoqUsual_PassByMap_doFn func(p map[string]testmoqs.Params) +func (m *MoqGenericResultsFn_mock[S, E]) Fn(param1 string, param2 bool) (result1 S, result2 E) { + m.Moq.Scene.T.Helper() + params := MoqGenericResultsFn_params[S, E]{ + Param1: param1, + Param2: param2, + } + var results *MoqGenericResultsFn_results[S, E] + for _, resultsByParams := range m.Moq.ResultsByParams { + paramsKey := m.Moq.ParamsKey(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams(params)) + } + return + } -// MoqUsual_PassByMap_doReturnFn defines the type of function needed when -// calling DoReturnResults for the Usual type -type MoqUsual_PassByMap_doReturnFn func(p map[string]testmoqs.Params) map[string]testmoqs.Results + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } -// MoqUsual_PassByMap_results holds the results of the Usual type -type MoqUsual_PassByMap_results struct { - Params MoqUsual_PassByMap_params - Results []struct { - Values *struct { - Result1 map[string]testmoqs.Results + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams(params)) } - Sequence uint32 - DoFn MoqUsual_PassByMap_doFn - DoReturnFn MoqUsual_PassByMap_doReturnFn } - Index uint32 - Repeat *moq.RepeatVal -} -// MoqUsual_PassByMap_fnRecorder routes recorded function calls to the MoqUsual -// moq -type MoqUsual_PassByMap_fnRecorder struct { - Params MoqUsual_PassByMap_params - AnyParams uint64 - Sequence bool - Results *MoqUsual_PassByMap_results - Moq *MoqUsual -} - -// MoqUsual_PassByMap_anyParams isolates the any params functions of the Usual -// type -type MoqUsual_PassByMap_anyParams struct { - Recorder *MoqUsual_PassByMap_fnRecorder -} - -// MoqUsual_PassByReference_params holds the params of the Usual type -type MoqUsual_PassByReference_params struct{ P *testmoqs.Params } + if result.DoFn != nil { + result.DoFn(param1, param2) + } -// MoqUsual_PassByReference_paramsKey holds the map key params of the Usual -// type -type MoqUsual_PassByReference_paramsKey struct { - Params struct{ P *testmoqs.Params } - Hashes struct{ P hash.Hash } + if result.Values != nil { + result1 = result.Values.Result1 + result2 = result.Values.Result2 + } + if result.DoReturnFn != nil { + result1, result2 = result.DoReturnFn(param1, param2) + } + return } -// MoqUsual_PassByReference_resultsByParams contains the results for a given -// set of parameters for the Usual type -type MoqUsual_PassByReference_resultsByParams struct { - AnyCount int - AnyParams uint64 - Results map[MoqUsual_PassByReference_paramsKey]*MoqUsual_PassByReference_results +func (m *MoqGenericResultsFn[S, E]) OnCall(param1 string, param2 bool) *MoqGenericResultsFn_fnRecorder[S, E] { + return &MoqGenericResultsFn_fnRecorder[S, E]{ + Params: MoqGenericResultsFn_params[S, E]{ + Param1: param1, + Param2: param2, + }, + Sequence: m.Config.Sequence == moq.SeqDefaultOn, + Moq: m, + } } -// MoqUsual_PassByReference_doFn defines the type of function needed when -// calling AndDo for the Usual type -type MoqUsual_PassByReference_doFn func(p *testmoqs.Params) - -// MoqUsual_PassByReference_doReturnFn defines the type of function needed when -// calling DoReturnResults for the Usual type -type MoqUsual_PassByReference_doReturnFn func(p *testmoqs.Params) *testmoqs.Results - -// MoqUsual_PassByReference_results holds the results of the Usual type -type MoqUsual_PassByReference_results struct { - Params MoqUsual_PassByReference_params - Results []struct { - Values *struct { - Result1 *testmoqs.Results - } - Sequence uint32 - DoFn MoqUsual_PassByReference_doFn - DoReturnFn MoqUsual_PassByReference_doReturnFn +func (r *MoqGenericResultsFn_fnRecorder[S, E]) Any() *MoqGenericResultsFn_anyParams[S, E] { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams(r.Params)) + return nil } - Index uint32 - Repeat *moq.RepeatVal + return &MoqGenericResultsFn_anyParams[S, E]{Recorder: r} } -// MoqUsual_PassByReference_fnRecorder routes recorded function calls to the -// MoqUsual moq -type MoqUsual_PassByReference_fnRecorder struct { - Params MoqUsual_PassByReference_params - AnyParams uint64 - Sequence bool - Results *MoqUsual_PassByReference_results - Moq *MoqUsual +func (a *MoqGenericResultsFn_anyParams[S, E]) Param1() *MoqGenericResultsFn_fnRecorder[S, E] { + a.Recorder.AnyParams |= 1 << 0 + return a.Recorder } -// MoqUsual_PassByReference_anyParams isolates the any params functions of the -// Usual type -type MoqUsual_PassByReference_anyParams struct { - Recorder *MoqUsual_PassByReference_fnRecorder +func (a *MoqGenericResultsFn_anyParams[S, E]) Param2() *MoqGenericResultsFn_fnRecorder[S, E] { + a.Recorder.AnyParams |= 1 << 1 + return a.Recorder } -// MoqUsual_PassBySlice_params holds the params of the Usual type -type MoqUsual_PassBySlice_params struct{ P []testmoqs.Params } - -// MoqUsual_PassBySlice_paramsKey holds the map key params of the Usual type -type MoqUsual_PassBySlice_paramsKey struct { - Params struct{} - Hashes struct{ P hash.Hash } +func (r *MoqGenericResultsFn_fnRecorder[S, E]) Seq() *MoqGenericResultsFn_fnRecorder[S, E] { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams(r.Params)) + return nil + } + r.Sequence = true + return r } -// MoqUsual_PassBySlice_resultsByParams contains the results for a given set of -// parameters for the Usual type -type MoqUsual_PassBySlice_resultsByParams struct { - AnyCount int - AnyParams uint64 - Results map[MoqUsual_PassBySlice_paramsKey]*MoqUsual_PassBySlice_results +func (r *MoqGenericResultsFn_fnRecorder[S, E]) NoSeq() *MoqGenericResultsFn_fnRecorder[S, E] { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams(r.Params)) + return nil + } + r.Sequence = false + return r } -// MoqUsual_PassBySlice_doFn defines the type of function needed when calling -// AndDo for the Usual type -type MoqUsual_PassBySlice_doFn func(p []testmoqs.Params) +func (r *MoqGenericResultsFn_fnRecorder[S, E]) ReturnResults(result1 S, result2 E) *MoqGenericResultsFn_fnRecorder[S, E] { + r.Moq.Scene.T.Helper() + r.FindResults() -// MoqUsual_PassBySlice_doReturnFn defines the type of function needed when -// calling DoReturnResults for the Usual type -type MoqUsual_PassBySlice_doReturnFn func(p []testmoqs.Params) []testmoqs.Results + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } -// MoqUsual_PassBySlice_results holds the results of the Usual type -type MoqUsual_PassBySlice_results struct { - Params MoqUsual_PassBySlice_params - Results []struct { + r.Results.Results = append(r.Results.Results, struct { Values *struct { - Result1 []testmoqs.Results + Result1 S + Result2 E } Sequence uint32 - DoFn MoqUsual_PassBySlice_doFn - DoReturnFn MoqUsual_PassBySlice_doReturnFn - } - Index uint32 - Repeat *moq.RepeatVal + DoFn MoqGenericResultsFn_doFn[S, E] + DoReturnFn MoqGenericResultsFn_doReturnFn[S, E] + }{ + Values: &struct { + Result1 S + Result2 E + }{ + Result1: result1, + Result2: result2, + }, + Sequence: sequence, + }) + return r } -// MoqUsual_PassBySlice_fnRecorder routes recorded function calls to the -// MoqUsual moq -type MoqUsual_PassBySlice_fnRecorder struct { - Params MoqUsual_PassBySlice_params - AnyParams uint64 - Sequence bool - Results *MoqUsual_PassBySlice_results - Moq *MoqUsual +func (r *MoqGenericResultsFn_fnRecorder[S, E]) AndDo(fn MoqGenericResultsFn_doFn[S, E]) *MoqGenericResultsFn_fnRecorder[S, E] { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") + return nil + } + last := &r.Results.Results[len(r.Results.Results)-1] + last.DoFn = fn + return r } -// MoqUsual_PassBySlice_anyParams isolates the any params functions of the -// Usual type -type MoqUsual_PassBySlice_anyParams struct { - Recorder *MoqUsual_PassBySlice_fnRecorder -} +func (r *MoqGenericResultsFn_fnRecorder[S, E]) DoReturnResults(fn MoqGenericResultsFn_doReturnFn[S, E]) *MoqGenericResultsFn_fnRecorder[S, E] { + r.Moq.Scene.T.Helper() + r.FindResults() -// MoqUsual_PassByValue_params holds the params of the Usual type -type MoqUsual_PassByValue_params struct{ P testmoqs.Params } + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } -// MoqUsual_PassByValue_paramsKey holds the map key params of the Usual type -type MoqUsual_PassByValue_paramsKey struct { - Params struct{ P testmoqs.Params } - Hashes struct{ P hash.Hash } + r.Results.Results = append(r.Results.Results, struct { + Values *struct { + Result1 S + Result2 E + } + Sequence uint32 + DoFn MoqGenericResultsFn_doFn[S, E] + DoReturnFn MoqGenericResultsFn_doReturnFn[S, E] + }{Sequence: sequence, DoReturnFn: fn}) + return r } -// MoqUsual_PassByValue_resultsByParams contains the results for a given set of -// parameters for the Usual type -type MoqUsual_PassByValue_resultsByParams struct { - AnyCount int - AnyParams uint64 - Results map[MoqUsual_PassByValue_paramsKey]*MoqUsual_PassByValue_results -} +func (r *MoqGenericResultsFn_fnRecorder[S, E]) FindResults() { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Results.Repeat.Increment(r.Moq.Scene.T) + return + } -// MoqUsual_PassByValue_doFn defines the type of function needed when calling -// AndDo for the Usual type -type MoqUsual_PassByValue_doFn func(p testmoqs.Params) + anyCount := bits.OnesCount64(r.AnyParams) + insertAt := -1 + var results *MoqGenericResultsFn_resultsByParams[S, E] + for n, res := range r.Moq.ResultsByParams { + if res.AnyParams == r.AnyParams { + results = &res + break + } + if res.AnyCount > anyCount { + insertAt = n + } + } + if results == nil { + results = &MoqGenericResultsFn_resultsByParams[S, E]{ + AnyCount: anyCount, + AnyParams: r.AnyParams, + Results: map[MoqGenericResultsFn_paramsKey[S, E]]*MoqGenericResultsFn_results[S, E]{}, + } + r.Moq.ResultsByParams = append(r.Moq.ResultsByParams, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams) { + copy(r.Moq.ResultsByParams[insertAt+1:], r.Moq.ResultsByParams[insertAt:0]) + r.Moq.ResultsByParams[insertAt] = *results + } + } -// MoqUsual_PassByValue_doReturnFn defines the type of function needed when -// calling DoReturnResults for the Usual type -type MoqUsual_PassByValue_doReturnFn func(p testmoqs.Params) testmoqs.Results + paramsKey := r.Moq.ParamsKey(r.Params, r.AnyParams) -// MoqUsual_PassByValue_results holds the results of the Usual type -type MoqUsual_PassByValue_results struct { - Params MoqUsual_PassByValue_params - Results []struct { - Values *struct { - Result1 testmoqs.Results + var ok bool + r.Results, ok = results.Results[paramsKey] + if !ok { + r.Results = &MoqGenericResultsFn_results[S, E]{ + Params: r.Params, + Results: nil, + Index: 0, + Repeat: &moq.RepeatVal{}, } - Sequence uint32 - DoFn MoqUsual_PassByValue_doFn - DoReturnFn MoqUsual_PassByValue_doReturnFn + results.Results[paramsKey] = r.Results } - Index uint32 - Repeat *moq.RepeatVal -} -// MoqUsual_PassByValue_fnRecorder routes recorded function calls to the -// MoqUsual moq -type MoqUsual_PassByValue_fnRecorder struct { - Params MoqUsual_PassByValue_params - AnyParams uint64 - Sequence bool - Results *MoqUsual_PassByValue_results - Moq *MoqUsual + r.Results.Repeat.Increment(r.Moq.Scene.T) } -// MoqUsual_PassByValue_anyParams isolates the any params functions of the -// Usual type -type MoqUsual_PassByValue_anyParams struct { - Recorder *MoqUsual_PassByValue_fnRecorder -} - -// MoqUsual_InterfaceParam_params holds the params of the Usual type -type MoqUsual_InterfaceParam_params struct{ W io.Writer } - -// MoqUsual_InterfaceParam_paramsKey holds the map key params of the Usual type -type MoqUsual_InterfaceParam_paramsKey struct { - Params struct{ W io.Writer } - Hashes struct{ W hash.Hash } +func (r *MoqGenericResultsFn_fnRecorder[S, E]) Repeat(repeaters ...moq.Repeater) *MoqGenericResultsFn_fnRecorder[S, E] { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") + return nil + } + r.Results.Repeat.Repeat(r.Moq.Scene.T, repeaters) + last := r.Results.Results[len(r.Results.Results)-1] + for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { + if r.Sequence { + last = struct { + Values *struct { + Result1 S + Result2 E + } + Sequence uint32 + DoFn MoqGenericResultsFn_doFn[S, E] + DoReturnFn MoqGenericResultsFn_doReturnFn[S, E] + }{ + Values: last.Values, + Sequence: r.Moq.Scene.NextRecorderSequence(), + } + } + r.Results.Results = append(r.Results.Results, last) + } + return r } -// MoqUsual_InterfaceParam_resultsByParams contains the results for a given set -// of parameters for the Usual type -type MoqUsual_InterfaceParam_resultsByParams struct { - AnyCount int - AnyParams uint64 - Results map[MoqUsual_InterfaceParam_paramsKey]*MoqUsual_InterfaceParam_results +func (m *MoqGenericResultsFn[S, E]) PrettyParams(params MoqGenericResultsFn_params[S, E]) string { + return fmt.Sprintf("GenericResultsFn(%#v, %#v)", params.Param1, params.Param2) } -// MoqUsual_InterfaceParam_doFn defines the type of function needed when -// calling AndDo for the Usual type -type MoqUsual_InterfaceParam_doFn func(w io.Writer) +func (m *MoqGenericResultsFn[S, E]) ParamsKey(params MoqGenericResultsFn_params[S, E], anyParams uint64) MoqGenericResultsFn_paramsKey[S, E] { + m.Scene.T.Helper() + var param1Used string + var param1UsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.Runtime.ParameterIndexing.Param1 == moq.ParamIndexByValue { + param1Used = params.Param1 + } else { + param1UsedHash = hash.DeepHash(params.Param1) + } + } + var param2Used bool + var param2UsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.Runtime.ParameterIndexing.Param2 == moq.ParamIndexByValue { + param2Used = params.Param2 + } else { + param2UsedHash = hash.DeepHash(params.Param2) + } + } + return MoqGenericResultsFn_paramsKey[S, E]{ + Params: struct { + Param1 string + Param2 bool + }{ + Param1: param1Used, + Param2: param2Used, + }, + Hashes: struct { + Param1 hash.Hash + Param2 hash.Hash + }{ + Param1: param1UsedHash, + Param2: param2UsedHash, + }, + } +} -// MoqUsual_InterfaceParam_doReturnFn defines the type of function needed when -// calling DoReturnResults for the Usual type -type MoqUsual_InterfaceParam_doReturnFn func(w io.Writer) (sResult string, err error) +// Reset resets the state of the moq +func (m *MoqGenericResultsFn[S, E]) Reset() { m.ResultsByParams = nil } -// MoqUsual_InterfaceParam_results holds the results of the Usual type -type MoqUsual_InterfaceParam_results struct { - Params MoqUsual_InterfaceParam_params - Results []struct { - Values *struct { - SResult string - Err error +// AssertExpectationsMet asserts that all expectations have been met +func (m *MoqGenericResultsFn[S, E]) AssertExpectationsMet() { + m.Scene.T.Helper() + for _, res := range m.ResultsByParams { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams(results.Params)) + } } - Sequence uint32 - DoFn MoqUsual_InterfaceParam_doFn - DoReturnFn MoqUsual_InterfaceParam_doReturnFn } - Index uint32 - Repeat *moq.RepeatVal } -// MoqUsual_InterfaceParam_fnRecorder routes recorded function calls to the -// MoqUsual moq -type MoqUsual_InterfaceParam_fnRecorder struct { - Params MoqUsual_InterfaceParam_params - AnyParams uint64 - Sequence bool - Results *MoqUsual_InterfaceParam_results - Moq *MoqUsual +// MoqPartialGenericResultsFn holds the state of a moq of the +// PartialGenericResultsFn type +type MoqPartialGenericResultsFn[S ~string] struct { + Scene *moq.Scene + Config moq.Config + Moq *MoqPartialGenericResultsFn_mock[S] + + ResultsByParams []MoqPartialGenericResultsFn_resultsByParams[S] + + Runtime struct { + ParameterIndexing struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } + } } -// MoqUsual_InterfaceParam_anyParams isolates the any params functions of the -// Usual type -type MoqUsual_InterfaceParam_anyParams struct { - Recorder *MoqUsual_InterfaceParam_fnRecorder +// MoqPartialGenericResultsFn_mock isolates the mock interface of the +// PartialGenericResultsFn type +type MoqPartialGenericResultsFn_mock[S ~string] struct { + Moq *MoqPartialGenericResultsFn[S] } -// MoqUsual_InterfaceResult_params holds the params of the Usual type -type MoqUsual_InterfaceResult_params struct { - SParam string - BParam bool +// MoqPartialGenericResultsFn_params holds the params of the +// PartialGenericResultsFn type +type MoqPartialGenericResultsFn_params[S ~string] struct { + Param1 string + Param2 bool } -// MoqUsual_InterfaceResult_paramsKey holds the map key params of the Usual -// type -type MoqUsual_InterfaceResult_paramsKey struct { +// MoqPartialGenericResultsFn_paramsKey holds the map key params of the +// PartialGenericResultsFn type +type MoqPartialGenericResultsFn_paramsKey[S ~string] struct { Params struct { - SParam string - BParam bool + Param1 string + Param2 bool } Hashes struct { - SParam hash.Hash - BParam hash.Hash + Param1 hash.Hash + Param2 hash.Hash } } -// MoqUsual_InterfaceResult_resultsByParams contains the results for a given -// set of parameters for the Usual type -type MoqUsual_InterfaceResult_resultsByParams struct { +// MoqPartialGenericResultsFn_resultsByParams contains the results for a given +// set of parameters for the PartialGenericResultsFn type +type MoqPartialGenericResultsFn_resultsByParams[S ~string] struct { AnyCount int AnyParams uint64 - Results map[MoqUsual_InterfaceResult_paramsKey]*MoqUsual_InterfaceResult_results + Results map[MoqPartialGenericResultsFn_paramsKey[S]]*MoqPartialGenericResultsFn_results[S] } -// MoqUsual_InterfaceResult_doFn defines the type of function needed when -// calling AndDo for the Usual type -type MoqUsual_InterfaceResult_doFn func(sParam string, bParam bool) +// MoqPartialGenericResultsFn_doFn defines the type of function needed when +// calling AndDo for the PartialGenericResultsFn type +type MoqPartialGenericResultsFn_doFn[S ~string] func(string, bool) -// MoqUsual_InterfaceResult_doReturnFn defines the type of function needed when -// calling DoReturnResults for the Usual type -type MoqUsual_InterfaceResult_doReturnFn func(sParam string, bParam bool) (r io.Reader) +// MoqPartialGenericResultsFn_doReturnFn defines the type of function needed +// when calling DoReturnResults for the PartialGenericResultsFn type +type MoqPartialGenericResultsFn_doReturnFn[S ~string] func(string, bool) (S, error) -// MoqUsual_InterfaceResult_results holds the results of the Usual type -type MoqUsual_InterfaceResult_results struct { - Params MoqUsual_InterfaceResult_params +// MoqPartialGenericResultsFn_results holds the results of the +// PartialGenericResultsFn type +type MoqPartialGenericResultsFn_results[S ~string] struct { + Params MoqPartialGenericResultsFn_params[S] Results []struct { - Values *struct{ Result1 io.Reader } + Values *struct { + Result1 S + Result2 error + } Sequence uint32 - DoFn MoqUsual_InterfaceResult_doFn - DoReturnFn MoqUsual_InterfaceResult_doReturnFn + DoFn MoqPartialGenericResultsFn_doFn[S] + DoReturnFn MoqPartialGenericResultsFn_doReturnFn[S] } Index uint32 Repeat *moq.RepeatVal } -// MoqUsual_InterfaceResult_fnRecorder routes recorded function calls to the -// MoqUsual moq -type MoqUsual_InterfaceResult_fnRecorder struct { - Params MoqUsual_InterfaceResult_params +// MoqPartialGenericResultsFn_fnRecorder routes recorded function calls to the +// MoqPartialGenericResultsFn moq +type MoqPartialGenericResultsFn_fnRecorder[S ~string] struct { + Params MoqPartialGenericResultsFn_params[S] AnyParams uint64 Sequence bool - Results *MoqUsual_InterfaceResult_results - Moq *MoqUsual + Results *MoqPartialGenericResultsFn_results[S] + Moq *MoqPartialGenericResultsFn[S] } -// MoqUsual_InterfaceResult_anyParams isolates the any params functions of the -// Usual type -type MoqUsual_InterfaceResult_anyParams struct { - Recorder *MoqUsual_InterfaceResult_fnRecorder +// MoqPartialGenericResultsFn_anyParams isolates the any params functions of +// the PartialGenericResultsFn type +type MoqPartialGenericResultsFn_anyParams[S ~string] struct { + Recorder *MoqPartialGenericResultsFn_fnRecorder[S] } -// MoqUsual_FnParam_params holds the params of the Usual type -type MoqUsual_FnParam_params struct{ Fn func() } +// NewMoqPartialGenericResultsFn creates a new moq of the +// PartialGenericResultsFn type +func NewMoqPartialGenericResultsFn[S ~string](scene *moq.Scene, config *moq.Config) *MoqPartialGenericResultsFn[S] { + if config == nil { + config = &moq.Config{} + } + m := &MoqPartialGenericResultsFn[S]{ + Scene: scene, + Config: *config, + Moq: &MoqPartialGenericResultsFn_mock[S]{}, -// MoqUsual_FnParam_paramsKey holds the map key params of the Usual type -type MoqUsual_FnParam_paramsKey struct { - Params struct{} - Hashes struct{ Fn hash.Hash } + Runtime: struct { + ParameterIndexing struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } + }{ParameterIndexing: struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + }{ + Param1: moq.ParamIndexByValue, + Param2: moq.ParamIndexByValue, + }}, + } + m.Moq.Moq = m + + scene.AddMoq(m) + return m } -// MoqUsual_FnParam_resultsByParams contains the results for a given set of -// parameters for the Usual type -type MoqUsual_FnParam_resultsByParams struct { - AnyCount int - AnyParams uint64 - Results map[MoqUsual_FnParam_paramsKey]*MoqUsual_FnParam_results +// Mock returns the moq implementation of the PartialGenericResultsFn type +func (m *MoqPartialGenericResultsFn[S]) Mock() testmoqs.PartialGenericResultsFn[S] { + return func(param1 string, param2 bool) (S, error) { + m.Scene.T.Helper() + moq := &MoqPartialGenericResultsFn_mock[S]{Moq: m} + return moq.Fn(param1, param2) + } } -// MoqUsual_FnParam_doFn defines the type of function needed when calling AndDo -// for the Usual type -type MoqUsual_FnParam_doFn func(fn func()) +func (m *MoqPartialGenericResultsFn_mock[S]) Fn(param1 string, param2 bool) (result1 S, result2 error) { + m.Moq.Scene.T.Helper() + params := MoqPartialGenericResultsFn_params[S]{ + Param1: param1, + Param2: param2, + } + var results *MoqPartialGenericResultsFn_results[S] + for _, resultsByParams := range m.Moq.ResultsByParams { + paramsKey := m.Moq.ParamsKey(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams(params)) + } + return + } -// MoqUsual_FnParam_doReturnFn defines the type of function needed when calling -// DoReturnResults for the Usual type -type MoqUsual_FnParam_doReturnFn func(fn func()) + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } -// MoqUsual_FnParam_results holds the results of the Usual type -type MoqUsual_FnParam_results struct { - Params MoqUsual_FnParam_params - Results []struct { - Values *struct{} - Sequence uint32 - DoFn MoqUsual_FnParam_doFn - DoReturnFn MoqUsual_FnParam_doReturnFn + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams(params)) + } } - Index uint32 - Repeat *moq.RepeatVal -} -// MoqUsual_FnParam_fnRecorder routes recorded function calls to the MoqUsual -// moq -type MoqUsual_FnParam_fnRecorder struct { - Params MoqUsual_FnParam_params - AnyParams uint64 - Sequence bool - Results *MoqUsual_FnParam_results - Moq *MoqUsual + if result.DoFn != nil { + result.DoFn(param1, param2) + } + + if result.Values != nil { + result1 = result.Values.Result1 + result2 = result.Values.Result2 + } + if result.DoReturnFn != nil { + result1, result2 = result.DoReturnFn(param1, param2) + } + return } -// MoqUsual_FnParam_anyParams isolates the any params functions of the Usual -// type -type MoqUsual_FnParam_anyParams struct { - Recorder *MoqUsual_FnParam_fnRecorder +func (m *MoqPartialGenericResultsFn[S]) OnCall(param1 string, param2 bool) *MoqPartialGenericResultsFn_fnRecorder[S] { + return &MoqPartialGenericResultsFn_fnRecorder[S]{ + Params: MoqPartialGenericResultsFn_params[S]{ + Param1: param1, + Param2: param2, + }, + Sequence: m.Config.Sequence == moq.SeqDefaultOn, + Moq: m, + } } -// MoqUsual_Other_params holds the params of the Usual type -type MoqUsual_Other_params struct{ Param1 other.Params } +func (r *MoqPartialGenericResultsFn_fnRecorder[S]) Any() *MoqPartialGenericResultsFn_anyParams[S] { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams(r.Params)) + return nil + } + return &MoqPartialGenericResultsFn_anyParams[S]{Recorder: r} +} -// MoqUsual_Other_paramsKey holds the map key params of the Usual type -type MoqUsual_Other_paramsKey struct { - Params struct{ Param1 other.Params } - Hashes struct{ Param1 hash.Hash } +func (a *MoqPartialGenericResultsFn_anyParams[S]) Param1() *MoqPartialGenericResultsFn_fnRecorder[S] { + a.Recorder.AnyParams |= 1 << 0 + return a.Recorder } -// MoqUsual_Other_resultsByParams contains the results for a given set of -// parameters for the Usual type -type MoqUsual_Other_resultsByParams struct { - AnyCount int - AnyParams uint64 - Results map[MoqUsual_Other_paramsKey]*MoqUsual_Other_results +func (a *MoqPartialGenericResultsFn_anyParams[S]) Param2() *MoqPartialGenericResultsFn_fnRecorder[S] { + a.Recorder.AnyParams |= 1 << 1 + return a.Recorder } -// MoqUsual_Other_doFn defines the type of function needed when calling AndDo -// for the Usual type -type MoqUsual_Other_doFn func(other.Params) +func (r *MoqPartialGenericResultsFn_fnRecorder[S]) Seq() *MoqPartialGenericResultsFn_fnRecorder[S] { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams(r.Params)) + return nil + } + r.Sequence = true + return r +} -// MoqUsual_Other_doReturnFn defines the type of function needed when calling -// DoReturnResults for the Usual type -type MoqUsual_Other_doReturnFn func(other.Params) other.Results +func (r *MoqPartialGenericResultsFn_fnRecorder[S]) NoSeq() *MoqPartialGenericResultsFn_fnRecorder[S] { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams(r.Params)) + return nil + } + r.Sequence = false + return r +} -// MoqUsual_Other_results holds the results of the Usual type -type MoqUsual_Other_results struct { - Params MoqUsual_Other_params - Results []struct { +func (r *MoqPartialGenericResultsFn_fnRecorder[S]) ReturnResults(result1 S, result2 error) *MoqPartialGenericResultsFn_fnRecorder[S] { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } + + r.Results.Results = append(r.Results.Results, struct { Values *struct { - Result1 other.Results + Result1 S + Result2 error } Sequence uint32 - DoFn MoqUsual_Other_doFn - DoReturnFn MoqUsual_Other_doReturnFn - } - Index uint32 - Repeat *moq.RepeatVal + DoFn MoqPartialGenericResultsFn_doFn[S] + DoReturnFn MoqPartialGenericResultsFn_doReturnFn[S] + }{ + Values: &struct { + Result1 S + Result2 error + }{ + Result1: result1, + Result2: result2, + }, + Sequence: sequence, + }) + return r } -// MoqUsual_Other_fnRecorder routes recorded function calls to the MoqUsual moq -type MoqUsual_Other_fnRecorder struct { - Params MoqUsual_Other_params - AnyParams uint64 - Sequence bool - Results *MoqUsual_Other_results - Moq *MoqUsual +func (r *MoqPartialGenericResultsFn_fnRecorder[S]) AndDo(fn MoqPartialGenericResultsFn_doFn[S]) *MoqPartialGenericResultsFn_fnRecorder[S] { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") + return nil + } + last := &r.Results.Results[len(r.Results.Results)-1] + last.DoFn = fn + return r } -// MoqUsual_Other_anyParams isolates the any params functions of the Usual type -type MoqUsual_Other_anyParams struct { - Recorder *MoqUsual_Other_fnRecorder +func (r *MoqPartialGenericResultsFn_fnRecorder[S]) DoReturnResults(fn MoqPartialGenericResultsFn_doReturnFn[S]) *MoqPartialGenericResultsFn_fnRecorder[S] { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } + + r.Results.Results = append(r.Results.Results, struct { + Values *struct { + Result1 S + Result2 error + } + Sequence uint32 + DoFn MoqPartialGenericResultsFn_doFn[S] + DoReturnFn MoqPartialGenericResultsFn_doReturnFn[S] + }{Sequence: sequence, DoReturnFn: fn}) + return r } -// NewMoqUsual creates a new moq of the Usual type -func NewMoqUsual(scene *moq.Scene, config *moq.Config) *MoqUsual { - if config == nil { - config = &moq.Config{} +func (r *MoqPartialGenericResultsFn_fnRecorder[S]) FindResults() { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Results.Repeat.Increment(r.Moq.Scene.T) + return } - m := &MoqUsual{ - Scene: scene, - Config: *config, - Moq: &MoqUsual_mock{}, - Runtime: struct { - ParameterIndexing struct { - Usual struct { - SParam moq.ParamIndexing - BParam moq.ParamIndexing - } - NoNames struct { - Param1 moq.ParamIndexing - Param2 moq.ParamIndexing - } - NoResults struct { - SParam moq.ParamIndexing - BParam moq.ParamIndexing - } - NoParams struct{} - Nothing struct{} - Variadic struct { - Other moq.ParamIndexing - Args moq.ParamIndexing - } - RepeatedIds struct { - SParam1 moq.ParamIndexing - SParam2 moq.ParamIndexing - BParam moq.ParamIndexing - } - Times struct { - SParam moq.ParamIndexing - Times moq.ParamIndexing - } - DifficultParamNames struct { - Param1 moq.ParamIndexing - Param2 moq.ParamIndexing - Param3 moq.ParamIndexing - Param moq.ParamIndexing - Param5 moq.ParamIndexing - Param6 moq.ParamIndexing - Param7 moq.ParamIndexing - Param8 moq.ParamIndexing - Param9 moq.ParamIndexing - } - DifficultResultNames struct{} - PassByArray struct { - P moq.ParamIndexing - } - PassByChan struct { - P moq.ParamIndexing - } - PassByEllipsis struct { - P moq.ParamIndexing - } - PassByMap struct { - P moq.ParamIndexing - } - PassByReference struct { - P moq.ParamIndexing - } - PassBySlice struct { - P moq.ParamIndexing + anyCount := bits.OnesCount64(r.AnyParams) + insertAt := -1 + var results *MoqPartialGenericResultsFn_resultsByParams[S] + for n, res := range r.Moq.ResultsByParams { + if res.AnyParams == r.AnyParams { + results = &res + break + } + if res.AnyCount > anyCount { + insertAt = n + } + } + if results == nil { + results = &MoqPartialGenericResultsFn_resultsByParams[S]{ + AnyCount: anyCount, + AnyParams: r.AnyParams, + Results: map[MoqPartialGenericResultsFn_paramsKey[S]]*MoqPartialGenericResultsFn_results[S]{}, + } + r.Moq.ResultsByParams = append(r.Moq.ResultsByParams, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams) { + copy(r.Moq.ResultsByParams[insertAt+1:], r.Moq.ResultsByParams[insertAt:0]) + r.Moq.ResultsByParams[insertAt] = *results + } + } + + paramsKey := r.Moq.ParamsKey(r.Params, r.AnyParams) + + var ok bool + r.Results, ok = results.Results[paramsKey] + if !ok { + r.Results = &MoqPartialGenericResultsFn_results[S]{ + Params: r.Params, + Results: nil, + Index: 0, + Repeat: &moq.RepeatVal{}, + } + results.Results[paramsKey] = r.Results + } + + r.Results.Repeat.Increment(r.Moq.Scene.T) +} + +func (r *MoqPartialGenericResultsFn_fnRecorder[S]) Repeat(repeaters ...moq.Repeater) *MoqPartialGenericResultsFn_fnRecorder[S] { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") + return nil + } + r.Results.Repeat.Repeat(r.Moq.Scene.T, repeaters) + last := r.Results.Results[len(r.Results.Results)-1] + for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { + if r.Sequence { + last = struct { + Values *struct { + Result1 S + Result2 error } - PassByValue struct { - P moq.ParamIndexing - } - InterfaceParam struct { - W moq.ParamIndexing - } - InterfaceResult struct { - SParam moq.ParamIndexing - BParam moq.ParamIndexing - } - FnParam struct { - Fn moq.ParamIndexing - } - Other struct { - Param1 moq.ParamIndexing - } - } - }{ParameterIndexing: struct { - Usual struct { - SParam moq.ParamIndexing - BParam moq.ParamIndexing - } - NoNames struct { - Param1 moq.ParamIndexing - Param2 moq.ParamIndexing - } - NoResults struct { - SParam moq.ParamIndexing - BParam moq.ParamIndexing - } - NoParams struct{} - Nothing struct{} - Variadic struct { - Other moq.ParamIndexing - Args moq.ParamIndexing - } - RepeatedIds struct { - SParam1 moq.ParamIndexing - SParam2 moq.ParamIndexing - BParam moq.ParamIndexing - } - Times struct { - SParam moq.ParamIndexing - Times moq.ParamIndexing - } - DifficultParamNames struct { - Param1 moq.ParamIndexing - Param2 moq.ParamIndexing - Param3 moq.ParamIndexing - Param moq.ParamIndexing - Param5 moq.ParamIndexing - Param6 moq.ParamIndexing - Param7 moq.ParamIndexing - Param8 moq.ParamIndexing - Param9 moq.ParamIndexing - } - DifficultResultNames struct{} - PassByArray struct { - P moq.ParamIndexing - } - PassByChan struct { - P moq.ParamIndexing - } - PassByEllipsis struct { - P moq.ParamIndexing - } - PassByMap struct { - P moq.ParamIndexing - } - PassByReference struct { - P moq.ParamIndexing - } - PassBySlice struct { - P moq.ParamIndexing + Sequence uint32 + DoFn MoqPartialGenericResultsFn_doFn[S] + DoReturnFn MoqPartialGenericResultsFn_doReturnFn[S] + }{ + Values: last.Values, + Sequence: r.Moq.Scene.NextRecorderSequence(), } - PassByValue struct { - P moq.ParamIndexing + } + r.Results.Results = append(r.Results.Results, last) + } + return r +} + +func (m *MoqPartialGenericResultsFn[S]) PrettyParams(params MoqPartialGenericResultsFn_params[S]) string { + return fmt.Sprintf("PartialGenericResultsFn(%#v, %#v)", params.Param1, params.Param2) +} + +func (m *MoqPartialGenericResultsFn[S]) ParamsKey(params MoqPartialGenericResultsFn_params[S], anyParams uint64) MoqPartialGenericResultsFn_paramsKey[S] { + m.Scene.T.Helper() + var param1Used string + var param1UsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.Runtime.ParameterIndexing.Param1 == moq.ParamIndexByValue { + param1Used = params.Param1 + } else { + param1UsedHash = hash.DeepHash(params.Param1) + } + } + var param2Used bool + var param2UsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.Runtime.ParameterIndexing.Param2 == moq.ParamIndexByValue { + param2Used = params.Param2 + } else { + param2UsedHash = hash.DeepHash(params.Param2) + } + } + return MoqPartialGenericResultsFn_paramsKey[S]{ + Params: struct { + Param1 string + Param2 bool + }{ + Param1: param1Used, + Param2: param2Used, + }, + Hashes: struct { + Param1 hash.Hash + Param2 hash.Hash + }{ + Param1: param1UsedHash, + Param2: param2UsedHash, + }, + } +} + +// Reset resets the state of the moq +func (m *MoqPartialGenericResultsFn[S]) Reset() { m.ResultsByParams = nil } + +// AssertExpectationsMet asserts that all expectations have been met +func (m *MoqPartialGenericResultsFn[S]) AssertExpectationsMet() { + m.Scene.T.Helper() + for _, res := range m.ResultsByParams { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams(results.Params)) } - InterfaceParam struct { + } + } +} + +// MoqGenericInterfaceParamFn holds the state of a moq of the +// GenericInterfaceParamFn type +type MoqGenericInterfaceParamFn[W testmoqs.MyWriter] struct { + Scene *moq.Scene + Config moq.Config + Moq *MoqGenericInterfaceParamFn_mock[W] + + ResultsByParams []MoqGenericInterfaceParamFn_resultsByParams[W] + + Runtime struct { + ParameterIndexing struct { + W moq.ParamIndexing + } + } +} + +// MoqGenericInterfaceParamFn_mock isolates the mock interface of the +// GenericInterfaceParamFn type +type MoqGenericInterfaceParamFn_mock[W testmoqs.MyWriter] struct { + Moq *MoqGenericInterfaceParamFn[W] +} + +// MoqGenericInterfaceParamFn_params holds the params of the +// GenericInterfaceParamFn type +type MoqGenericInterfaceParamFn_params[W testmoqs.MyWriter] struct{ W W } + +// MoqGenericInterfaceParamFn_paramsKey holds the map key params of the +// GenericInterfaceParamFn type +type MoqGenericInterfaceParamFn_paramsKey[W testmoqs.MyWriter] struct { + Params struct{} + Hashes struct{ W hash.Hash } +} + +// MoqGenericInterfaceParamFn_resultsByParams contains the results for a given +// set of parameters for the GenericInterfaceParamFn type +type MoqGenericInterfaceParamFn_resultsByParams[W testmoqs.MyWriter] struct { + AnyCount int + AnyParams uint64 + Results map[MoqGenericInterfaceParamFn_paramsKey[W]]*MoqGenericInterfaceParamFn_results[W] +} + +// MoqGenericInterfaceParamFn_doFn defines the type of function needed when +// calling AndDo for the GenericInterfaceParamFn type +type MoqGenericInterfaceParamFn_doFn[W testmoqs.MyWriter] func(w W) + +// MoqGenericInterfaceParamFn_doReturnFn defines the type of function needed +// when calling DoReturnResults for the GenericInterfaceParamFn type +type MoqGenericInterfaceParamFn_doReturnFn[W testmoqs.MyWriter] func(w W) (sResult string, err error) + +// MoqGenericInterfaceParamFn_results holds the results of the +// GenericInterfaceParamFn type +type MoqGenericInterfaceParamFn_results[W testmoqs.MyWriter] struct { + Params MoqGenericInterfaceParamFn_params[W] + Results []struct { + Values *struct { + SResult string + Err error + } + Sequence uint32 + DoFn MoqGenericInterfaceParamFn_doFn[W] + DoReturnFn MoqGenericInterfaceParamFn_doReturnFn[W] + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqGenericInterfaceParamFn_fnRecorder routes recorded function calls to the +// MoqGenericInterfaceParamFn moq +type MoqGenericInterfaceParamFn_fnRecorder[W testmoqs.MyWriter] struct { + Params MoqGenericInterfaceParamFn_params[W] + AnyParams uint64 + Sequence bool + Results *MoqGenericInterfaceParamFn_results[W] + Moq *MoqGenericInterfaceParamFn[W] +} + +// MoqGenericInterfaceParamFn_anyParams isolates the any params functions of +// the GenericInterfaceParamFn type +type MoqGenericInterfaceParamFn_anyParams[W testmoqs.MyWriter] struct { + Recorder *MoqGenericInterfaceParamFn_fnRecorder[W] +} + +// NewMoqGenericInterfaceParamFn creates a new moq of the +// GenericInterfaceParamFn type +func NewMoqGenericInterfaceParamFn[W testmoqs.MyWriter](scene *moq.Scene, config *moq.Config) *MoqGenericInterfaceParamFn[W] { + if config == nil { + config = &moq.Config{} + } + m := &MoqGenericInterfaceParamFn[W]{ + Scene: scene, + Config: *config, + Moq: &MoqGenericInterfaceParamFn_mock[W]{}, + + Runtime: struct { + ParameterIndexing struct { W moq.ParamIndexing } - InterfaceResult struct { - SParam moq.ParamIndexing - BParam moq.ParamIndexing - } - FnParam struct { - Fn moq.ParamIndexing - } - Other struct { - Param1 moq.ParamIndexing - } + }{ParameterIndexing: struct { + W moq.ParamIndexing }{ - Usual: struct { - SParam moq.ParamIndexing - BParam moq.ParamIndexing - }{ - SParam: moq.ParamIndexByValue, - BParam: moq.ParamIndexByValue, - }, - NoNames: struct { - Param1 moq.ParamIndexing - Param2 moq.ParamIndexing - }{ - Param1: moq.ParamIndexByValue, - Param2: moq.ParamIndexByValue, - }, - NoResults: struct { - SParam moq.ParamIndexing - BParam moq.ParamIndexing - }{ - SParam: moq.ParamIndexByValue, - BParam: moq.ParamIndexByValue, - }, - NoParams: struct{}{}, - Nothing: struct{}{}, - Variadic: struct { - Other moq.ParamIndexing - Args moq.ParamIndexing - }{ - Other: moq.ParamIndexByValue, - Args: moq.ParamIndexByHash, - }, - RepeatedIds: struct { - SParam1 moq.ParamIndexing - SParam2 moq.ParamIndexing - BParam moq.ParamIndexing - }{ - SParam1: moq.ParamIndexByValue, - SParam2: moq.ParamIndexByValue, - BParam: moq.ParamIndexByValue, - }, - Times: struct { - SParam moq.ParamIndexing - Times moq.ParamIndexing - }{ - SParam: moq.ParamIndexByValue, - Times: moq.ParamIndexByValue, - }, - DifficultParamNames: struct { - Param1 moq.ParamIndexing - Param2 moq.ParamIndexing - Param3 moq.ParamIndexing - Param moq.ParamIndexing - Param5 moq.ParamIndexing - Param6 moq.ParamIndexing - Param7 moq.ParamIndexing - Param8 moq.ParamIndexing - Param9 moq.ParamIndexing - }{ - Param1: moq.ParamIndexByValue, - Param2: moq.ParamIndexByValue, - Param3: moq.ParamIndexByValue, - Param: moq.ParamIndexByValue, - Param5: moq.ParamIndexByValue, - Param6: moq.ParamIndexByValue, - Param7: moq.ParamIndexByValue, - Param8: moq.ParamIndexByValue, - Param9: moq.ParamIndexByValue, - }, - DifficultResultNames: struct{}{}, - PassByArray: struct { - P moq.ParamIndexing - }{ - P: moq.ParamIndexByValue, - }, - PassByChan: struct { - P moq.ParamIndexing - }{ - P: moq.ParamIndexByValue, - }, - PassByEllipsis: struct { - P moq.ParamIndexing - }{ - P: moq.ParamIndexByHash, - }, - PassByMap: struct { - P moq.ParamIndexing - }{ - P: moq.ParamIndexByHash, - }, - PassByReference: struct { - P moq.ParamIndexing - }{ - P: moq.ParamIndexByHash, - }, - PassBySlice: struct { - P moq.ParamIndexing - }{ - P: moq.ParamIndexByHash, - }, - PassByValue: struct { - P moq.ParamIndexing - }{ - P: moq.ParamIndexByValue, - }, - InterfaceParam: struct { - W moq.ParamIndexing - }{ - W: moq.ParamIndexByHash, - }, - InterfaceResult: struct { - SParam moq.ParamIndexing - BParam moq.ParamIndexing - }{ - SParam: moq.ParamIndexByValue, - BParam: moq.ParamIndexByValue, - }, - FnParam: struct { - Fn moq.ParamIndexing - }{ - Fn: moq.ParamIndexByHash, - }, - Other: struct { - Param1 moq.ParamIndexing - }{ - Param1: moq.ParamIndexByValue, - }, + W: moq.ParamIndexByHash, }}, } - m.Moq.Moq = m - - scene.AddMoq(m) - return m + m.Moq.Moq = m + + scene.AddMoq(m) + return m +} + +// Mock returns the moq implementation of the GenericInterfaceParamFn type +func (m *MoqGenericInterfaceParamFn[W]) Mock() testmoqs.GenericInterfaceParamFn[W] { + return func(w W) (_ string, _ error) { + m.Scene.T.Helper() + moq := &MoqGenericInterfaceParamFn_mock[W]{Moq: m} + return moq.Fn(w) + } +} + +func (m *MoqGenericInterfaceParamFn_mock[W]) Fn(w W) (sResult string, err error) { + m.Moq.Scene.T.Helper() + params := MoqGenericInterfaceParamFn_params[W]{ + W: w, + } + var results *MoqGenericInterfaceParamFn_results[W] + for _, resultsByParams := range m.Moq.ResultsByParams { + paramsKey := m.Moq.ParamsKey(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams(params)) + } + } + + if result.DoFn != nil { + result.DoFn(w) + } + + if result.Values != nil { + sResult = result.Values.SResult + err = result.Values.Err + } + if result.DoReturnFn != nil { + sResult, err = result.DoReturnFn(w) + } + return +} + +func (m *MoqGenericInterfaceParamFn[W]) OnCall(w W) *MoqGenericInterfaceParamFn_fnRecorder[W] { + return &MoqGenericInterfaceParamFn_fnRecorder[W]{ + Params: MoqGenericInterfaceParamFn_params[W]{ + W: w, + }, + Sequence: m.Config.Sequence == moq.SeqDefaultOn, + Moq: m, + } +} + +func (r *MoqGenericInterfaceParamFn_fnRecorder[W]) Any() *MoqGenericInterfaceParamFn_anyParams[W] { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams(r.Params)) + return nil + } + return &MoqGenericInterfaceParamFn_anyParams[W]{Recorder: r} +} + +func (a *MoqGenericInterfaceParamFn_anyParams[W]) W() *MoqGenericInterfaceParamFn_fnRecorder[W] { + a.Recorder.AnyParams |= 1 << 0 + return a.Recorder +} + +func (r *MoqGenericInterfaceParamFn_fnRecorder[W]) Seq() *MoqGenericInterfaceParamFn_fnRecorder[W] { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams(r.Params)) + return nil + } + r.Sequence = true + return r +} + +func (r *MoqGenericInterfaceParamFn_fnRecorder[W]) NoSeq() *MoqGenericInterfaceParamFn_fnRecorder[W] { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams(r.Params)) + return nil + } + r.Sequence = false + return r +} + +func (r *MoqGenericInterfaceParamFn_fnRecorder[W]) ReturnResults(sResult string, err error) *MoqGenericInterfaceParamFn_fnRecorder[W] { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } + + r.Results.Results = append(r.Results.Results, struct { + Values *struct { + SResult string + Err error + } + Sequence uint32 + DoFn MoqGenericInterfaceParamFn_doFn[W] + DoReturnFn MoqGenericInterfaceParamFn_doReturnFn[W] + }{ + Values: &struct { + SResult string + Err error + }{ + SResult: sResult, + Err: err, + }, + Sequence: sequence, + }) + return r +} + +func (r *MoqGenericInterfaceParamFn_fnRecorder[W]) AndDo(fn MoqGenericInterfaceParamFn_doFn[W]) *MoqGenericInterfaceParamFn_fnRecorder[W] { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") + return nil + } + last := &r.Results.Results[len(r.Results.Results)-1] + last.DoFn = fn + return r +} + +func (r *MoqGenericInterfaceParamFn_fnRecorder[W]) DoReturnResults(fn MoqGenericInterfaceParamFn_doReturnFn[W]) *MoqGenericInterfaceParamFn_fnRecorder[W] { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } + + r.Results.Results = append(r.Results.Results, struct { + Values *struct { + SResult string + Err error + } + Sequence uint32 + DoFn MoqGenericInterfaceParamFn_doFn[W] + DoReturnFn MoqGenericInterfaceParamFn_doReturnFn[W] + }{Sequence: sequence, DoReturnFn: fn}) + return r +} + +func (r *MoqGenericInterfaceParamFn_fnRecorder[W]) FindResults() { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Results.Repeat.Increment(r.Moq.Scene.T) + return + } + + anyCount := bits.OnesCount64(r.AnyParams) + insertAt := -1 + var results *MoqGenericInterfaceParamFn_resultsByParams[W] + for n, res := range r.Moq.ResultsByParams { + if res.AnyParams == r.AnyParams { + results = &res + break + } + if res.AnyCount > anyCount { + insertAt = n + } + } + if results == nil { + results = &MoqGenericInterfaceParamFn_resultsByParams[W]{ + AnyCount: anyCount, + AnyParams: r.AnyParams, + Results: map[MoqGenericInterfaceParamFn_paramsKey[W]]*MoqGenericInterfaceParamFn_results[W]{}, + } + r.Moq.ResultsByParams = append(r.Moq.ResultsByParams, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams) { + copy(r.Moq.ResultsByParams[insertAt+1:], r.Moq.ResultsByParams[insertAt:0]) + r.Moq.ResultsByParams[insertAt] = *results + } + } + + paramsKey := r.Moq.ParamsKey(r.Params, r.AnyParams) + + var ok bool + r.Results, ok = results.Results[paramsKey] + if !ok { + r.Results = &MoqGenericInterfaceParamFn_results[W]{ + Params: r.Params, + Results: nil, + Index: 0, + Repeat: &moq.RepeatVal{}, + } + results.Results[paramsKey] = r.Results + } + + r.Results.Repeat.Increment(r.Moq.Scene.T) +} + +func (r *MoqGenericInterfaceParamFn_fnRecorder[W]) Repeat(repeaters ...moq.Repeater) *MoqGenericInterfaceParamFn_fnRecorder[W] { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") + return nil + } + r.Results.Repeat.Repeat(r.Moq.Scene.T, repeaters) + last := r.Results.Results[len(r.Results.Results)-1] + for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { + if r.Sequence { + last = struct { + Values *struct { + SResult string + Err error + } + Sequence uint32 + DoFn MoqGenericInterfaceParamFn_doFn[W] + DoReturnFn MoqGenericInterfaceParamFn_doReturnFn[W] + }{ + Values: last.Values, + Sequence: r.Moq.Scene.NextRecorderSequence(), + } + } + r.Results.Results = append(r.Results.Results, last) + } + return r +} + +func (m *MoqGenericInterfaceParamFn[W]) PrettyParams(params MoqGenericInterfaceParamFn_params[W]) string { + return fmt.Sprintf("GenericInterfaceParamFn(%#v)", params.W) +} + +func (m *MoqGenericInterfaceParamFn[W]) ParamsKey(params MoqGenericInterfaceParamFn_params[W], anyParams uint64) MoqGenericInterfaceParamFn_paramsKey[W] { + m.Scene.T.Helper() + var wUsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.Runtime.ParameterIndexing.W == moq.ParamIndexByValue { + m.Scene.T.Fatalf("The w parameter can't be indexed by value") + } + wUsedHash = hash.DeepHash(params.W) + } + return MoqGenericInterfaceParamFn_paramsKey[W]{ + Params: struct{}{}, + Hashes: struct{ W hash.Hash }{ + W: wUsedHash, + }, + } +} + +// Reset resets the state of the moq +func (m *MoqGenericInterfaceParamFn[W]) Reset() { m.ResultsByParams = nil } + +// AssertExpectationsMet asserts that all expectations have been met +func (m *MoqGenericInterfaceParamFn[W]) AssertExpectationsMet() { + m.Scene.T.Helper() + for _, res := range m.ResultsByParams { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams(results.Params)) + } + } + } +} + +// MoqGenericInterfaceResultFn holds the state of a moq of the +// GenericInterfaceResultFn type +type MoqGenericInterfaceResultFn[R testmoqs.MyReader] struct { + Scene *moq.Scene + Config moq.Config + Moq *MoqGenericInterfaceResultFn_mock[R] + + ResultsByParams []MoqGenericInterfaceResultFn_resultsByParams[R] + + Runtime struct { + ParameterIndexing struct { + SParam moq.ParamIndexing + BParam moq.ParamIndexing + } + } +} + +// MoqGenericInterfaceResultFn_mock isolates the mock interface of the +// GenericInterfaceResultFn type +type MoqGenericInterfaceResultFn_mock[R testmoqs.MyReader] struct { + Moq *MoqGenericInterfaceResultFn[R] +} + +// MoqGenericInterfaceResultFn_params holds the params of the +// GenericInterfaceResultFn type +type MoqGenericInterfaceResultFn_params[R testmoqs.MyReader] struct { + SParam string + BParam bool +} + +// MoqGenericInterfaceResultFn_paramsKey holds the map key params of the +// GenericInterfaceResultFn type +type MoqGenericInterfaceResultFn_paramsKey[R testmoqs.MyReader] struct { + Params struct { + SParam string + BParam bool + } + Hashes struct { + SParam hash.Hash + BParam hash.Hash + } +} + +// MoqGenericInterfaceResultFn_resultsByParams contains the results for a given +// set of parameters for the GenericInterfaceResultFn type +type MoqGenericInterfaceResultFn_resultsByParams[R testmoqs.MyReader] struct { + AnyCount int + AnyParams uint64 + Results map[MoqGenericInterfaceResultFn_paramsKey[R]]*MoqGenericInterfaceResultFn_results[R] +} + +// MoqGenericInterfaceResultFn_doFn defines the type of function needed when +// calling AndDo for the GenericInterfaceResultFn type +type MoqGenericInterfaceResultFn_doFn[R testmoqs.MyReader] func(sParam string, bParam bool) + +// MoqGenericInterfaceResultFn_doReturnFn defines the type of function needed +// when calling DoReturnResults for the GenericInterfaceResultFn type +type MoqGenericInterfaceResultFn_doReturnFn[R testmoqs.MyReader] func(sParam string, bParam bool) (r R) + +// MoqGenericInterfaceResultFn_results holds the results of the +// GenericInterfaceResultFn type +type MoqGenericInterfaceResultFn_results[R testmoqs.MyReader] struct { + Params MoqGenericInterfaceResultFn_params[R] + Results []struct { + Values *struct{ Result1 R } + Sequence uint32 + DoFn MoqGenericInterfaceResultFn_doFn[R] + DoReturnFn MoqGenericInterfaceResultFn_doReturnFn[R] + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqGenericInterfaceResultFn_fnRecorder routes recorded function calls to the +// MoqGenericInterfaceResultFn moq +type MoqGenericInterfaceResultFn_fnRecorder[R testmoqs.MyReader] struct { + Params MoqGenericInterfaceResultFn_params[R] + AnyParams uint64 + Sequence bool + Results *MoqGenericInterfaceResultFn_results[R] + Moq *MoqGenericInterfaceResultFn[R] +} + +// MoqGenericInterfaceResultFn_anyParams isolates the any params functions of +// the GenericInterfaceResultFn type +type MoqGenericInterfaceResultFn_anyParams[R testmoqs.MyReader] struct { + Recorder *MoqGenericInterfaceResultFn_fnRecorder[R] +} + +// NewMoqGenericInterfaceResultFn creates a new moq of the +// GenericInterfaceResultFn type +func NewMoqGenericInterfaceResultFn[R testmoqs.MyReader](scene *moq.Scene, config *moq.Config) *MoqGenericInterfaceResultFn[R] { + if config == nil { + config = &moq.Config{} + } + m := &MoqGenericInterfaceResultFn[R]{ + Scene: scene, + Config: *config, + Moq: &MoqGenericInterfaceResultFn_mock[R]{}, + + Runtime: struct { + ParameterIndexing struct { + SParam moq.ParamIndexing + BParam moq.ParamIndexing + } + }{ParameterIndexing: struct { + SParam moq.ParamIndexing + BParam moq.ParamIndexing + }{ + SParam: moq.ParamIndexByValue, + BParam: moq.ParamIndexByValue, + }}, + } + m.Moq.Moq = m + + scene.AddMoq(m) + return m +} + +// Mock returns the moq implementation of the GenericInterfaceResultFn type +func (m *MoqGenericInterfaceResultFn[R]) Mock() testmoqs.GenericInterfaceResultFn[R] { + return func(sParam string, bParam bool) (_ R) { + m.Scene.T.Helper() + moq := &MoqGenericInterfaceResultFn_mock[R]{Moq: m} + return moq.Fn(sParam, bParam) + } +} + +func (m *MoqGenericInterfaceResultFn_mock[R]) Fn(sParam string, bParam bool) (result1 R) { + m.Moq.Scene.T.Helper() + params := MoqGenericInterfaceResultFn_params[R]{ + SParam: sParam, + BParam: bParam, + } + var results *MoqGenericInterfaceResultFn_results[R] + for _, resultsByParams := range m.Moq.ResultsByParams { + paramsKey := m.Moq.ParamsKey(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams(params)) + } + } + + if result.DoFn != nil { + result.DoFn(sParam, bParam) + } + + if result.Values != nil { + result1 = result.Values.Result1 + } + if result.DoReturnFn != nil { + result1 = result.DoReturnFn(sParam, bParam) + } + return +} + +func (m *MoqGenericInterfaceResultFn[R]) OnCall(sParam string, bParam bool) *MoqGenericInterfaceResultFn_fnRecorder[R] { + return &MoqGenericInterfaceResultFn_fnRecorder[R]{ + Params: MoqGenericInterfaceResultFn_params[R]{ + SParam: sParam, + BParam: bParam, + }, + Sequence: m.Config.Sequence == moq.SeqDefaultOn, + Moq: m, + } +} + +func (r *MoqGenericInterfaceResultFn_fnRecorder[R]) Any() *MoqGenericInterfaceResultFn_anyParams[R] { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams(r.Params)) + return nil + } + return &MoqGenericInterfaceResultFn_anyParams[R]{Recorder: r} +} + +func (a *MoqGenericInterfaceResultFn_anyParams[R]) SParam() *MoqGenericInterfaceResultFn_fnRecorder[R] { + a.Recorder.AnyParams |= 1 << 0 + return a.Recorder +} + +func (a *MoqGenericInterfaceResultFn_anyParams[R]) BParam() *MoqGenericInterfaceResultFn_fnRecorder[R] { + a.Recorder.AnyParams |= 1 << 1 + return a.Recorder +} + +func (r *MoqGenericInterfaceResultFn_fnRecorder[R]) Seq() *MoqGenericInterfaceResultFn_fnRecorder[R] { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams(r.Params)) + return nil + } + r.Sequence = true + return r +} + +func (r *MoqGenericInterfaceResultFn_fnRecorder[R]) NoSeq() *MoqGenericInterfaceResultFn_fnRecorder[R] { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams(r.Params)) + return nil + } + r.Sequence = false + return r +} + +func (r *MoqGenericInterfaceResultFn_fnRecorder[R]) ReturnResults(result1 R) *MoqGenericInterfaceResultFn_fnRecorder[R] { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } + + r.Results.Results = append(r.Results.Results, struct { + Values *struct{ Result1 R } + Sequence uint32 + DoFn MoqGenericInterfaceResultFn_doFn[R] + DoReturnFn MoqGenericInterfaceResultFn_doReturnFn[R] + }{ + Values: &struct{ Result1 R }{ + Result1: result1, + }, + Sequence: sequence, + }) + return r +} + +func (r *MoqGenericInterfaceResultFn_fnRecorder[R]) AndDo(fn MoqGenericInterfaceResultFn_doFn[R]) *MoqGenericInterfaceResultFn_fnRecorder[R] { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") + return nil + } + last := &r.Results.Results[len(r.Results.Results)-1] + last.DoFn = fn + return r +} + +func (r *MoqGenericInterfaceResultFn_fnRecorder[R]) DoReturnResults(fn MoqGenericInterfaceResultFn_doReturnFn[R]) *MoqGenericInterfaceResultFn_fnRecorder[R] { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } + + r.Results.Results = append(r.Results.Results, struct { + Values *struct{ Result1 R } + Sequence uint32 + DoFn MoqGenericInterfaceResultFn_doFn[R] + DoReturnFn MoqGenericInterfaceResultFn_doReturnFn[R] + }{Sequence: sequence, DoReturnFn: fn}) + return r +} + +func (r *MoqGenericInterfaceResultFn_fnRecorder[R]) FindResults() { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Results.Repeat.Increment(r.Moq.Scene.T) + return + } + + anyCount := bits.OnesCount64(r.AnyParams) + insertAt := -1 + var results *MoqGenericInterfaceResultFn_resultsByParams[R] + for n, res := range r.Moq.ResultsByParams { + if res.AnyParams == r.AnyParams { + results = &res + break + } + if res.AnyCount > anyCount { + insertAt = n + } + } + if results == nil { + results = &MoqGenericInterfaceResultFn_resultsByParams[R]{ + AnyCount: anyCount, + AnyParams: r.AnyParams, + Results: map[MoqGenericInterfaceResultFn_paramsKey[R]]*MoqGenericInterfaceResultFn_results[R]{}, + } + r.Moq.ResultsByParams = append(r.Moq.ResultsByParams, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams) { + copy(r.Moq.ResultsByParams[insertAt+1:], r.Moq.ResultsByParams[insertAt:0]) + r.Moq.ResultsByParams[insertAt] = *results + } + } + + paramsKey := r.Moq.ParamsKey(r.Params, r.AnyParams) + + var ok bool + r.Results, ok = results.Results[paramsKey] + if !ok { + r.Results = &MoqGenericInterfaceResultFn_results[R]{ + Params: r.Params, + Results: nil, + Index: 0, + Repeat: &moq.RepeatVal{}, + } + results.Results[paramsKey] = r.Results + } + + r.Results.Repeat.Increment(r.Moq.Scene.T) +} + +func (r *MoqGenericInterfaceResultFn_fnRecorder[R]) Repeat(repeaters ...moq.Repeater) *MoqGenericInterfaceResultFn_fnRecorder[R] { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") + return nil + } + r.Results.Repeat.Repeat(r.Moq.Scene.T, repeaters) + last := r.Results.Results[len(r.Results.Results)-1] + for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { + if r.Sequence { + last = struct { + Values *struct{ Result1 R } + Sequence uint32 + DoFn MoqGenericInterfaceResultFn_doFn[R] + DoReturnFn MoqGenericInterfaceResultFn_doReturnFn[R] + }{ + Values: last.Values, + Sequence: r.Moq.Scene.NextRecorderSequence(), + } + } + r.Results.Results = append(r.Results.Results, last) + } + return r +} + +func (m *MoqGenericInterfaceResultFn[R]) PrettyParams(params MoqGenericInterfaceResultFn_params[R]) string { + return fmt.Sprintf("GenericInterfaceResultFn(%#v, %#v)", params.SParam, params.BParam) +} + +func (m *MoqGenericInterfaceResultFn[R]) ParamsKey(params MoqGenericInterfaceResultFn_params[R], anyParams uint64) MoqGenericInterfaceResultFn_paramsKey[R] { + m.Scene.T.Helper() + var sParamUsed string + var sParamUsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.Runtime.ParameterIndexing.SParam == moq.ParamIndexByValue { + sParamUsed = params.SParam + } else { + sParamUsedHash = hash.DeepHash(params.SParam) + } + } + var bParamUsed bool + var bParamUsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.Runtime.ParameterIndexing.BParam == moq.ParamIndexByValue { + bParamUsed = params.BParam + } else { + bParamUsedHash = hash.DeepHash(params.BParam) + } + } + return MoqGenericInterfaceResultFn_paramsKey[R]{ + Params: struct { + SParam string + BParam bool + }{ + SParam: sParamUsed, + BParam: bParamUsed, + }, + Hashes: struct { + SParam hash.Hash + BParam hash.Hash + }{ + SParam: sParamUsedHash, + BParam: bParamUsedHash, + }, + } +} + +// Reset resets the state of the moq +func (m *MoqGenericInterfaceResultFn[R]) Reset() { m.ResultsByParams = nil } + +// AssertExpectationsMet asserts that all expectations have been met +func (m *MoqGenericInterfaceResultFn[R]) AssertExpectationsMet() { + m.Scene.T.Helper() + for _, res := range m.ResultsByParams { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams(results.Params)) + } + } + } +} + +// The following type assertion assures that testmoqs.Usual is mocked +// completely +var _ testmoqs.Usual = (*MoqUsual_mock)(nil) + +// MoqUsual holds the state of a moq of the Usual type +type MoqUsual struct { + Scene *moq.Scene + Config moq.Config + Moq *MoqUsual_mock + + ResultsByParams_Usual []MoqUsual_Usual_resultsByParams + ResultsByParams_NoNames []MoqUsual_NoNames_resultsByParams + ResultsByParams_NoResults []MoqUsual_NoResults_resultsByParams + ResultsByParams_NoParams []MoqUsual_NoParams_resultsByParams + ResultsByParams_Nothing []MoqUsual_Nothing_resultsByParams + ResultsByParams_Variadic []MoqUsual_Variadic_resultsByParams + ResultsByParams_RepeatedIds []MoqUsual_RepeatedIds_resultsByParams + ResultsByParams_Times []MoqUsual_Times_resultsByParams + ResultsByParams_DifficultParamNames []MoqUsual_DifficultParamNames_resultsByParams + ResultsByParams_DifficultResultNames []MoqUsual_DifficultResultNames_resultsByParams + ResultsByParams_PassByArray []MoqUsual_PassByArray_resultsByParams + ResultsByParams_PassByChan []MoqUsual_PassByChan_resultsByParams + ResultsByParams_PassByEllipsis []MoqUsual_PassByEllipsis_resultsByParams + ResultsByParams_PassByMap []MoqUsual_PassByMap_resultsByParams + ResultsByParams_PassByReference []MoqUsual_PassByReference_resultsByParams + ResultsByParams_PassBySlice []MoqUsual_PassBySlice_resultsByParams + ResultsByParams_PassByValue []MoqUsual_PassByValue_resultsByParams + ResultsByParams_InterfaceParam []MoqUsual_InterfaceParam_resultsByParams + ResultsByParams_InterfaceResult []MoqUsual_InterfaceResult_resultsByParams + ResultsByParams_FnParam []MoqUsual_FnParam_resultsByParams + ResultsByParams_Other []MoqUsual_Other_resultsByParams + + Runtime struct { + ParameterIndexing struct { + Usual struct { + SParam moq.ParamIndexing + BParam moq.ParamIndexing + } + NoNames struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } + NoResults struct { + SParam moq.ParamIndexing + BParam moq.ParamIndexing + } + NoParams struct{} + Nothing struct{} + Variadic struct { + Other moq.ParamIndexing + Args moq.ParamIndexing + } + RepeatedIds struct { + SParam1 moq.ParamIndexing + SParam2 moq.ParamIndexing + BParam moq.ParamIndexing + } + Times struct { + SParam moq.ParamIndexing + Times moq.ParamIndexing + } + DifficultParamNames struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + Param3 moq.ParamIndexing + Param moq.ParamIndexing + Param5 moq.ParamIndexing + Param6 moq.ParamIndexing + Param7 moq.ParamIndexing + Param8 moq.ParamIndexing + Param9 moq.ParamIndexing + } + DifficultResultNames struct{} + PassByArray struct { + P moq.ParamIndexing + } + PassByChan struct { + P moq.ParamIndexing + } + PassByEllipsis struct { + P moq.ParamIndexing + } + PassByMap struct { + P moq.ParamIndexing + } + PassByReference struct { + P moq.ParamIndexing + } + PassBySlice struct { + P moq.ParamIndexing + } + PassByValue struct { + P moq.ParamIndexing + } + InterfaceParam struct { + W moq.ParamIndexing + } + InterfaceResult struct { + SParam moq.ParamIndexing + BParam moq.ParamIndexing + } + FnParam struct { + Fn moq.ParamIndexing + } + Other struct { + Param1 moq.ParamIndexing + } + } + } + // MoqUsual_mock isolates the mock interface of the Usual type +} + +type MoqUsual_mock struct { + Moq *MoqUsual +} + +// MoqUsual_recorder isolates the recorder interface of the Usual type +type MoqUsual_recorder struct { + Moq *MoqUsual +} + +// MoqUsual_Usual_params holds the params of the Usual type +type MoqUsual_Usual_params struct { + SParam string + BParam bool +} + +// MoqUsual_Usual_paramsKey holds the map key params of the Usual type +type MoqUsual_Usual_paramsKey struct { + Params struct { + SParam string + BParam bool + } + Hashes struct { + SParam hash.Hash + BParam hash.Hash + } +} + +// MoqUsual_Usual_resultsByParams contains the results for a given set of +// parameters for the Usual type +type MoqUsual_Usual_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_Usual_paramsKey]*MoqUsual_Usual_results +} + +// MoqUsual_Usual_doFn defines the type of function needed when calling AndDo +// for the Usual type +type MoqUsual_Usual_doFn func(sParam string, bParam bool) + +// MoqUsual_Usual_doReturnFn defines the type of function needed when calling +// DoReturnResults for the Usual type +type MoqUsual_Usual_doReturnFn func(sParam string, bParam bool) (sResult string, err error) + +// MoqUsual_Usual_results holds the results of the Usual type +type MoqUsual_Usual_results struct { + Params MoqUsual_Usual_params + Results []struct { + Values *struct { + SResult string + Err error + } + Sequence uint32 + DoFn MoqUsual_Usual_doFn + DoReturnFn MoqUsual_Usual_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_Usual_fnRecorder routes recorded function calls to the MoqUsual moq +type MoqUsual_Usual_fnRecorder struct { + Params MoqUsual_Usual_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_Usual_results + Moq *MoqUsual +} + +// MoqUsual_Usual_anyParams isolates the any params functions of the Usual type +type MoqUsual_Usual_anyParams struct { + Recorder *MoqUsual_Usual_fnRecorder +} + +// MoqUsual_NoNames_params holds the params of the Usual type +type MoqUsual_NoNames_params struct { + Param1 string + Param2 bool +} + +// MoqUsual_NoNames_paramsKey holds the map key params of the Usual type +type MoqUsual_NoNames_paramsKey struct { + Params struct { + Param1 string + Param2 bool + } + Hashes struct { + Param1 hash.Hash + Param2 hash.Hash + } +} + +// MoqUsual_NoNames_resultsByParams contains the results for a given set of +// parameters for the Usual type +type MoqUsual_NoNames_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_NoNames_paramsKey]*MoqUsual_NoNames_results +} + +// MoqUsual_NoNames_doFn defines the type of function needed when calling AndDo +// for the Usual type +type MoqUsual_NoNames_doFn func(string, bool) + +// MoqUsual_NoNames_doReturnFn defines the type of function needed when calling +// DoReturnResults for the Usual type +type MoqUsual_NoNames_doReturnFn func(string, bool) (string, error) + +// MoqUsual_NoNames_results holds the results of the Usual type +type MoqUsual_NoNames_results struct { + Params MoqUsual_NoNames_params + Results []struct { + Values *struct { + Result1 string + Result2 error + } + Sequence uint32 + DoFn MoqUsual_NoNames_doFn + DoReturnFn MoqUsual_NoNames_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_NoNames_fnRecorder routes recorded function calls to the MoqUsual +// moq +type MoqUsual_NoNames_fnRecorder struct { + Params MoqUsual_NoNames_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_NoNames_results + Moq *MoqUsual +} + +// MoqUsual_NoNames_anyParams isolates the any params functions of the Usual +// type +type MoqUsual_NoNames_anyParams struct { + Recorder *MoqUsual_NoNames_fnRecorder +} + +// MoqUsual_NoResults_params holds the params of the Usual type +type MoqUsual_NoResults_params struct { + SParam string + BParam bool +} + +// MoqUsual_NoResults_paramsKey holds the map key params of the Usual type +type MoqUsual_NoResults_paramsKey struct { + Params struct { + SParam string + BParam bool + } + Hashes struct { + SParam hash.Hash + BParam hash.Hash + } +} + +// MoqUsual_NoResults_resultsByParams contains the results for a given set of +// parameters for the Usual type +type MoqUsual_NoResults_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_NoResults_paramsKey]*MoqUsual_NoResults_results +} + +// MoqUsual_NoResults_doFn defines the type of function needed when calling +// AndDo for the Usual type +type MoqUsual_NoResults_doFn func(sParam string, bParam bool) + +// MoqUsual_NoResults_doReturnFn defines the type of function needed when +// calling DoReturnResults for the Usual type +type MoqUsual_NoResults_doReturnFn func(sParam string, bParam bool) + +// MoqUsual_NoResults_results holds the results of the Usual type +type MoqUsual_NoResults_results struct { + Params MoqUsual_NoResults_params + Results []struct { + Values *struct{} + Sequence uint32 + DoFn MoqUsual_NoResults_doFn + DoReturnFn MoqUsual_NoResults_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_NoResults_fnRecorder routes recorded function calls to the MoqUsual +// moq +type MoqUsual_NoResults_fnRecorder struct { + Params MoqUsual_NoResults_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_NoResults_results + Moq *MoqUsual +} + +// MoqUsual_NoResults_anyParams isolates the any params functions of the Usual +// type +type MoqUsual_NoResults_anyParams struct { + Recorder *MoqUsual_NoResults_fnRecorder +} + +// MoqUsual_NoParams_params holds the params of the Usual type +type MoqUsual_NoParams_params struct{} + +// MoqUsual_NoParams_paramsKey holds the map key params of the Usual type +type MoqUsual_NoParams_paramsKey struct { + Params struct{} + Hashes struct{} +} + +// MoqUsual_NoParams_resultsByParams contains the results for a given set of +// parameters for the Usual type +type MoqUsual_NoParams_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_NoParams_paramsKey]*MoqUsual_NoParams_results +} + +// MoqUsual_NoParams_doFn defines the type of function needed when calling +// AndDo for the Usual type +type MoqUsual_NoParams_doFn func() + +// MoqUsual_NoParams_doReturnFn defines the type of function needed when +// calling DoReturnResults for the Usual type +type MoqUsual_NoParams_doReturnFn func() (sResult string, err error) + +// MoqUsual_NoParams_results holds the results of the Usual type +type MoqUsual_NoParams_results struct { + Params MoqUsual_NoParams_params + Results []struct { + Values *struct { + SResult string + Err error + } + Sequence uint32 + DoFn MoqUsual_NoParams_doFn + DoReturnFn MoqUsual_NoParams_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_NoParams_fnRecorder routes recorded function calls to the MoqUsual +// moq +type MoqUsual_NoParams_fnRecorder struct { + Params MoqUsual_NoParams_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_NoParams_results + Moq *MoqUsual +} + +// MoqUsual_NoParams_anyParams isolates the any params functions of the Usual +// type +type MoqUsual_NoParams_anyParams struct { + Recorder *MoqUsual_NoParams_fnRecorder +} + +// MoqUsual_Nothing_params holds the params of the Usual type +type MoqUsual_Nothing_params struct{} + +// MoqUsual_Nothing_paramsKey holds the map key params of the Usual type +type MoqUsual_Nothing_paramsKey struct { + Params struct{} + Hashes struct{} +} + +// MoqUsual_Nothing_resultsByParams contains the results for a given set of +// parameters for the Usual type +type MoqUsual_Nothing_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_Nothing_paramsKey]*MoqUsual_Nothing_results +} + +// MoqUsual_Nothing_doFn defines the type of function needed when calling AndDo +// for the Usual type +type MoqUsual_Nothing_doFn func() + +// MoqUsual_Nothing_doReturnFn defines the type of function needed when calling +// DoReturnResults for the Usual type +type MoqUsual_Nothing_doReturnFn func() + +// MoqUsual_Nothing_results holds the results of the Usual type +type MoqUsual_Nothing_results struct { + Params MoqUsual_Nothing_params + Results []struct { + Values *struct{} + Sequence uint32 + DoFn MoqUsual_Nothing_doFn + DoReturnFn MoqUsual_Nothing_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_Nothing_fnRecorder routes recorded function calls to the MoqUsual +// moq +type MoqUsual_Nothing_fnRecorder struct { + Params MoqUsual_Nothing_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_Nothing_results + Moq *MoqUsual +} + +// MoqUsual_Nothing_anyParams isolates the any params functions of the Usual +// type +type MoqUsual_Nothing_anyParams struct { + Recorder *MoqUsual_Nothing_fnRecorder +} + +// MoqUsual_Variadic_params holds the params of the Usual type +type MoqUsual_Variadic_params struct { + Other bool + Args []string +} + +// MoqUsual_Variadic_paramsKey holds the map key params of the Usual type +type MoqUsual_Variadic_paramsKey struct { + Params struct{ Other bool } + Hashes struct { + Other hash.Hash + Args hash.Hash + } +} + +// MoqUsual_Variadic_resultsByParams contains the results for a given set of +// parameters for the Usual type +type MoqUsual_Variadic_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_Variadic_paramsKey]*MoqUsual_Variadic_results +} + +// MoqUsual_Variadic_doFn defines the type of function needed when calling +// AndDo for the Usual type +type MoqUsual_Variadic_doFn func(other bool, args ...string) + +// MoqUsual_Variadic_doReturnFn defines the type of function needed when +// calling DoReturnResults for the Usual type +type MoqUsual_Variadic_doReturnFn func(other bool, args ...string) (sResult string, err error) + +// MoqUsual_Variadic_results holds the results of the Usual type +type MoqUsual_Variadic_results struct { + Params MoqUsual_Variadic_params + Results []struct { + Values *struct { + SResult string + Err error + } + Sequence uint32 + DoFn MoqUsual_Variadic_doFn + DoReturnFn MoqUsual_Variadic_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_Variadic_fnRecorder routes recorded function calls to the MoqUsual +// moq +type MoqUsual_Variadic_fnRecorder struct { + Params MoqUsual_Variadic_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_Variadic_results + Moq *MoqUsual +} + +// MoqUsual_Variadic_anyParams isolates the any params functions of the Usual +// type +type MoqUsual_Variadic_anyParams struct { + Recorder *MoqUsual_Variadic_fnRecorder +} + +// MoqUsual_RepeatedIds_params holds the params of the Usual type +type MoqUsual_RepeatedIds_params struct { + SParam1, SParam2 string + BParam bool +} + +// MoqUsual_RepeatedIds_paramsKey holds the map key params of the Usual type +type MoqUsual_RepeatedIds_paramsKey struct { + Params struct { + SParam1, SParam2 string + BParam bool + } + Hashes struct { + SParam1, SParam2 hash.Hash + BParam hash.Hash + } +} + +// MoqUsual_RepeatedIds_resultsByParams contains the results for a given set of +// parameters for the Usual type +type MoqUsual_RepeatedIds_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_RepeatedIds_paramsKey]*MoqUsual_RepeatedIds_results +} + +// MoqUsual_RepeatedIds_doFn defines the type of function needed when calling +// AndDo for the Usual type +type MoqUsual_RepeatedIds_doFn func(sParam1, sParam2 string, bParam bool) + +// MoqUsual_RepeatedIds_doReturnFn defines the type of function needed when +// calling DoReturnResults for the Usual type +type MoqUsual_RepeatedIds_doReturnFn func(sParam1, sParam2 string, bParam bool) (sResult1, sResult2 string, err error) + +// MoqUsual_RepeatedIds_results holds the results of the Usual type +type MoqUsual_RepeatedIds_results struct { + Params MoqUsual_RepeatedIds_params + Results []struct { + Values *struct { + SResult1, SResult2 string + Err error + } + Sequence uint32 + DoFn MoqUsual_RepeatedIds_doFn + DoReturnFn MoqUsual_RepeatedIds_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_RepeatedIds_fnRecorder routes recorded function calls to the +// MoqUsual moq +type MoqUsual_RepeatedIds_fnRecorder struct { + Params MoqUsual_RepeatedIds_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_RepeatedIds_results + Moq *MoqUsual +} + +// MoqUsual_RepeatedIds_anyParams isolates the any params functions of the +// Usual type +type MoqUsual_RepeatedIds_anyParams struct { + Recorder *MoqUsual_RepeatedIds_fnRecorder +} + +// MoqUsual_Times_params holds the params of the Usual type +type MoqUsual_Times_params struct { + SParam string + Times bool +} + +// MoqUsual_Times_paramsKey holds the map key params of the Usual type +type MoqUsual_Times_paramsKey struct { + Params struct { + SParam string + Times bool + } + Hashes struct { + SParam hash.Hash + Times hash.Hash + } +} + +// MoqUsual_Times_resultsByParams contains the results for a given set of +// parameters for the Usual type +type MoqUsual_Times_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_Times_paramsKey]*MoqUsual_Times_results +} + +// MoqUsual_Times_doFn defines the type of function needed when calling AndDo +// for the Usual type +type MoqUsual_Times_doFn func(sParam string, times bool) + +// MoqUsual_Times_doReturnFn defines the type of function needed when calling +// DoReturnResults for the Usual type +type MoqUsual_Times_doReturnFn func(sParam string, times bool) (sResult string, err error) + +// MoqUsual_Times_results holds the results of the Usual type +type MoqUsual_Times_results struct { + Params MoqUsual_Times_params + Results []struct { + Values *struct { + SResult string + Err error + } + Sequence uint32 + DoFn MoqUsual_Times_doFn + DoReturnFn MoqUsual_Times_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_Times_fnRecorder routes recorded function calls to the MoqUsual moq +type MoqUsual_Times_fnRecorder struct { + Params MoqUsual_Times_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_Times_results + Moq *MoqUsual +} + +// MoqUsual_Times_anyParams isolates the any params functions of the Usual type +type MoqUsual_Times_anyParams struct { + Recorder *MoqUsual_Times_fnRecorder +} + +// MoqUsual_DifficultParamNames_params holds the params of the Usual type +type MoqUsual_DifficultParamNames_params struct { + Param1, Param2 bool + Param3 string + Param, Param5, Param6 int + Param7, Param8, Param9 float32 +} + +// MoqUsual_DifficultParamNames_paramsKey holds the map key params of the Usual +// type +type MoqUsual_DifficultParamNames_paramsKey struct { + Params struct { + Param1, Param2 bool + Param3 string + Param, Param5, Param6 int + Param7, Param8, Param9 float32 + } + Hashes struct { + Param1, Param2 hash.Hash + Param3 hash.Hash + Param, Param5, Param6 hash.Hash + Param7, Param8, Param9 hash.Hash + } +} + +// MoqUsual_DifficultParamNames_resultsByParams contains the results for a +// given set of parameters for the Usual type +type MoqUsual_DifficultParamNames_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_DifficultParamNames_paramsKey]*MoqUsual_DifficultParamNames_results +} + +// MoqUsual_DifficultParamNames_doFn defines the type of function needed when +// calling AndDo for the Usual type +type MoqUsual_DifficultParamNames_doFn func(m, r bool, sequence string, param, params, i int, result, results, _ float32) + +// MoqUsual_DifficultParamNames_doReturnFn defines the type of function needed +// when calling DoReturnResults for the Usual type +type MoqUsual_DifficultParamNames_doReturnFn func(m, r bool, sequence string, param, params, i int, result, results, _ float32) + +// MoqUsual_DifficultParamNames_results holds the results of the Usual type +type MoqUsual_DifficultParamNames_results struct { + Params MoqUsual_DifficultParamNames_params + Results []struct { + Values *struct{} + Sequence uint32 + DoFn MoqUsual_DifficultParamNames_doFn + DoReturnFn MoqUsual_DifficultParamNames_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_DifficultParamNames_fnRecorder routes recorded function calls to +// the MoqUsual moq +type MoqUsual_DifficultParamNames_fnRecorder struct { + Params MoqUsual_DifficultParamNames_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_DifficultParamNames_results + Moq *MoqUsual +} + +// MoqUsual_DifficultParamNames_anyParams isolates the any params functions of +// the Usual type +type MoqUsual_DifficultParamNames_anyParams struct { + Recorder *MoqUsual_DifficultParamNames_fnRecorder +} + +// MoqUsual_DifficultResultNames_params holds the params of the Usual type +type MoqUsual_DifficultResultNames_params struct{} + +// MoqUsual_DifficultResultNames_paramsKey holds the map key params of the +// Usual type +type MoqUsual_DifficultResultNames_paramsKey struct { + Params struct{} + Hashes struct{} +} + +// MoqUsual_DifficultResultNames_resultsByParams contains the results for a +// given set of parameters for the Usual type +type MoqUsual_DifficultResultNames_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_DifficultResultNames_paramsKey]*MoqUsual_DifficultResultNames_results +} + +// MoqUsual_DifficultResultNames_doFn defines the type of function needed when +// calling AndDo for the Usual type +type MoqUsual_DifficultResultNames_doFn func() + +// MoqUsual_DifficultResultNames_doReturnFn defines the type of function needed +// when calling DoReturnResults for the Usual type +type MoqUsual_DifficultResultNames_doReturnFn func() (m, r string, sequence error, param, params, i int, result, results, _ float32) + +// MoqUsual_DifficultResultNames_results holds the results of the Usual type +type MoqUsual_DifficultResultNames_results struct { + Params MoqUsual_DifficultResultNames_params + Results []struct { + Values *struct { + Result1, Result2 string + Result3 error + Param, Result5, Result6 int + Result7, Result8, Result9 float32 + } + Sequence uint32 + DoFn MoqUsual_DifficultResultNames_doFn + DoReturnFn MoqUsual_DifficultResultNames_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_DifficultResultNames_fnRecorder routes recorded function calls to +// the MoqUsual moq +type MoqUsual_DifficultResultNames_fnRecorder struct { + Params MoqUsual_DifficultResultNames_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_DifficultResultNames_results + Moq *MoqUsual +} + +// MoqUsual_DifficultResultNames_anyParams isolates the any params functions of +// the Usual type +type MoqUsual_DifficultResultNames_anyParams struct { + Recorder *MoqUsual_DifficultResultNames_fnRecorder +} + +// MoqUsual_PassByArray_params holds the params of the Usual type +type MoqUsual_PassByArray_params struct{ P [3]testmoqs.Params } + +// MoqUsual_PassByArray_paramsKey holds the map key params of the Usual type +type MoqUsual_PassByArray_paramsKey struct { + Params struct{ P [3]testmoqs.Params } + Hashes struct{ P hash.Hash } +} + +// MoqUsual_PassByArray_resultsByParams contains the results for a given set of +// parameters for the Usual type +type MoqUsual_PassByArray_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_PassByArray_paramsKey]*MoqUsual_PassByArray_results +} + +// MoqUsual_PassByArray_doFn defines the type of function needed when calling +// AndDo for the Usual type +type MoqUsual_PassByArray_doFn func(p [3]testmoqs.Params) + +// MoqUsual_PassByArray_doReturnFn defines the type of function needed when +// calling DoReturnResults for the Usual type +type MoqUsual_PassByArray_doReturnFn func(p [3]testmoqs.Params) [3]testmoqs.Results + +// MoqUsual_PassByArray_results holds the results of the Usual type +type MoqUsual_PassByArray_results struct { + Params MoqUsual_PassByArray_params + Results []struct { + Values *struct { + Result1 [3]testmoqs.Results + } + Sequence uint32 + DoFn MoqUsual_PassByArray_doFn + DoReturnFn MoqUsual_PassByArray_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_PassByArray_fnRecorder routes recorded function calls to the +// MoqUsual moq +type MoqUsual_PassByArray_fnRecorder struct { + Params MoqUsual_PassByArray_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_PassByArray_results + Moq *MoqUsual +} + +// MoqUsual_PassByArray_anyParams isolates the any params functions of the +// Usual type +type MoqUsual_PassByArray_anyParams struct { + Recorder *MoqUsual_PassByArray_fnRecorder +} + +// MoqUsual_PassByChan_params holds the params of the Usual type +type MoqUsual_PassByChan_params struct{ P chan testmoqs.Params } + +// MoqUsual_PassByChan_paramsKey holds the map key params of the Usual type +type MoqUsual_PassByChan_paramsKey struct { + Params struct{ P chan testmoqs.Params } + Hashes struct{ P hash.Hash } +} + +// MoqUsual_PassByChan_resultsByParams contains the results for a given set of +// parameters for the Usual type +type MoqUsual_PassByChan_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_PassByChan_paramsKey]*MoqUsual_PassByChan_results +} + +// MoqUsual_PassByChan_doFn defines the type of function needed when calling +// AndDo for the Usual type +type MoqUsual_PassByChan_doFn func(p chan testmoqs.Params) + +// MoqUsual_PassByChan_doReturnFn defines the type of function needed when +// calling DoReturnResults for the Usual type +type MoqUsual_PassByChan_doReturnFn func(p chan testmoqs.Params) chan testmoqs.Results + +// MoqUsual_PassByChan_results holds the results of the Usual type +type MoqUsual_PassByChan_results struct { + Params MoqUsual_PassByChan_params + Results []struct { + Values *struct { + Result1 chan testmoqs.Results + } + Sequence uint32 + DoFn MoqUsual_PassByChan_doFn + DoReturnFn MoqUsual_PassByChan_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_PassByChan_fnRecorder routes recorded function calls to the +// MoqUsual moq +type MoqUsual_PassByChan_fnRecorder struct { + Params MoqUsual_PassByChan_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_PassByChan_results + Moq *MoqUsual +} + +// MoqUsual_PassByChan_anyParams isolates the any params functions of the Usual +// type +type MoqUsual_PassByChan_anyParams struct { + Recorder *MoqUsual_PassByChan_fnRecorder +} + +// MoqUsual_PassByEllipsis_params holds the params of the Usual type +type MoqUsual_PassByEllipsis_params struct{ P []testmoqs.Params } + +// MoqUsual_PassByEllipsis_paramsKey holds the map key params of the Usual type +type MoqUsual_PassByEllipsis_paramsKey struct { + Params struct{} + Hashes struct{ P hash.Hash } +} + +// MoqUsual_PassByEllipsis_resultsByParams contains the results for a given set +// of parameters for the Usual type +type MoqUsual_PassByEllipsis_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_PassByEllipsis_paramsKey]*MoqUsual_PassByEllipsis_results +} + +// MoqUsual_PassByEllipsis_doFn defines the type of function needed when +// calling AndDo for the Usual type +type MoqUsual_PassByEllipsis_doFn func(p ...testmoqs.Params) + +// MoqUsual_PassByEllipsis_doReturnFn defines the type of function needed when +// calling DoReturnResults for the Usual type +type MoqUsual_PassByEllipsis_doReturnFn func(p ...testmoqs.Params) (string, error) + +// MoqUsual_PassByEllipsis_results holds the results of the Usual type +type MoqUsual_PassByEllipsis_results struct { + Params MoqUsual_PassByEllipsis_params + Results []struct { + Values *struct { + Result1 string + Result2 error + } + Sequence uint32 + DoFn MoqUsual_PassByEllipsis_doFn + DoReturnFn MoqUsual_PassByEllipsis_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_PassByEllipsis_fnRecorder routes recorded function calls to the +// MoqUsual moq +type MoqUsual_PassByEllipsis_fnRecorder struct { + Params MoqUsual_PassByEllipsis_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_PassByEllipsis_results + Moq *MoqUsual +} + +// MoqUsual_PassByEllipsis_anyParams isolates the any params functions of the +// Usual type +type MoqUsual_PassByEllipsis_anyParams struct { + Recorder *MoqUsual_PassByEllipsis_fnRecorder +} + +// MoqUsual_PassByMap_params holds the params of the Usual type +type MoqUsual_PassByMap_params struct{ P map[string]testmoqs.Params } + +// MoqUsual_PassByMap_paramsKey holds the map key params of the Usual type +type MoqUsual_PassByMap_paramsKey struct { + Params struct{} + Hashes struct{ P hash.Hash } +} + +// MoqUsual_PassByMap_resultsByParams contains the results for a given set of +// parameters for the Usual type +type MoqUsual_PassByMap_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_PassByMap_paramsKey]*MoqUsual_PassByMap_results +} + +// MoqUsual_PassByMap_doFn defines the type of function needed when calling +// AndDo for the Usual type +type MoqUsual_PassByMap_doFn func(p map[string]testmoqs.Params) + +// MoqUsual_PassByMap_doReturnFn defines the type of function needed when +// calling DoReturnResults for the Usual type +type MoqUsual_PassByMap_doReturnFn func(p map[string]testmoqs.Params) map[string]testmoqs.Results + +// MoqUsual_PassByMap_results holds the results of the Usual type +type MoqUsual_PassByMap_results struct { + Params MoqUsual_PassByMap_params + Results []struct { + Values *struct { + Result1 map[string]testmoqs.Results + } + Sequence uint32 + DoFn MoqUsual_PassByMap_doFn + DoReturnFn MoqUsual_PassByMap_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_PassByMap_fnRecorder routes recorded function calls to the MoqUsual +// moq +type MoqUsual_PassByMap_fnRecorder struct { + Params MoqUsual_PassByMap_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_PassByMap_results + Moq *MoqUsual +} + +// MoqUsual_PassByMap_anyParams isolates the any params functions of the Usual +// type +type MoqUsual_PassByMap_anyParams struct { + Recorder *MoqUsual_PassByMap_fnRecorder +} + +// MoqUsual_PassByReference_params holds the params of the Usual type +type MoqUsual_PassByReference_params struct{ P *testmoqs.Params } + +// MoqUsual_PassByReference_paramsKey holds the map key params of the Usual +// type +type MoqUsual_PassByReference_paramsKey struct { + Params struct{ P *testmoqs.Params } + Hashes struct{ P hash.Hash } +} + +// MoqUsual_PassByReference_resultsByParams contains the results for a given +// set of parameters for the Usual type +type MoqUsual_PassByReference_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_PassByReference_paramsKey]*MoqUsual_PassByReference_results +} + +// MoqUsual_PassByReference_doFn defines the type of function needed when +// calling AndDo for the Usual type +type MoqUsual_PassByReference_doFn func(p *testmoqs.Params) + +// MoqUsual_PassByReference_doReturnFn defines the type of function needed when +// calling DoReturnResults for the Usual type +type MoqUsual_PassByReference_doReturnFn func(p *testmoqs.Params) *testmoqs.Results + +// MoqUsual_PassByReference_results holds the results of the Usual type +type MoqUsual_PassByReference_results struct { + Params MoqUsual_PassByReference_params + Results []struct { + Values *struct { + Result1 *testmoqs.Results + } + Sequence uint32 + DoFn MoqUsual_PassByReference_doFn + DoReturnFn MoqUsual_PassByReference_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_PassByReference_fnRecorder routes recorded function calls to the +// MoqUsual moq +type MoqUsual_PassByReference_fnRecorder struct { + Params MoqUsual_PassByReference_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_PassByReference_results + Moq *MoqUsual +} + +// MoqUsual_PassByReference_anyParams isolates the any params functions of the +// Usual type +type MoqUsual_PassByReference_anyParams struct { + Recorder *MoqUsual_PassByReference_fnRecorder +} + +// MoqUsual_PassBySlice_params holds the params of the Usual type +type MoqUsual_PassBySlice_params struct{ P []testmoqs.Params } + +// MoqUsual_PassBySlice_paramsKey holds the map key params of the Usual type +type MoqUsual_PassBySlice_paramsKey struct { + Params struct{} + Hashes struct{ P hash.Hash } +} + +// MoqUsual_PassBySlice_resultsByParams contains the results for a given set of +// parameters for the Usual type +type MoqUsual_PassBySlice_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_PassBySlice_paramsKey]*MoqUsual_PassBySlice_results +} + +// MoqUsual_PassBySlice_doFn defines the type of function needed when calling +// AndDo for the Usual type +type MoqUsual_PassBySlice_doFn func(p []testmoqs.Params) + +// MoqUsual_PassBySlice_doReturnFn defines the type of function needed when +// calling DoReturnResults for the Usual type +type MoqUsual_PassBySlice_doReturnFn func(p []testmoqs.Params) []testmoqs.Results + +// MoqUsual_PassBySlice_results holds the results of the Usual type +type MoqUsual_PassBySlice_results struct { + Params MoqUsual_PassBySlice_params + Results []struct { + Values *struct { + Result1 []testmoqs.Results + } + Sequence uint32 + DoFn MoqUsual_PassBySlice_doFn + DoReturnFn MoqUsual_PassBySlice_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_PassBySlice_fnRecorder routes recorded function calls to the +// MoqUsual moq +type MoqUsual_PassBySlice_fnRecorder struct { + Params MoqUsual_PassBySlice_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_PassBySlice_results + Moq *MoqUsual +} + +// MoqUsual_PassBySlice_anyParams isolates the any params functions of the +// Usual type +type MoqUsual_PassBySlice_anyParams struct { + Recorder *MoqUsual_PassBySlice_fnRecorder +} + +// MoqUsual_PassByValue_params holds the params of the Usual type +type MoqUsual_PassByValue_params struct{ P testmoqs.Params } + +// MoqUsual_PassByValue_paramsKey holds the map key params of the Usual type +type MoqUsual_PassByValue_paramsKey struct { + Params struct{ P testmoqs.Params } + Hashes struct{ P hash.Hash } +} + +// MoqUsual_PassByValue_resultsByParams contains the results for a given set of +// parameters for the Usual type +type MoqUsual_PassByValue_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_PassByValue_paramsKey]*MoqUsual_PassByValue_results +} + +// MoqUsual_PassByValue_doFn defines the type of function needed when calling +// AndDo for the Usual type +type MoqUsual_PassByValue_doFn func(p testmoqs.Params) + +// MoqUsual_PassByValue_doReturnFn defines the type of function needed when +// calling DoReturnResults for the Usual type +type MoqUsual_PassByValue_doReturnFn func(p testmoqs.Params) testmoqs.Results + +// MoqUsual_PassByValue_results holds the results of the Usual type +type MoqUsual_PassByValue_results struct { + Params MoqUsual_PassByValue_params + Results []struct { + Values *struct { + Result1 testmoqs.Results + } + Sequence uint32 + DoFn MoqUsual_PassByValue_doFn + DoReturnFn MoqUsual_PassByValue_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_PassByValue_fnRecorder routes recorded function calls to the +// MoqUsual moq +type MoqUsual_PassByValue_fnRecorder struct { + Params MoqUsual_PassByValue_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_PassByValue_results + Moq *MoqUsual +} + +// MoqUsual_PassByValue_anyParams isolates the any params functions of the +// Usual type +type MoqUsual_PassByValue_anyParams struct { + Recorder *MoqUsual_PassByValue_fnRecorder +} + +// MoqUsual_InterfaceParam_params holds the params of the Usual type +type MoqUsual_InterfaceParam_params struct{ W io.Writer } + +// MoqUsual_InterfaceParam_paramsKey holds the map key params of the Usual type +type MoqUsual_InterfaceParam_paramsKey struct { + Params struct{ W io.Writer } + Hashes struct{ W hash.Hash } +} + +// MoqUsual_InterfaceParam_resultsByParams contains the results for a given set +// of parameters for the Usual type +type MoqUsual_InterfaceParam_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_InterfaceParam_paramsKey]*MoqUsual_InterfaceParam_results +} + +// MoqUsual_InterfaceParam_doFn defines the type of function needed when +// calling AndDo for the Usual type +type MoqUsual_InterfaceParam_doFn func(w io.Writer) + +// MoqUsual_InterfaceParam_doReturnFn defines the type of function needed when +// calling DoReturnResults for the Usual type +type MoqUsual_InterfaceParam_doReturnFn func(w io.Writer) (sResult string, err error) + +// MoqUsual_InterfaceParam_results holds the results of the Usual type +type MoqUsual_InterfaceParam_results struct { + Params MoqUsual_InterfaceParam_params + Results []struct { + Values *struct { + SResult string + Err error + } + Sequence uint32 + DoFn MoqUsual_InterfaceParam_doFn + DoReturnFn MoqUsual_InterfaceParam_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_InterfaceParam_fnRecorder routes recorded function calls to the +// MoqUsual moq +type MoqUsual_InterfaceParam_fnRecorder struct { + Params MoqUsual_InterfaceParam_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_InterfaceParam_results + Moq *MoqUsual +} + +// MoqUsual_InterfaceParam_anyParams isolates the any params functions of the +// Usual type +type MoqUsual_InterfaceParam_anyParams struct { + Recorder *MoqUsual_InterfaceParam_fnRecorder +} + +// MoqUsual_InterfaceResult_params holds the params of the Usual type +type MoqUsual_InterfaceResult_params struct { + SParam string + BParam bool +} + +// MoqUsual_InterfaceResult_paramsKey holds the map key params of the Usual +// type +type MoqUsual_InterfaceResult_paramsKey struct { + Params struct { + SParam string + BParam bool + } + Hashes struct { + SParam hash.Hash + BParam hash.Hash + } +} + +// MoqUsual_InterfaceResult_resultsByParams contains the results for a given +// set of parameters for the Usual type +type MoqUsual_InterfaceResult_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_InterfaceResult_paramsKey]*MoqUsual_InterfaceResult_results +} + +// MoqUsual_InterfaceResult_doFn defines the type of function needed when +// calling AndDo for the Usual type +type MoqUsual_InterfaceResult_doFn func(sParam string, bParam bool) + +// MoqUsual_InterfaceResult_doReturnFn defines the type of function needed when +// calling DoReturnResults for the Usual type +type MoqUsual_InterfaceResult_doReturnFn func(sParam string, bParam bool) (r io.Reader) + +// MoqUsual_InterfaceResult_results holds the results of the Usual type +type MoqUsual_InterfaceResult_results struct { + Params MoqUsual_InterfaceResult_params + Results []struct { + Values *struct{ Result1 io.Reader } + Sequence uint32 + DoFn MoqUsual_InterfaceResult_doFn + DoReturnFn MoqUsual_InterfaceResult_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_InterfaceResult_fnRecorder routes recorded function calls to the +// MoqUsual moq +type MoqUsual_InterfaceResult_fnRecorder struct { + Params MoqUsual_InterfaceResult_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_InterfaceResult_results + Moq *MoqUsual +} + +// MoqUsual_InterfaceResult_anyParams isolates the any params functions of the +// Usual type +type MoqUsual_InterfaceResult_anyParams struct { + Recorder *MoqUsual_InterfaceResult_fnRecorder +} + +// MoqUsual_FnParam_params holds the params of the Usual type +type MoqUsual_FnParam_params struct{ Fn func() } + +// MoqUsual_FnParam_paramsKey holds the map key params of the Usual type +type MoqUsual_FnParam_paramsKey struct { + Params struct{} + Hashes struct{ Fn hash.Hash } +} + +// MoqUsual_FnParam_resultsByParams contains the results for a given set of +// parameters for the Usual type +type MoqUsual_FnParam_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_FnParam_paramsKey]*MoqUsual_FnParam_results +} + +// MoqUsual_FnParam_doFn defines the type of function needed when calling AndDo +// for the Usual type +type MoqUsual_FnParam_doFn func(fn func()) + +// MoqUsual_FnParam_doReturnFn defines the type of function needed when calling +// DoReturnResults for the Usual type +type MoqUsual_FnParam_doReturnFn func(fn func()) + +// MoqUsual_FnParam_results holds the results of the Usual type +type MoqUsual_FnParam_results struct { + Params MoqUsual_FnParam_params + Results []struct { + Values *struct{} + Sequence uint32 + DoFn MoqUsual_FnParam_doFn + DoReturnFn MoqUsual_FnParam_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_FnParam_fnRecorder routes recorded function calls to the MoqUsual +// moq +type MoqUsual_FnParam_fnRecorder struct { + Params MoqUsual_FnParam_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_FnParam_results + Moq *MoqUsual +} + +// MoqUsual_FnParam_anyParams isolates the any params functions of the Usual +// type +type MoqUsual_FnParam_anyParams struct { + Recorder *MoqUsual_FnParam_fnRecorder +} + +// MoqUsual_Other_params holds the params of the Usual type +type MoqUsual_Other_params struct{ Param1 other.Params } + +// MoqUsual_Other_paramsKey holds the map key params of the Usual type +type MoqUsual_Other_paramsKey struct { + Params struct{ Param1 other.Params } + Hashes struct{ Param1 hash.Hash } +} + +// MoqUsual_Other_resultsByParams contains the results for a given set of +// parameters for the Usual type +type MoqUsual_Other_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqUsual_Other_paramsKey]*MoqUsual_Other_results +} + +// MoqUsual_Other_doFn defines the type of function needed when calling AndDo +// for the Usual type +type MoqUsual_Other_doFn func(other.Params) + +// MoqUsual_Other_doReturnFn defines the type of function needed when calling +// DoReturnResults for the Usual type +type MoqUsual_Other_doReturnFn func(other.Params) other.Results + +// MoqUsual_Other_results holds the results of the Usual type +type MoqUsual_Other_results struct { + Params MoqUsual_Other_params + Results []struct { + Values *struct { + Result1 other.Results + } + Sequence uint32 + DoFn MoqUsual_Other_doFn + DoReturnFn MoqUsual_Other_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqUsual_Other_fnRecorder routes recorded function calls to the MoqUsual moq +type MoqUsual_Other_fnRecorder struct { + Params MoqUsual_Other_params + AnyParams uint64 + Sequence bool + Results *MoqUsual_Other_results + Moq *MoqUsual +} + +// MoqUsual_Other_anyParams isolates the any params functions of the Usual type +type MoqUsual_Other_anyParams struct { + Recorder *MoqUsual_Other_fnRecorder +} + +// NewMoqUsual creates a new moq of the Usual type +func NewMoqUsual(scene *moq.Scene, config *moq.Config) *MoqUsual { + if config == nil { + config = &moq.Config{} + } + m := &MoqUsual{ + Scene: scene, + Config: *config, + Moq: &MoqUsual_mock{}, + + Runtime: struct { + ParameterIndexing struct { + Usual struct { + SParam moq.ParamIndexing + BParam moq.ParamIndexing + } + NoNames struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } + NoResults struct { + SParam moq.ParamIndexing + BParam moq.ParamIndexing + } + NoParams struct{} + Nothing struct{} + Variadic struct { + Other moq.ParamIndexing + Args moq.ParamIndexing + } + RepeatedIds struct { + SParam1 moq.ParamIndexing + SParam2 moq.ParamIndexing + BParam moq.ParamIndexing + } + Times struct { + SParam moq.ParamIndexing + Times moq.ParamIndexing + } + DifficultParamNames struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + Param3 moq.ParamIndexing + Param moq.ParamIndexing + Param5 moq.ParamIndexing + Param6 moq.ParamIndexing + Param7 moq.ParamIndexing + Param8 moq.ParamIndexing + Param9 moq.ParamIndexing + } + DifficultResultNames struct{} + PassByArray struct { + P moq.ParamIndexing + } + PassByChan struct { + P moq.ParamIndexing + } + PassByEllipsis struct { + P moq.ParamIndexing + } + PassByMap struct { + P moq.ParamIndexing + } + PassByReference struct { + P moq.ParamIndexing + } + PassBySlice struct { + P moq.ParamIndexing + } + PassByValue struct { + P moq.ParamIndexing + } + InterfaceParam struct { + W moq.ParamIndexing + } + InterfaceResult struct { + SParam moq.ParamIndexing + BParam moq.ParamIndexing + } + FnParam struct { + Fn moq.ParamIndexing + } + Other struct { + Param1 moq.ParamIndexing + } + } + }{ParameterIndexing: struct { + Usual struct { + SParam moq.ParamIndexing + BParam moq.ParamIndexing + } + NoNames struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } + NoResults struct { + SParam moq.ParamIndexing + BParam moq.ParamIndexing + } + NoParams struct{} + Nothing struct{} + Variadic struct { + Other moq.ParamIndexing + Args moq.ParamIndexing + } + RepeatedIds struct { + SParam1 moq.ParamIndexing + SParam2 moq.ParamIndexing + BParam moq.ParamIndexing + } + Times struct { + SParam moq.ParamIndexing + Times moq.ParamIndexing + } + DifficultParamNames struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + Param3 moq.ParamIndexing + Param moq.ParamIndexing + Param5 moq.ParamIndexing + Param6 moq.ParamIndexing + Param7 moq.ParamIndexing + Param8 moq.ParamIndexing + Param9 moq.ParamIndexing + } + DifficultResultNames struct{} + PassByArray struct { + P moq.ParamIndexing + } + PassByChan struct { + P moq.ParamIndexing + } + PassByEllipsis struct { + P moq.ParamIndexing + } + PassByMap struct { + P moq.ParamIndexing + } + PassByReference struct { + P moq.ParamIndexing + } + PassBySlice struct { + P moq.ParamIndexing + } + PassByValue struct { + P moq.ParamIndexing + } + InterfaceParam struct { + W moq.ParamIndexing + } + InterfaceResult struct { + SParam moq.ParamIndexing + BParam moq.ParamIndexing + } + FnParam struct { + Fn moq.ParamIndexing + } + Other struct { + Param1 moq.ParamIndexing + } + }{ + Usual: struct { + SParam moq.ParamIndexing + BParam moq.ParamIndexing + }{ + SParam: moq.ParamIndexByValue, + BParam: moq.ParamIndexByValue, + }, + NoNames: struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + }{ + Param1: moq.ParamIndexByValue, + Param2: moq.ParamIndexByValue, + }, + NoResults: struct { + SParam moq.ParamIndexing + BParam moq.ParamIndexing + }{ + SParam: moq.ParamIndexByValue, + BParam: moq.ParamIndexByValue, + }, + NoParams: struct{}{}, + Nothing: struct{}{}, + Variadic: struct { + Other moq.ParamIndexing + Args moq.ParamIndexing + }{ + Other: moq.ParamIndexByValue, + Args: moq.ParamIndexByHash, + }, + RepeatedIds: struct { + SParam1 moq.ParamIndexing + SParam2 moq.ParamIndexing + BParam moq.ParamIndexing + }{ + SParam1: moq.ParamIndexByValue, + SParam2: moq.ParamIndexByValue, + BParam: moq.ParamIndexByValue, + }, + Times: struct { + SParam moq.ParamIndexing + Times moq.ParamIndexing + }{ + SParam: moq.ParamIndexByValue, + Times: moq.ParamIndexByValue, + }, + DifficultParamNames: struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + Param3 moq.ParamIndexing + Param moq.ParamIndexing + Param5 moq.ParamIndexing + Param6 moq.ParamIndexing + Param7 moq.ParamIndexing + Param8 moq.ParamIndexing + Param9 moq.ParamIndexing + }{ + Param1: moq.ParamIndexByValue, + Param2: moq.ParamIndexByValue, + Param3: moq.ParamIndexByValue, + Param: moq.ParamIndexByValue, + Param5: moq.ParamIndexByValue, + Param6: moq.ParamIndexByValue, + Param7: moq.ParamIndexByValue, + Param8: moq.ParamIndexByValue, + Param9: moq.ParamIndexByValue, + }, + DifficultResultNames: struct{}{}, + PassByArray: struct { + P moq.ParamIndexing + }{ + P: moq.ParamIndexByValue, + }, + PassByChan: struct { + P moq.ParamIndexing + }{ + P: moq.ParamIndexByValue, + }, + PassByEllipsis: struct { + P moq.ParamIndexing + }{ + P: moq.ParamIndexByHash, + }, + PassByMap: struct { + P moq.ParamIndexing + }{ + P: moq.ParamIndexByHash, + }, + PassByReference: struct { + P moq.ParamIndexing + }{ + P: moq.ParamIndexByHash, + }, + PassBySlice: struct { + P moq.ParamIndexing + }{ + P: moq.ParamIndexByHash, + }, + PassByValue: struct { + P moq.ParamIndexing + }{ + P: moq.ParamIndexByValue, + }, + InterfaceParam: struct { + W moq.ParamIndexing + }{ + W: moq.ParamIndexByHash, + }, + InterfaceResult: struct { + SParam moq.ParamIndexing + BParam moq.ParamIndexing + }{ + SParam: moq.ParamIndexByValue, + BParam: moq.ParamIndexByValue, + }, + FnParam: struct { + Fn moq.ParamIndexing + }{ + Fn: moq.ParamIndexByHash, + }, + Other: struct { + Param1 moq.ParamIndexing + }{ + Param1: moq.ParamIndexByValue, + }, + }}, + } + m.Moq.Moq = m + + scene.AddMoq(m) + return m +} + +// Mock returns the mock implementation of the Usual type +func (m *MoqUsual) Mock() *MoqUsual_mock { return m.Moq } + +func (m *MoqUsual_mock) Usual(sParam string, bParam bool) (sResult string, err error) { + m.Moq.Scene.T.Helper() + params := MoqUsual_Usual_params{ + SParam: sParam, + BParam: bParam, + } + var results *MoqUsual_Usual_results + for _, resultsByParams := range m.Moq.ResultsByParams_Usual { + paramsKey := m.Moq.ParamsKey_Usual(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_Usual(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_Usual(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_Usual(params)) + } + } + + if result.DoFn != nil { + result.DoFn(sParam, bParam) + } + + if result.Values != nil { + sResult = result.Values.SResult + err = result.Values.Err + } + if result.DoReturnFn != nil { + sResult, err = result.DoReturnFn(sParam, bParam) + } + return +} + +func (m *MoqUsual_mock) NoNames(param1 string, param2 bool) (result1 string, result2 error) { + m.Moq.Scene.T.Helper() + params := MoqUsual_NoNames_params{ + Param1: param1, + Param2: param2, + } + var results *MoqUsual_NoNames_results + for _, resultsByParams := range m.Moq.ResultsByParams_NoNames { + paramsKey := m.Moq.ParamsKey_NoNames(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_NoNames(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_NoNames(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_NoNames(params)) + } + } + + if result.DoFn != nil { + result.DoFn(param1, param2) + } + + if result.Values != nil { + result1 = result.Values.Result1 + result2 = result.Values.Result2 + } + if result.DoReturnFn != nil { + result1, result2 = result.DoReturnFn(param1, param2) + } + return +} + +func (m *MoqUsual_mock) NoResults(sParam string, bParam bool) { + m.Moq.Scene.T.Helper() + params := MoqUsual_NoResults_params{ + SParam: sParam, + BParam: bParam, + } + var results *MoqUsual_NoResults_results + for _, resultsByParams := range m.Moq.ResultsByParams_NoResults { + paramsKey := m.Moq.ParamsKey_NoResults(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_NoResults(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_NoResults(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_NoResults(params)) + } + } + + if result.DoFn != nil { + result.DoFn(sParam, bParam) + } + + if result.DoReturnFn != nil { + result.DoReturnFn(sParam, bParam) + } + return +} + +func (m *MoqUsual_mock) NoParams() (sResult string, err error) { + m.Moq.Scene.T.Helper() + params := MoqUsual_NoParams_params{} + var results *MoqUsual_NoParams_results + for _, resultsByParams := range m.Moq.ResultsByParams_NoParams { + paramsKey := m.Moq.ParamsKey_NoParams(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_NoParams(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_NoParams(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_NoParams(params)) + } + } + + if result.DoFn != nil { + result.DoFn() + } + + if result.Values != nil { + sResult = result.Values.SResult + err = result.Values.Err + } + if result.DoReturnFn != nil { + sResult, err = result.DoReturnFn() + } + return +} + +func (m *MoqUsual_mock) Nothing() { + m.Moq.Scene.T.Helper() + params := MoqUsual_Nothing_params{} + var results *MoqUsual_Nothing_results + for _, resultsByParams := range m.Moq.ResultsByParams_Nothing { + paramsKey := m.Moq.ParamsKey_Nothing(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_Nothing(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_Nothing(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_Nothing(params)) + } + } + + if result.DoFn != nil { + result.DoFn() + } + + if result.DoReturnFn != nil { + result.DoReturnFn() + } + return +} + +func (m *MoqUsual_mock) Variadic(other bool, args ...string) (sResult string, err error) { + m.Moq.Scene.T.Helper() + params := MoqUsual_Variadic_params{ + Other: other, + Args: args, + } + var results *MoqUsual_Variadic_results + for _, resultsByParams := range m.Moq.ResultsByParams_Variadic { + paramsKey := m.Moq.ParamsKey_Variadic(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_Variadic(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_Variadic(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_Variadic(params)) + } + } + + if result.DoFn != nil { + result.DoFn(other, args...) + } + + if result.Values != nil { + sResult = result.Values.SResult + err = result.Values.Err + } + if result.DoReturnFn != nil { + sResult, err = result.DoReturnFn(other, args...) + } + return +} + +func (m *MoqUsual_mock) RepeatedIds(sParam1, sParam2 string, bParam bool) (sResult1, sResult2 string, err error) { + m.Moq.Scene.T.Helper() + params := MoqUsual_RepeatedIds_params{ + SParam1: sParam1, + SParam2: sParam2, + BParam: bParam, + } + var results *MoqUsual_RepeatedIds_results + for _, resultsByParams := range m.Moq.ResultsByParams_RepeatedIds { + paramsKey := m.Moq.ParamsKey_RepeatedIds(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_RepeatedIds(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_RepeatedIds(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_RepeatedIds(params)) + } + } + + if result.DoFn != nil { + result.DoFn(sParam1, sParam2, bParam) + } + + if result.Values != nil { + sResult1 = result.Values.SResult1 + sResult2 = result.Values.SResult2 + err = result.Values.Err + } + if result.DoReturnFn != nil { + sResult1, sResult2, err = result.DoReturnFn(sParam1, sParam2, bParam) + } + return +} + +func (m *MoqUsual_mock) Times(sParam string, times bool) (sResult string, err error) { + m.Moq.Scene.T.Helper() + params := MoqUsual_Times_params{ + SParam: sParam, + Times: times, + } + var results *MoqUsual_Times_results + for _, resultsByParams := range m.Moq.ResultsByParams_Times { + paramsKey := m.Moq.ParamsKey_Times(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_Times(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_Times(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_Times(params)) + } + } + + if result.DoFn != nil { + result.DoFn(sParam, times) + } + + if result.Values != nil { + sResult = result.Values.SResult + err = result.Values.Err + } + if result.DoReturnFn != nil { + sResult, err = result.DoReturnFn(sParam, times) + } + return +} + +func (m *MoqUsual_mock) DifficultParamNames(param1, param2 bool, param3 string, param, param5, param6 int, param7, param8, param9 float32) { + m.Moq.Scene.T.Helper() + params := MoqUsual_DifficultParamNames_params{ + Param1: param1, + Param2: param2, + Param3: param3, + Param: param, + Param5: param5, + Param6: param6, + Param7: param7, + Param8: param8, + Param9: param9, + } + var results *MoqUsual_DifficultParamNames_results + for _, resultsByParams := range m.Moq.ResultsByParams_DifficultParamNames { + paramsKey := m.Moq.ParamsKey_DifficultParamNames(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_DifficultParamNames(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_DifficultParamNames(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_DifficultParamNames(params)) + } + } + + if result.DoFn != nil { + result.DoFn(param1, param2, param3, param, param5, param6, param7, param8, param9) + } + + if result.DoReturnFn != nil { + result.DoReturnFn(param1, param2, param3, param, param5, param6, param7, param8, param9) + } + return +} + +func (m *MoqUsual_mock) DifficultResultNames() (result1, result2 string, result3 error, param, result5, result6 int, result7, result8, result9 float32) { + m.Moq.Scene.T.Helper() + params := MoqUsual_DifficultResultNames_params{} + var results *MoqUsual_DifficultResultNames_results + for _, resultsByParams := range m.Moq.ResultsByParams_DifficultResultNames { + paramsKey := m.Moq.ParamsKey_DifficultResultNames(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_DifficultResultNames(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_DifficultResultNames(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_DifficultResultNames(params)) + } + } + + if result.DoFn != nil { + result.DoFn() + } + + if result.Values != nil { + result1 = result.Values.Result1 + result2 = result.Values.Result2 + result3 = result.Values.Result3 + param = result.Values.Param + result5 = result.Values.Result5 + result6 = result.Values.Result6 + result7 = result.Values.Result7 + result8 = result.Values.Result8 + result9 = result.Values.Result9 + } + if result.DoReturnFn != nil { + result1, result2, result3, param, result5, result6, result7, result8, result9 = result.DoReturnFn() + } + return +} + +func (m *MoqUsual_mock) PassByArray(p [3]testmoqs.Params) (result1 [3]testmoqs.Results) { + m.Moq.Scene.T.Helper() + params := MoqUsual_PassByArray_params{ + P: p, + } + var results *MoqUsual_PassByArray_results + for _, resultsByParams := range m.Moq.ResultsByParams_PassByArray { + paramsKey := m.Moq.ParamsKey_PassByArray(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_PassByArray(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_PassByArray(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_PassByArray(params)) + } + } + + if result.DoFn != nil { + result.DoFn(p) + } + + if result.Values != nil { + result1 = result.Values.Result1 + } + if result.DoReturnFn != nil { + result1 = result.DoReturnFn(p) + } + return +} + +func (m *MoqUsual_mock) PassByChan(p chan testmoqs.Params) (result1 chan testmoqs.Results) { + m.Moq.Scene.T.Helper() + params := MoqUsual_PassByChan_params{ + P: p, + } + var results *MoqUsual_PassByChan_results + for _, resultsByParams := range m.Moq.ResultsByParams_PassByChan { + paramsKey := m.Moq.ParamsKey_PassByChan(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_PassByChan(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_PassByChan(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_PassByChan(params)) + } + } + + if result.DoFn != nil { + result.DoFn(p) + } + + if result.Values != nil { + result1 = result.Values.Result1 + } + if result.DoReturnFn != nil { + result1 = result.DoReturnFn(p) + } + return +} + +func (m *MoqUsual_mock) PassByEllipsis(p ...testmoqs.Params) (result1 string, result2 error) { + m.Moq.Scene.T.Helper() + params := MoqUsual_PassByEllipsis_params{ + P: p, + } + var results *MoqUsual_PassByEllipsis_results + for _, resultsByParams := range m.Moq.ResultsByParams_PassByEllipsis { + paramsKey := m.Moq.ParamsKey_PassByEllipsis(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_PassByEllipsis(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_PassByEllipsis(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_PassByEllipsis(params)) + } + } + + if result.DoFn != nil { + result.DoFn(p...) + } + + if result.Values != nil { + result1 = result.Values.Result1 + result2 = result.Values.Result2 + } + if result.DoReturnFn != nil { + result1, result2 = result.DoReturnFn(p...) + } + return +} + +func (m *MoqUsual_mock) PassByMap(p map[string]testmoqs.Params) (result1 map[string]testmoqs.Results) { + m.Moq.Scene.T.Helper() + params := MoqUsual_PassByMap_params{ + P: p, + } + var results *MoqUsual_PassByMap_results + for _, resultsByParams := range m.Moq.ResultsByParams_PassByMap { + paramsKey := m.Moq.ParamsKey_PassByMap(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_PassByMap(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_PassByMap(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_PassByMap(params)) + } + } + + if result.DoFn != nil { + result.DoFn(p) + } + + if result.Values != nil { + result1 = result.Values.Result1 + } + if result.DoReturnFn != nil { + result1 = result.DoReturnFn(p) + } + return +} + +func (m *MoqUsual_mock) PassByReference(p *testmoqs.Params) (result1 *testmoqs.Results) { + m.Moq.Scene.T.Helper() + params := MoqUsual_PassByReference_params{ + P: p, + } + var results *MoqUsual_PassByReference_results + for _, resultsByParams := range m.Moq.ResultsByParams_PassByReference { + paramsKey := m.Moq.ParamsKey_PassByReference(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_PassByReference(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_PassByReference(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_PassByReference(params)) + } + } + + if result.DoFn != nil { + result.DoFn(p) + } + + if result.Values != nil { + result1 = result.Values.Result1 + } + if result.DoReturnFn != nil { + result1 = result.DoReturnFn(p) + } + return +} + +func (m *MoqUsual_mock) PassBySlice(p []testmoqs.Params) (result1 []testmoqs.Results) { + m.Moq.Scene.T.Helper() + params := MoqUsual_PassBySlice_params{ + P: p, + } + var results *MoqUsual_PassBySlice_results + for _, resultsByParams := range m.Moq.ResultsByParams_PassBySlice { + paramsKey := m.Moq.ParamsKey_PassBySlice(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_PassBySlice(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_PassBySlice(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_PassBySlice(params)) + } + } + + if result.DoFn != nil { + result.DoFn(p) + } + + if result.Values != nil { + result1 = result.Values.Result1 + } + if result.DoReturnFn != nil { + result1 = result.DoReturnFn(p) + } + return +} + +func (m *MoqUsual_mock) PassByValue(p testmoqs.Params) (result1 testmoqs.Results) { + m.Moq.Scene.T.Helper() + params := MoqUsual_PassByValue_params{ + P: p, + } + var results *MoqUsual_PassByValue_results + for _, resultsByParams := range m.Moq.ResultsByParams_PassByValue { + paramsKey := m.Moq.ParamsKey_PassByValue(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_PassByValue(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_PassByValue(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_PassByValue(params)) + } + } + + if result.DoFn != nil { + result.DoFn(p) + } + + if result.Values != nil { + result1 = result.Values.Result1 + } + if result.DoReturnFn != nil { + result1 = result.DoReturnFn(p) + } + return +} + +func (m *MoqUsual_mock) InterfaceParam(w io.Writer) (sResult string, err error) { + m.Moq.Scene.T.Helper() + params := MoqUsual_InterfaceParam_params{ + W: w, + } + var results *MoqUsual_InterfaceParam_results + for _, resultsByParams := range m.Moq.ResultsByParams_InterfaceParam { + paramsKey := m.Moq.ParamsKey_InterfaceParam(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_InterfaceParam(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_InterfaceParam(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_InterfaceParam(params)) + } + } + + if result.DoFn != nil { + result.DoFn(w) + } + + if result.Values != nil { + sResult = result.Values.SResult + err = result.Values.Err + } + if result.DoReturnFn != nil { + sResult, err = result.DoReturnFn(w) + } + return } -// Mock returns the mock implementation of the Usual type -func (m *MoqUsual) Mock() *MoqUsual_mock { return m.Moq } - -func (m *MoqUsual_mock) Usual(sParam string, bParam bool) (sResult string, err error) { +func (m *MoqUsual_mock) InterfaceResult(sParam string, bParam bool) (result1 io.Reader) { m.Moq.Scene.T.Helper() - params := MoqUsual_Usual_params{ + params := MoqUsual_InterfaceResult_params{ SParam: sParam, BParam: bParam, } - var results *MoqUsual_Usual_results - for _, resultsByParams := range m.Moq.ResultsByParams_Usual { - paramsKey := m.Moq.ParamsKey_Usual(params, resultsByParams.AnyParams) + var results *MoqUsual_InterfaceResult_results + for _, resultsByParams := range m.Moq.ResultsByParams_InterfaceResult { + paramsKey := m.Moq.ParamsKey_InterfaceResult(params, resultsByParams.AnyParams) var ok bool results, ok = resultsByParams.Results[paramsKey] if ok { @@ -9393,7 +12874,7 @@ func (m *MoqUsual_mock) Usual(sParam string, bParam bool) (sResult string, err e } if results == nil { if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_Usual(params)) + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_InterfaceResult(params)) } return } @@ -9402,7 +12883,7 @@ func (m *MoqUsual_mock) Usual(sParam string, bParam bool) (sResult string, err e if i >= results.Repeat.ResultCount { if !results.Repeat.AnyTimes { if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_Usual(params)) + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_InterfaceResult(params)) } return } @@ -9413,7 +12894,7 @@ func (m *MoqUsual_mock) Usual(sParam string, bParam bool) (sResult string, err e if result.Sequence != 0 { sequence := m.Moq.Scene.NextMockSequence() if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_Usual(params)) + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_InterfaceResult(params)) } } @@ -9422,24 +12903,72 @@ func (m *MoqUsual_mock) Usual(sParam string, bParam bool) (sResult string, err e } if result.Values != nil { - sResult = result.Values.SResult - err = result.Values.Err + result1 = result.Values.Result1 } if result.DoReturnFn != nil { - sResult, err = result.DoReturnFn(sParam, bParam) + result1 = result.DoReturnFn(sParam, bParam) } return } -func (m *MoqUsual_mock) NoNames(param1 string, param2 bool) (result1 string, result2 error) { +func (m *MoqUsual_mock) FnParam(fn func()) { m.Moq.Scene.T.Helper() - params := MoqUsual_NoNames_params{ + params := MoqUsual_FnParam_params{ + Fn: fn, + } + var results *MoqUsual_FnParam_results + for _, resultsByParams := range m.Moq.ResultsByParams_FnParam { + paramsKey := m.Moq.ParamsKey_FnParam(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_FnParam(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_FnParam(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_FnParam(params)) + } + } + + if result.DoFn != nil { + result.DoFn(fn) + } + + if result.DoReturnFn != nil { + result.DoReturnFn(fn) + } + return +} + +func (m *MoqUsual_mock) Other(param1 other.Params) (result1 other.Results) { + m.Moq.Scene.T.Helper() + params := MoqUsual_Other_params{ Param1: param1, - Param2: param2, } - var results *MoqUsual_NoNames_results - for _, resultsByParams := range m.Moq.ResultsByParams_NoNames { - paramsKey := m.Moq.ParamsKey_NoNames(params, resultsByParams.AnyParams) + var results *MoqUsual_Other_results + for _, resultsByParams := range m.Moq.ResultsByParams_Other { + paramsKey := m.Moq.ParamsKey_Other(params, resultsByParams.AnyParams) var ok bool results, ok = resultsByParams.Results[paramsKey] if ok { @@ -9447,1121 +12976,1615 @@ func (m *MoqUsual_mock) NoNames(param1 string, param2 bool) (result1 string, res } } if results == nil { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_NoNames(params)) + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_Other(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_Other(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_Other(params)) + } + } + + if result.DoFn != nil { + result.DoFn(param1) + } + + if result.Values != nil { + result1 = result.Values.Result1 + } + if result.DoReturnFn != nil { + result1 = result.DoReturnFn(param1) + } + return +} + +// OnCall returns the recorder implementation of the Usual type +func (m *MoqUsual) OnCall() *MoqUsual_recorder { + return &MoqUsual_recorder{ + Moq: m, + } +} + +func (m *MoqUsual_recorder) Usual(sParam string, bParam bool) *MoqUsual_Usual_fnRecorder { + return &MoqUsual_Usual_fnRecorder{ + Params: MoqUsual_Usual_params{ + SParam: sParam, + BParam: bParam, + }, + Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, + Moq: m.Moq, + } +} + +func (r *MoqUsual_Usual_fnRecorder) Any() *MoqUsual_Usual_anyParams { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) + return nil + } + return &MoqUsual_Usual_anyParams{Recorder: r} +} + +func (a *MoqUsual_Usual_anyParams) SParam() *MoqUsual_Usual_fnRecorder { + a.Recorder.AnyParams |= 1 << 0 + return a.Recorder +} + +func (a *MoqUsual_Usual_anyParams) BParam() *MoqUsual_Usual_fnRecorder { + a.Recorder.AnyParams |= 1 << 1 + return a.Recorder +} + +func (r *MoqUsual_Usual_fnRecorder) Seq() *MoqUsual_Usual_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) + return nil + } + r.Sequence = true + return r +} + +func (r *MoqUsual_Usual_fnRecorder) NoSeq() *MoqUsual_Usual_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) + return nil + } + r.Sequence = false + return r +} + +func (r *MoqUsual_Usual_fnRecorder) ReturnResults(sResult string, err error) *MoqUsual_Usual_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } + + r.Results.Results = append(r.Results.Results, struct { + Values *struct { + SResult string + Err error + } + Sequence uint32 + DoFn MoqUsual_Usual_doFn + DoReturnFn MoqUsual_Usual_doReturnFn + }{ + Values: &struct { + SResult string + Err error + }{ + SResult: sResult, + Err: err, + }, + Sequence: sequence, + }) + return r +} + +func (r *MoqUsual_Usual_fnRecorder) AndDo(fn MoqUsual_Usual_doFn) *MoqUsual_Usual_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") + return nil + } + last := &r.Results.Results[len(r.Results.Results)-1] + last.DoFn = fn + return r +} + +func (r *MoqUsual_Usual_fnRecorder) DoReturnResults(fn MoqUsual_Usual_doReturnFn) *MoqUsual_Usual_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } + + r.Results.Results = append(r.Results.Results, struct { + Values *struct { + SResult string + Err error + } + Sequence uint32 + DoFn MoqUsual_Usual_doFn + DoReturnFn MoqUsual_Usual_doReturnFn + }{Sequence: sequence, DoReturnFn: fn}) + return r +} + +func (r *MoqUsual_Usual_fnRecorder) FindResults() { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Results.Repeat.Increment(r.Moq.Scene.T) + return + } + + anyCount := bits.OnesCount64(r.AnyParams) + insertAt := -1 + var results *MoqUsual_Usual_resultsByParams + for n, res := range r.Moq.ResultsByParams_Usual { + if res.AnyParams == r.AnyParams { + results = &res + break + } + if res.AnyCount > anyCount { + insertAt = n + } + } + if results == nil { + results = &MoqUsual_Usual_resultsByParams{ + AnyCount: anyCount, + AnyParams: r.AnyParams, + Results: map[MoqUsual_Usual_paramsKey]*MoqUsual_Usual_results{}, } - return - } - - i := int(atomic.AddUint32(&results.Index, 1)) - 1 - if i >= results.Repeat.ResultCount { - if !results.Repeat.AnyTimes { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_NoNames(params)) - } - return + r.Moq.ResultsByParams_Usual = append(r.Moq.ResultsByParams_Usual, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_Usual) { + copy(r.Moq.ResultsByParams_Usual[insertAt+1:], r.Moq.ResultsByParams_Usual[insertAt:0]) + r.Moq.ResultsByParams_Usual[insertAt] = *results } - i = results.Repeat.ResultCount - 1 } - result := results.Results[i] - if result.Sequence != 0 { - sequence := m.Moq.Scene.NextMockSequence() - if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_NoNames(params)) + paramsKey := r.Moq.ParamsKey_Usual(r.Params, r.AnyParams) + + var ok bool + r.Results, ok = results.Results[paramsKey] + if !ok { + r.Results = &MoqUsual_Usual_results{ + Params: r.Params, + Results: nil, + Index: 0, + Repeat: &moq.RepeatVal{}, } + results.Results[paramsKey] = r.Results } - if result.DoFn != nil { - result.DoFn(param1, param2) - } + r.Results.Repeat.Increment(r.Moq.Scene.T) +} - if result.Values != nil { - result1 = result.Values.Result1 - result2 = result.Values.Result2 +func (r *MoqUsual_Usual_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_Usual_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") + return nil } - if result.DoReturnFn != nil { - result1, result2 = result.DoReturnFn(param1, param2) + r.Results.Repeat.Repeat(r.Moq.Scene.T, repeaters) + last := r.Results.Results[len(r.Results.Results)-1] + for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { + if r.Sequence { + last = struct { + Values *struct { + SResult string + Err error + } + Sequence uint32 + DoFn MoqUsual_Usual_doFn + DoReturnFn MoqUsual_Usual_doReturnFn + }{ + Values: last.Values, + Sequence: r.Moq.Scene.NextRecorderSequence(), + } + } + r.Results.Results = append(r.Results.Results, last) } - return + return r } -func (m *MoqUsual_mock) NoResults(sParam string, bParam bool) { - m.Moq.Scene.T.Helper() - params := MoqUsual_NoResults_params{ - SParam: sParam, - BParam: bParam, - } - var results *MoqUsual_NoResults_results - for _, resultsByParams := range m.Moq.ResultsByParams_NoResults { - paramsKey := m.Moq.ParamsKey_NoResults(params, resultsByParams.AnyParams) - var ok bool - results, ok = resultsByParams.Results[paramsKey] - if ok { - break +func (m *MoqUsual) PrettyParams_Usual(params MoqUsual_Usual_params) string { + return fmt.Sprintf("Usual(%#v, %#v)", params.SParam, params.BParam) +} + +func (m *MoqUsual) ParamsKey_Usual(params MoqUsual_Usual_params, anyParams uint64) MoqUsual_Usual_paramsKey { + m.Scene.T.Helper() + var sParamUsed string + var sParamUsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.Runtime.ParameterIndexing.Usual.SParam == moq.ParamIndexByValue { + sParamUsed = params.SParam + } else { + sParamUsedHash = hash.DeepHash(params.SParam) } } - if results == nil { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_NoResults(params)) + var bParamUsed bool + var bParamUsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.Runtime.ParameterIndexing.Usual.BParam == moq.ParamIndexByValue { + bParamUsed = params.BParam + } else { + bParamUsedHash = hash.DeepHash(params.BParam) } - return } - - i := int(atomic.AddUint32(&results.Index, 1)) - 1 - if i >= results.Repeat.ResultCount { - if !results.Repeat.AnyTimes { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_NoResults(params)) - } - return - } - i = results.Repeat.ResultCount - 1 + return MoqUsual_Usual_paramsKey{ + Params: struct { + SParam string + BParam bool + }{ + SParam: sParamUsed, + BParam: bParamUsed, + }, + Hashes: struct { + SParam hash.Hash + BParam hash.Hash + }{ + SParam: sParamUsedHash, + BParam: bParamUsedHash, + }, } +} - result := results.Results[i] - if result.Sequence != 0 { - sequence := m.Moq.Scene.NextMockSequence() - if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_NoResults(params)) - } +func (m *MoqUsual_recorder) NoNames(param1 string, param2 bool) *MoqUsual_NoNames_fnRecorder { + return &MoqUsual_NoNames_fnRecorder{ + Params: MoqUsual_NoNames_params{ + Param1: param1, + Param2: param2, + }, + Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, + Moq: m.Moq, } +} - if result.DoFn != nil { - result.DoFn(sParam, bParam) +func (r *MoqUsual_NoNames_fnRecorder) Any() *MoqUsual_NoNames_anyParams { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_NoNames(r.Params)) + return nil } + return &MoqUsual_NoNames_anyParams{Recorder: r} +} - if result.DoReturnFn != nil { - result.DoReturnFn(sParam, bParam) +func (a *MoqUsual_NoNames_anyParams) Param1() *MoqUsual_NoNames_fnRecorder { + a.Recorder.AnyParams |= 1 << 0 + return a.Recorder +} + +func (a *MoqUsual_NoNames_anyParams) Param2() *MoqUsual_NoNames_fnRecorder { + a.Recorder.AnyParams |= 1 << 1 + return a.Recorder +} + +func (r *MoqUsual_NoNames_fnRecorder) Seq() *MoqUsual_NoNames_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_NoNames(r.Params)) + return nil } - return + r.Sequence = true + return r } -func (m *MoqUsual_mock) NoParams() (sResult string, err error) { - m.Moq.Scene.T.Helper() - params := MoqUsual_NoParams_params{} - var results *MoqUsual_NoParams_results - for _, resultsByParams := range m.Moq.ResultsByParams_NoParams { - paramsKey := m.Moq.ParamsKey_NoParams(params, resultsByParams.AnyParams) - var ok bool - results, ok = resultsByParams.Results[paramsKey] - if ok { - break - } +func (r *MoqUsual_NoNames_fnRecorder) NoSeq() *MoqUsual_NoNames_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_NoNames(r.Params)) + return nil } - if results == nil { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_NoParams(params)) - } - return + r.Sequence = false + return r +} + +func (r *MoqUsual_NoNames_fnRecorder) ReturnResults(result1 string, result2 error) *MoqUsual_NoNames_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() } - i := int(atomic.AddUint32(&results.Index, 1)) - 1 - if i >= results.Repeat.ResultCount { - if !results.Repeat.AnyTimes { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_NoParams(params)) - } - return + r.Results.Results = append(r.Results.Results, struct { + Values *struct { + Result1 string + Result2 error } - i = results.Repeat.ResultCount - 1 + Sequence uint32 + DoFn MoqUsual_NoNames_doFn + DoReturnFn MoqUsual_NoNames_doReturnFn + }{ + Values: &struct { + Result1 string + Result2 error + }{ + Result1: result1, + Result2: result2, + }, + Sequence: sequence, + }) + return r +} + +func (r *MoqUsual_NoNames_fnRecorder) AndDo(fn MoqUsual_NoNames_doFn) *MoqUsual_NoNames_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") + return nil } + last := &r.Results.Results[len(r.Results.Results)-1] + last.DoFn = fn + return r +} - result := results.Results[i] - if result.Sequence != 0 { - sequence := m.Moq.Scene.NextMockSequence() - if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_NoParams(params)) - } - } +func (r *MoqUsual_NoNames_fnRecorder) DoReturnResults(fn MoqUsual_NoNames_doReturnFn) *MoqUsual_NoNames_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() - if result.DoFn != nil { - result.DoFn() + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() } - if result.Values != nil { - sResult = result.Values.SResult - err = result.Values.Err - } - if result.DoReturnFn != nil { - sResult, err = result.DoReturnFn() - } - return + r.Results.Results = append(r.Results.Results, struct { + Values *struct { + Result1 string + Result2 error + } + Sequence uint32 + DoFn MoqUsual_NoNames_doFn + DoReturnFn MoqUsual_NoNames_doReturnFn + }{Sequence: sequence, DoReturnFn: fn}) + return r } -func (m *MoqUsual_mock) Nothing() { - m.Moq.Scene.T.Helper() - params := MoqUsual_Nothing_params{} - var results *MoqUsual_Nothing_results - for _, resultsByParams := range m.Moq.ResultsByParams_Nothing { - paramsKey := m.Moq.ParamsKey_Nothing(params, resultsByParams.AnyParams) - var ok bool - results, ok = resultsByParams.Results[paramsKey] - if ok { +func (r *MoqUsual_NoNames_fnRecorder) FindResults() { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Results.Repeat.Increment(r.Moq.Scene.T) + return + } + + anyCount := bits.OnesCount64(r.AnyParams) + insertAt := -1 + var results *MoqUsual_NoNames_resultsByParams + for n, res := range r.Moq.ResultsByParams_NoNames { + if res.AnyParams == r.AnyParams { + results = &res break } + if res.AnyCount > anyCount { + insertAt = n + } } if results == nil { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_Nothing(params)) + results = &MoqUsual_NoNames_resultsByParams{ + AnyCount: anyCount, + AnyParams: r.AnyParams, + Results: map[MoqUsual_NoNames_paramsKey]*MoqUsual_NoNames_results{}, } - return - } - - i := int(atomic.AddUint32(&results.Index, 1)) - 1 - if i >= results.Repeat.ResultCount { - if !results.Repeat.AnyTimes { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_Nothing(params)) - } - return + r.Moq.ResultsByParams_NoNames = append(r.Moq.ResultsByParams_NoNames, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_NoNames) { + copy(r.Moq.ResultsByParams_NoNames[insertAt+1:], r.Moq.ResultsByParams_NoNames[insertAt:0]) + r.Moq.ResultsByParams_NoNames[insertAt] = *results } - i = results.Repeat.ResultCount - 1 } - result := results.Results[i] - if result.Sequence != 0 { - sequence := m.Moq.Scene.NextMockSequence() - if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_Nothing(params)) - } - } + paramsKey := r.Moq.ParamsKey_NoNames(r.Params, r.AnyParams) - if result.DoFn != nil { - result.DoFn() + var ok bool + r.Results, ok = results.Results[paramsKey] + if !ok { + r.Results = &MoqUsual_NoNames_results{ + Params: r.Params, + Results: nil, + Index: 0, + Repeat: &moq.RepeatVal{}, + } + results.Results[paramsKey] = r.Results } - if result.DoReturnFn != nil { - result.DoReturnFn() - } - return + r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (m *MoqUsual_mock) Variadic(other bool, args ...string) (sResult string, err error) { - m.Moq.Scene.T.Helper() - params := MoqUsual_Variadic_params{ - Other: other, - Args: args, - } - var results *MoqUsual_Variadic_results - for _, resultsByParams := range m.Moq.ResultsByParams_Variadic { - paramsKey := m.Moq.ParamsKey_Variadic(params, resultsByParams.AnyParams) - var ok bool - results, ok = resultsByParams.Results[paramsKey] - if ok { - break - } +func (r *MoqUsual_NoNames_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_NoNames_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") + return nil } - if results == nil { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_Variadic(params)) + r.Results.Repeat.Repeat(r.Moq.Scene.T, repeaters) + last := r.Results.Results[len(r.Results.Results)-1] + for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { + if r.Sequence { + last = struct { + Values *struct { + Result1 string + Result2 error + } + Sequence uint32 + DoFn MoqUsual_NoNames_doFn + DoReturnFn MoqUsual_NoNames_doReturnFn + }{ + Values: last.Values, + Sequence: r.Moq.Scene.NextRecorderSequence(), + } } - return + r.Results.Results = append(r.Results.Results, last) } + return r +} - i := int(atomic.AddUint32(&results.Index, 1)) - 1 - if i >= results.Repeat.ResultCount { - if !results.Repeat.AnyTimes { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_Variadic(params)) - } - return +func (m *MoqUsual) PrettyParams_NoNames(params MoqUsual_NoNames_params) string { + return fmt.Sprintf("NoNames(%#v, %#v)", params.Param1, params.Param2) +} + +func (m *MoqUsual) ParamsKey_NoNames(params MoqUsual_NoNames_params, anyParams uint64) MoqUsual_NoNames_paramsKey { + m.Scene.T.Helper() + var param1Used string + var param1UsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.Runtime.ParameterIndexing.NoNames.Param1 == moq.ParamIndexByValue { + param1Used = params.Param1 + } else { + param1UsedHash = hash.DeepHash(params.Param1) } - i = results.Repeat.ResultCount - 1 } - - result := results.Results[i] - if result.Sequence != 0 { - sequence := m.Moq.Scene.NextMockSequence() - if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_Variadic(params)) + var param2Used bool + var param2UsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.Runtime.ParameterIndexing.NoNames.Param2 == moq.ParamIndexByValue { + param2Used = params.Param2 + } else { + param2UsedHash = hash.DeepHash(params.Param2) } } - - if result.DoFn != nil { - result.DoFn(other, args...) + return MoqUsual_NoNames_paramsKey{ + Params: struct { + Param1 string + Param2 bool + }{ + Param1: param1Used, + Param2: param2Used, + }, + Hashes: struct { + Param1 hash.Hash + Param2 hash.Hash + }{ + Param1: param1UsedHash, + Param2: param2UsedHash, + }, } +} - if result.Values != nil { - sResult = result.Values.SResult - err = result.Values.Err - } - if result.DoReturnFn != nil { - sResult, err = result.DoReturnFn(other, args...) +func (m *MoqUsual_recorder) NoResults(sParam string, bParam bool) *MoqUsual_NoResults_fnRecorder { + return &MoqUsual_NoResults_fnRecorder{ + Params: MoqUsual_NoResults_params{ + SParam: sParam, + BParam: bParam, + }, + Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, + Moq: m.Moq, } - return } -func (m *MoqUsual_mock) RepeatedIds(sParam1, sParam2 string, bParam bool) (sResult1, sResult2 string, err error) { - m.Moq.Scene.T.Helper() - params := MoqUsual_RepeatedIds_params{ - SParam1: sParam1, - SParam2: sParam2, - BParam: bParam, - } - var results *MoqUsual_RepeatedIds_results - for _, resultsByParams := range m.Moq.ResultsByParams_RepeatedIds { - paramsKey := m.Moq.ParamsKey_RepeatedIds(params, resultsByParams.AnyParams) - var ok bool - results, ok = resultsByParams.Results[paramsKey] - if ok { - break - } - } - if results == nil { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_RepeatedIds(params)) - } - return +func (r *MoqUsual_NoResults_fnRecorder) Any() *MoqUsual_NoResults_anyParams { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_NoResults(r.Params)) + return nil } + return &MoqUsual_NoResults_anyParams{Recorder: r} +} + +func (a *MoqUsual_NoResults_anyParams) SParam() *MoqUsual_NoResults_fnRecorder { + a.Recorder.AnyParams |= 1 << 0 + return a.Recorder +} + +func (a *MoqUsual_NoResults_anyParams) BParam() *MoqUsual_NoResults_fnRecorder { + a.Recorder.AnyParams |= 1 << 1 + return a.Recorder +} - i := int(atomic.AddUint32(&results.Index, 1)) - 1 - if i >= results.Repeat.ResultCount { - if !results.Repeat.AnyTimes { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_RepeatedIds(params)) - } - return - } - i = results.Repeat.ResultCount - 1 +func (r *MoqUsual_NoResults_fnRecorder) Seq() *MoqUsual_NoResults_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_NoResults(r.Params)) + return nil } + r.Sequence = true + return r +} - result := results.Results[i] - if result.Sequence != 0 { - sequence := m.Moq.Scene.NextMockSequence() - if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_RepeatedIds(params)) - } +func (r *MoqUsual_NoResults_fnRecorder) NoSeq() *MoqUsual_NoResults_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_NoResults(r.Params)) + return nil } + r.Sequence = false + return r +} - if result.DoFn != nil { - result.DoFn(sParam1, sParam2, bParam) +func (r *MoqUsual_NoResults_fnRecorder) ReturnResults() *MoqUsual_NoResults_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() } - if result.Values != nil { - sResult1 = result.Values.SResult1 - sResult2 = result.Values.SResult2 - err = result.Values.Err + r.Results.Results = append(r.Results.Results, struct { + Values *struct{} + Sequence uint32 + DoFn MoqUsual_NoResults_doFn + DoReturnFn MoqUsual_NoResults_doReturnFn + }{ + Values: &struct{}{}, + Sequence: sequence, + }) + return r +} + +func (r *MoqUsual_NoResults_fnRecorder) AndDo(fn MoqUsual_NoResults_doFn) *MoqUsual_NoResults_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") + return nil } - if result.DoReturnFn != nil { - sResult1, sResult2, err = result.DoReturnFn(sParam1, sParam2, bParam) + last := &r.Results.Results[len(r.Results.Results)-1] + last.DoFn = fn + return r +} + +func (r *MoqUsual_NoResults_fnRecorder) DoReturnResults(fn MoqUsual_NoResults_doReturnFn) *MoqUsual_NoResults_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() } - return + + r.Results.Results = append(r.Results.Results, struct { + Values *struct{} + Sequence uint32 + DoFn MoqUsual_NoResults_doFn + DoReturnFn MoqUsual_NoResults_doReturnFn + }{Sequence: sequence, DoReturnFn: fn}) + return r } -func (m *MoqUsual_mock) Times(sParam string, times bool) (sResult string, err error) { - m.Moq.Scene.T.Helper() - params := MoqUsual_Times_params{ - SParam: sParam, - Times: times, +func (r *MoqUsual_NoResults_fnRecorder) FindResults() { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Results.Repeat.Increment(r.Moq.Scene.T) + return } - var results *MoqUsual_Times_results - for _, resultsByParams := range m.Moq.ResultsByParams_Times { - paramsKey := m.Moq.ParamsKey_Times(params, resultsByParams.AnyParams) - var ok bool - results, ok = resultsByParams.Results[paramsKey] - if ok { + + anyCount := bits.OnesCount64(r.AnyParams) + insertAt := -1 + var results *MoqUsual_NoResults_resultsByParams + for n, res := range r.Moq.ResultsByParams_NoResults { + if res.AnyParams == r.AnyParams { + results = &res break } + if res.AnyCount > anyCount { + insertAt = n + } } if results == nil { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_Times(params)) + results = &MoqUsual_NoResults_resultsByParams{ + AnyCount: anyCount, + AnyParams: r.AnyParams, + Results: map[MoqUsual_NoResults_paramsKey]*MoqUsual_NoResults_results{}, } - return - } - - i := int(atomic.AddUint32(&results.Index, 1)) - 1 - if i >= results.Repeat.ResultCount { - if !results.Repeat.AnyTimes { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_Times(params)) - } - return + r.Moq.ResultsByParams_NoResults = append(r.Moq.ResultsByParams_NoResults, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_NoResults) { + copy(r.Moq.ResultsByParams_NoResults[insertAt+1:], r.Moq.ResultsByParams_NoResults[insertAt:0]) + r.Moq.ResultsByParams_NoResults[insertAt] = *results } - i = results.Repeat.ResultCount - 1 } - result := results.Results[i] - if result.Sequence != 0 { - sequence := m.Moq.Scene.NextMockSequence() - if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_Times(params)) - } - } + paramsKey := r.Moq.ParamsKey_NoResults(r.Params, r.AnyParams) - if result.DoFn != nil { - result.DoFn(sParam, times) + var ok bool + r.Results, ok = results.Results[paramsKey] + if !ok { + r.Results = &MoqUsual_NoResults_results{ + Params: r.Params, + Results: nil, + Index: 0, + Repeat: &moq.RepeatVal{}, + } + results.Results[paramsKey] = r.Results } - if result.Values != nil { - sResult = result.Values.SResult - err = result.Values.Err - } - if result.DoReturnFn != nil { - sResult, err = result.DoReturnFn(sParam, times) - } - return + r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (m *MoqUsual_mock) DifficultParamNames(param1, param2 bool, param3 string, param, param5, param6 int, param7, param8, param9 float32) { - m.Moq.Scene.T.Helper() - params := MoqUsual_DifficultParamNames_params{ - Param1: param1, - Param2: param2, - Param3: param3, - Param: param, - Param5: param5, - Param6: param6, - Param7: param7, - Param8: param8, - Param9: param9, - } - var results *MoqUsual_DifficultParamNames_results - for _, resultsByParams := range m.Moq.ResultsByParams_DifficultParamNames { - paramsKey := m.Moq.ParamsKey_DifficultParamNames(params, resultsByParams.AnyParams) - var ok bool - results, ok = resultsByParams.Results[paramsKey] - if ok { - break - } +func (r *MoqUsual_NoResults_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_NoResults_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") + return nil } - if results == nil { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_DifficultParamNames(params)) + r.Results.Repeat.Repeat(r.Moq.Scene.T, repeaters) + last := r.Results.Results[len(r.Results.Results)-1] + for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { + if r.Sequence { + last = struct { + Values *struct{} + Sequence uint32 + DoFn MoqUsual_NoResults_doFn + DoReturnFn MoqUsual_NoResults_doReturnFn + }{ + Values: last.Values, + Sequence: r.Moq.Scene.NextRecorderSequence(), + } } - return + r.Results.Results = append(r.Results.Results, last) } + return r +} - i := int(atomic.AddUint32(&results.Index, 1)) - 1 - if i >= results.Repeat.ResultCount { - if !results.Repeat.AnyTimes { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_DifficultParamNames(params)) - } - return +func (m *MoqUsual) PrettyParams_NoResults(params MoqUsual_NoResults_params) string { + return fmt.Sprintf("NoResults(%#v, %#v)", params.SParam, params.BParam) +} + +func (m *MoqUsual) ParamsKey_NoResults(params MoqUsual_NoResults_params, anyParams uint64) MoqUsual_NoResults_paramsKey { + m.Scene.T.Helper() + var sParamUsed string + var sParamUsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.Runtime.ParameterIndexing.NoResults.SParam == moq.ParamIndexByValue { + sParamUsed = params.SParam + } else { + sParamUsedHash = hash.DeepHash(params.SParam) } - i = results.Repeat.ResultCount - 1 } - - result := results.Results[i] - if result.Sequence != 0 { - sequence := m.Moq.Scene.NextMockSequence() - if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_DifficultParamNames(params)) + var bParamUsed bool + var bParamUsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.Runtime.ParameterIndexing.NoResults.BParam == moq.ParamIndexByValue { + bParamUsed = params.BParam + } else { + bParamUsedHash = hash.DeepHash(params.BParam) } } + return MoqUsual_NoResults_paramsKey{ + Params: struct { + SParam string + BParam bool + }{ + SParam: sParamUsed, + BParam: bParamUsed, + }, + Hashes: struct { + SParam hash.Hash + BParam hash.Hash + }{ + SParam: sParamUsedHash, + BParam: bParamUsedHash, + }, + } +} - if result.DoFn != nil { - result.DoFn(param1, param2, param3, param, param5, param6, param7, param8, param9) +func (m *MoqUsual_recorder) NoParams() *MoqUsual_NoParams_fnRecorder { + return &MoqUsual_NoParams_fnRecorder{ + Params: MoqUsual_NoParams_params{}, + Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, + Moq: m.Moq, } +} - if result.DoReturnFn != nil { - result.DoReturnFn(param1, param2, param3, param, param5, param6, param7, param8, param9) +func (r *MoqUsual_NoParams_fnRecorder) Any() *MoqUsual_NoParams_anyParams { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_NoParams(r.Params)) + return nil } - return + return &MoqUsual_NoParams_anyParams{Recorder: r} } -func (m *MoqUsual_mock) DifficultResultNames() (result1, result2 string, result3 error, param, result5, result6 int, result7, result8, result9 float32) { - m.Moq.Scene.T.Helper() - params := MoqUsual_DifficultResultNames_params{} - var results *MoqUsual_DifficultResultNames_results - for _, resultsByParams := range m.Moq.ResultsByParams_DifficultResultNames { - paramsKey := m.Moq.ParamsKey_DifficultResultNames(params, resultsByParams.AnyParams) - var ok bool - results, ok = resultsByParams.Results[paramsKey] - if ok { - break - } +func (r *MoqUsual_NoParams_fnRecorder) Seq() *MoqUsual_NoParams_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_NoParams(r.Params)) + return nil } - if results == nil { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_DifficultResultNames(params)) - } - return + r.Sequence = true + return r +} + +func (r *MoqUsual_NoParams_fnRecorder) NoSeq() *MoqUsual_NoParams_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_NoParams(r.Params)) + return nil } + r.Sequence = false + return r +} - i := int(atomic.AddUint32(&results.Index, 1)) - 1 - if i >= results.Repeat.ResultCount { - if !results.Repeat.AnyTimes { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_DifficultResultNames(params)) - } - return - } - i = results.Repeat.ResultCount - 1 +func (r *MoqUsual_NoParams_fnRecorder) ReturnResults(sResult string, err error) *MoqUsual_NoParams_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() } - result := results.Results[i] - if result.Sequence != 0 { - sequence := m.Moq.Scene.NextMockSequence() - if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_DifficultResultNames(params)) + r.Results.Results = append(r.Results.Results, struct { + Values *struct { + SResult string + Err error } - } + Sequence uint32 + DoFn MoqUsual_NoParams_doFn + DoReturnFn MoqUsual_NoParams_doReturnFn + }{ + Values: &struct { + SResult string + Err error + }{ + SResult: sResult, + Err: err, + }, + Sequence: sequence, + }) + return r +} - if result.DoFn != nil { - result.DoFn() +func (r *MoqUsual_NoParams_fnRecorder) AndDo(fn MoqUsual_NoParams_doFn) *MoqUsual_NoParams_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") + return nil } + last := &r.Results.Results[len(r.Results.Results)-1] + last.DoFn = fn + return r +} - if result.Values != nil { - result1 = result.Values.Result1 - result2 = result.Values.Result2 - result3 = result.Values.Result3 - param = result.Values.Param - result5 = result.Values.Result5 - result6 = result.Values.Result6 - result7 = result.Values.Result7 - result8 = result.Values.Result8 - result9 = result.Values.Result9 - } - if result.DoReturnFn != nil { - result1, result2, result3, param, result5, result6, result7, result8, result9 = result.DoReturnFn() +func (r *MoqUsual_NoParams_fnRecorder) DoReturnResults(fn MoqUsual_NoParams_doReturnFn) *MoqUsual_NoParams_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() } - return + + r.Results.Results = append(r.Results.Results, struct { + Values *struct { + SResult string + Err error + } + Sequence uint32 + DoFn MoqUsual_NoParams_doFn + DoReturnFn MoqUsual_NoParams_doReturnFn + }{Sequence: sequence, DoReturnFn: fn}) + return r } -func (m *MoqUsual_mock) PassByArray(p [3]testmoqs.Params) (result1 [3]testmoqs.Results) { - m.Moq.Scene.T.Helper() - params := MoqUsual_PassByArray_params{ - P: p, +func (r *MoqUsual_NoParams_fnRecorder) FindResults() { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Results.Repeat.Increment(r.Moq.Scene.T) + return } - var results *MoqUsual_PassByArray_results - for _, resultsByParams := range m.Moq.ResultsByParams_PassByArray { - paramsKey := m.Moq.ParamsKey_PassByArray(params, resultsByParams.AnyParams) - var ok bool - results, ok = resultsByParams.Results[paramsKey] - if ok { + + anyCount := bits.OnesCount64(r.AnyParams) + insertAt := -1 + var results *MoqUsual_NoParams_resultsByParams + for n, res := range r.Moq.ResultsByParams_NoParams { + if res.AnyParams == r.AnyParams { + results = &res break } + if res.AnyCount > anyCount { + insertAt = n + } } if results == nil { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_PassByArray(params)) + results = &MoqUsual_NoParams_resultsByParams{ + AnyCount: anyCount, + AnyParams: r.AnyParams, + Results: map[MoqUsual_NoParams_paramsKey]*MoqUsual_NoParams_results{}, } - return - } - - i := int(atomic.AddUint32(&results.Index, 1)) - 1 - if i >= results.Repeat.ResultCount { - if !results.Repeat.AnyTimes { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_PassByArray(params)) - } - return + r.Moq.ResultsByParams_NoParams = append(r.Moq.ResultsByParams_NoParams, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_NoParams) { + copy(r.Moq.ResultsByParams_NoParams[insertAt+1:], r.Moq.ResultsByParams_NoParams[insertAt:0]) + r.Moq.ResultsByParams_NoParams[insertAt] = *results } - i = results.Repeat.ResultCount - 1 } - result := results.Results[i] - if result.Sequence != 0 { - sequence := m.Moq.Scene.NextMockSequence() - if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_PassByArray(params)) - } - } + paramsKey := r.Moq.ParamsKey_NoParams(r.Params, r.AnyParams) - if result.DoFn != nil { - result.DoFn(p) + var ok bool + r.Results, ok = results.Results[paramsKey] + if !ok { + r.Results = &MoqUsual_NoParams_results{ + Params: r.Params, + Results: nil, + Index: 0, + Repeat: &moq.RepeatVal{}, + } + results.Results[paramsKey] = r.Results } - if result.Values != nil { - result1 = result.Values.Result1 - } - if result.DoReturnFn != nil { - result1 = result.DoReturnFn(p) - } - return + r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (m *MoqUsual_mock) PassByChan(p chan testmoqs.Params) (result1 chan testmoqs.Results) { - m.Moq.Scene.T.Helper() - params := MoqUsual_PassByChan_params{ - P: p, - } - var results *MoqUsual_PassByChan_results - for _, resultsByParams := range m.Moq.ResultsByParams_PassByChan { - paramsKey := m.Moq.ParamsKey_PassByChan(params, resultsByParams.AnyParams) - var ok bool - results, ok = resultsByParams.Results[paramsKey] - if ok { - break - } - } - if results == nil { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_PassByChan(params)) - } - return +func (r *MoqUsual_NoParams_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_NoParams_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") + return nil } - - i := int(atomic.AddUint32(&results.Index, 1)) - 1 - if i >= results.Repeat.ResultCount { - if !results.Repeat.AnyTimes { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_PassByChan(params)) + r.Results.Repeat.Repeat(r.Moq.Scene.T, repeaters) + last := r.Results.Results[len(r.Results.Results)-1] + for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { + if r.Sequence { + last = struct { + Values *struct { + SResult string + Err error + } + Sequence uint32 + DoFn MoqUsual_NoParams_doFn + DoReturnFn MoqUsual_NoParams_doReturnFn + }{ + Values: last.Values, + Sequence: r.Moq.Scene.NextRecorderSequence(), } - return } - i = results.Repeat.ResultCount - 1 + r.Results.Results = append(r.Results.Results, last) } + return r +} - result := results.Results[i] - if result.Sequence != 0 { - sequence := m.Moq.Scene.NextMockSequence() - if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_PassByChan(params)) - } - } +func (m *MoqUsual) PrettyParams_NoParams(params MoqUsual_NoParams_params) string { + return fmt.Sprintf("NoParams()") +} - if result.DoFn != nil { - result.DoFn(p) +func (m *MoqUsual) ParamsKey_NoParams(params MoqUsual_NoParams_params, anyParams uint64) MoqUsual_NoParams_paramsKey { + m.Scene.T.Helper() + return MoqUsual_NoParams_paramsKey{ + Params: struct{}{}, + Hashes: struct{}{}, } +} - if result.Values != nil { - result1 = result.Values.Result1 - } - if result.DoReturnFn != nil { - result1 = result.DoReturnFn(p) +func (m *MoqUsual_recorder) Nothing() *MoqUsual_Nothing_fnRecorder { + return &MoqUsual_Nothing_fnRecorder{ + Params: MoqUsual_Nothing_params{}, + Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, + Moq: m.Moq, } - return } -func (m *MoqUsual_mock) PassByEllipsis(p ...testmoqs.Params) (result1 string, result2 error) { - m.Moq.Scene.T.Helper() - params := MoqUsual_PassByEllipsis_params{ - P: p, - } - var results *MoqUsual_PassByEllipsis_results - for _, resultsByParams := range m.Moq.ResultsByParams_PassByEllipsis { - paramsKey := m.Moq.ParamsKey_PassByEllipsis(params, resultsByParams.AnyParams) - var ok bool - results, ok = resultsByParams.Results[paramsKey] - if ok { - break - } - } - if results == nil { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_PassByEllipsis(params)) - } - return +func (r *MoqUsual_Nothing_fnRecorder) Any() *MoqUsual_Nothing_anyParams { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Nothing(r.Params)) + return nil } + return &MoqUsual_Nothing_anyParams{Recorder: r} +} - i := int(atomic.AddUint32(&results.Index, 1)) - 1 - if i >= results.Repeat.ResultCount { - if !results.Repeat.AnyTimes { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_PassByEllipsis(params)) - } - return - } - i = results.Repeat.ResultCount - 1 +func (r *MoqUsual_Nothing_fnRecorder) Seq() *MoqUsual_Nothing_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Nothing(r.Params)) + return nil } + r.Sequence = true + return r +} - result := results.Results[i] - if result.Sequence != 0 { - sequence := m.Moq.Scene.NextMockSequence() - if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_PassByEllipsis(params)) - } +func (r *MoqUsual_Nothing_fnRecorder) NoSeq() *MoqUsual_Nothing_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Nothing(r.Params)) + return nil } + r.Sequence = false + return r +} - if result.DoFn != nil { - result.DoFn(p...) +func (r *MoqUsual_Nothing_fnRecorder) ReturnResults() *MoqUsual_Nothing_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() } - if result.Values != nil { - result1 = result.Values.Result1 - result2 = result.Values.Result2 + r.Results.Results = append(r.Results.Results, struct { + Values *struct{} + Sequence uint32 + DoFn MoqUsual_Nothing_doFn + DoReturnFn MoqUsual_Nothing_doReturnFn + }{ + Values: &struct{}{}, + Sequence: sequence, + }) + return r +} + +func (r *MoqUsual_Nothing_fnRecorder) AndDo(fn MoqUsual_Nothing_doFn) *MoqUsual_Nothing_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") + return nil } - if result.DoReturnFn != nil { - result1, result2 = result.DoReturnFn(p...) + last := &r.Results.Results[len(r.Results.Results)-1] + last.DoFn = fn + return r +} + +func (r *MoqUsual_Nothing_fnRecorder) DoReturnResults(fn MoqUsual_Nothing_doReturnFn) *MoqUsual_Nothing_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() } - return + + r.Results.Results = append(r.Results.Results, struct { + Values *struct{} + Sequence uint32 + DoFn MoqUsual_Nothing_doFn + DoReturnFn MoqUsual_Nothing_doReturnFn + }{Sequence: sequence, DoReturnFn: fn}) + return r } -func (m *MoqUsual_mock) PassByMap(p map[string]testmoqs.Params) (result1 map[string]testmoqs.Results) { - m.Moq.Scene.T.Helper() - params := MoqUsual_PassByMap_params{ - P: p, +func (r *MoqUsual_Nothing_fnRecorder) FindResults() { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Results.Repeat.Increment(r.Moq.Scene.T) + return } - var results *MoqUsual_PassByMap_results - for _, resultsByParams := range m.Moq.ResultsByParams_PassByMap { - paramsKey := m.Moq.ParamsKey_PassByMap(params, resultsByParams.AnyParams) - var ok bool - results, ok = resultsByParams.Results[paramsKey] - if ok { + + anyCount := bits.OnesCount64(r.AnyParams) + insertAt := -1 + var results *MoqUsual_Nothing_resultsByParams + for n, res := range r.Moq.ResultsByParams_Nothing { + if res.AnyParams == r.AnyParams { + results = &res break } + if res.AnyCount > anyCount { + insertAt = n + } } if results == nil { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_PassByMap(params)) + results = &MoqUsual_Nothing_resultsByParams{ + AnyCount: anyCount, + AnyParams: r.AnyParams, + Results: map[MoqUsual_Nothing_paramsKey]*MoqUsual_Nothing_results{}, } - return - } - - i := int(atomic.AddUint32(&results.Index, 1)) - 1 - if i >= results.Repeat.ResultCount { - if !results.Repeat.AnyTimes { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_PassByMap(params)) - } - return + r.Moq.ResultsByParams_Nothing = append(r.Moq.ResultsByParams_Nothing, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_Nothing) { + copy(r.Moq.ResultsByParams_Nothing[insertAt+1:], r.Moq.ResultsByParams_Nothing[insertAt:0]) + r.Moq.ResultsByParams_Nothing[insertAt] = *results } - i = results.Repeat.ResultCount - 1 } - result := results.Results[i] - if result.Sequence != 0 { - sequence := m.Moq.Scene.NextMockSequence() - if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_PassByMap(params)) - } - } + paramsKey := r.Moq.ParamsKey_Nothing(r.Params, r.AnyParams) - if result.DoFn != nil { - result.DoFn(p) + var ok bool + r.Results, ok = results.Results[paramsKey] + if !ok { + r.Results = &MoqUsual_Nothing_results{ + Params: r.Params, + Results: nil, + Index: 0, + Repeat: &moq.RepeatVal{}, + } + results.Results[paramsKey] = r.Results } - if result.Values != nil { - result1 = result.Values.Result1 - } - if result.DoReturnFn != nil { - result1 = result.DoReturnFn(p) - } - return + r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (m *MoqUsual_mock) PassByReference(p *testmoqs.Params) (result1 *testmoqs.Results) { - m.Moq.Scene.T.Helper() - params := MoqUsual_PassByReference_params{ - P: p, - } - var results *MoqUsual_PassByReference_results - for _, resultsByParams := range m.Moq.ResultsByParams_PassByReference { - paramsKey := m.Moq.ParamsKey_PassByReference(params, resultsByParams.AnyParams) - var ok bool - results, ok = resultsByParams.Results[paramsKey] - if ok { - break - } - } - if results == nil { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_PassByReference(params)) - } - return +func (r *MoqUsual_Nothing_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_Nothing_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") + return nil } - - i := int(atomic.AddUint32(&results.Index, 1)) - 1 - if i >= results.Repeat.ResultCount { - if !results.Repeat.AnyTimes { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_PassByReference(params)) + r.Results.Repeat.Repeat(r.Moq.Scene.T, repeaters) + last := r.Results.Results[len(r.Results.Results)-1] + for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { + if r.Sequence { + last = struct { + Values *struct{} + Sequence uint32 + DoFn MoqUsual_Nothing_doFn + DoReturnFn MoqUsual_Nothing_doReturnFn + }{ + Values: last.Values, + Sequence: r.Moq.Scene.NextRecorderSequence(), } - return } - i = results.Repeat.ResultCount - 1 + r.Results.Results = append(r.Results.Results, last) } + return r +} - result := results.Results[i] - if result.Sequence != 0 { - sequence := m.Moq.Scene.NextMockSequence() - if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_PassByReference(params)) - } - } +func (m *MoqUsual) PrettyParams_Nothing(params MoqUsual_Nothing_params) string { + return fmt.Sprintf("Nothing()") +} - if result.DoFn != nil { - result.DoFn(p) +func (m *MoqUsual) ParamsKey_Nothing(params MoqUsual_Nothing_params, anyParams uint64) MoqUsual_Nothing_paramsKey { + m.Scene.T.Helper() + return MoqUsual_Nothing_paramsKey{ + Params: struct{}{}, + Hashes: struct{}{}, } +} - if result.Values != nil { - result1 = result.Values.Result1 - } - if result.DoReturnFn != nil { - result1 = result.DoReturnFn(p) +func (m *MoqUsual_recorder) Variadic(other bool, args ...string) *MoqUsual_Variadic_fnRecorder { + return &MoqUsual_Variadic_fnRecorder{ + Params: MoqUsual_Variadic_params{ + Other: other, + Args: args, + }, + Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, + Moq: m.Moq, } - return } -func (m *MoqUsual_mock) PassBySlice(p []testmoqs.Params) (result1 []testmoqs.Results) { - m.Moq.Scene.T.Helper() - params := MoqUsual_PassBySlice_params{ - P: p, - } - var results *MoqUsual_PassBySlice_results - for _, resultsByParams := range m.Moq.ResultsByParams_PassBySlice { - paramsKey := m.Moq.ParamsKey_PassBySlice(params, resultsByParams.AnyParams) - var ok bool - results, ok = resultsByParams.Results[paramsKey] - if ok { - break - } - } - if results == nil { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_PassBySlice(params)) - } - return +func (r *MoqUsual_Variadic_fnRecorder) Any() *MoqUsual_Variadic_anyParams { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Variadic(r.Params)) + return nil } + return &MoqUsual_Variadic_anyParams{Recorder: r} +} - i := int(atomic.AddUint32(&results.Index, 1)) - 1 - if i >= results.Repeat.ResultCount { - if !results.Repeat.AnyTimes { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_PassBySlice(params)) - } - return - } - i = results.Repeat.ResultCount - 1 - } +func (a *MoqUsual_Variadic_anyParams) Other() *MoqUsual_Variadic_fnRecorder { + a.Recorder.AnyParams |= 1 << 0 + return a.Recorder +} - result := results.Results[i] - if result.Sequence != 0 { - sequence := m.Moq.Scene.NextMockSequence() - if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_PassBySlice(params)) - } - } +func (a *MoqUsual_Variadic_anyParams) Args() *MoqUsual_Variadic_fnRecorder { + a.Recorder.AnyParams |= 1 << 1 + return a.Recorder +} - if result.DoFn != nil { - result.DoFn(p) +func (r *MoqUsual_Variadic_fnRecorder) Seq() *MoqUsual_Variadic_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Variadic(r.Params)) + return nil } + r.Sequence = true + return r +} - if result.Values != nil { - result1 = result.Values.Result1 - } - if result.DoReturnFn != nil { - result1 = result.DoReturnFn(p) +func (r *MoqUsual_Variadic_fnRecorder) NoSeq() *MoqUsual_Variadic_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Variadic(r.Params)) + return nil } - return + r.Sequence = false + return r } -func (m *MoqUsual_mock) PassByValue(p testmoqs.Params) (result1 testmoqs.Results) { - m.Moq.Scene.T.Helper() - params := MoqUsual_PassByValue_params{ - P: p, - } - var results *MoqUsual_PassByValue_results - for _, resultsByParams := range m.Moq.ResultsByParams_PassByValue { - paramsKey := m.Moq.ParamsKey_PassByValue(params, resultsByParams.AnyParams) - var ok bool - results, ok = resultsByParams.Results[paramsKey] - if ok { - break - } - } - if results == nil { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_PassByValue(params)) - } - return - } +func (r *MoqUsual_Variadic_fnRecorder) ReturnResults(sResult string, err error) *MoqUsual_Variadic_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() - i := int(atomic.AddUint32(&results.Index, 1)) - 1 - if i >= results.Repeat.ResultCount { - if !results.Repeat.AnyTimes { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_PassByValue(params)) - } - return - } - i = results.Repeat.ResultCount - 1 + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() } - result := results.Results[i] - if result.Sequence != 0 { - sequence := m.Moq.Scene.NextMockSequence() - if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_PassByValue(params)) + r.Results.Results = append(r.Results.Results, struct { + Values *struct { + SResult string + Err error } - } + Sequence uint32 + DoFn MoqUsual_Variadic_doFn + DoReturnFn MoqUsual_Variadic_doReturnFn + }{ + Values: &struct { + SResult string + Err error + }{ + SResult: sResult, + Err: err, + }, + Sequence: sequence, + }) + return r +} - if result.DoFn != nil { - result.DoFn(p) +func (r *MoqUsual_Variadic_fnRecorder) AndDo(fn MoqUsual_Variadic_doFn) *MoqUsual_Variadic_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") + return nil } + last := &r.Results.Results[len(r.Results.Results)-1] + last.DoFn = fn + return r +} - if result.Values != nil { - result1 = result.Values.Result1 - } - if result.DoReturnFn != nil { - result1 = result.DoReturnFn(p) +func (r *MoqUsual_Variadic_fnRecorder) DoReturnResults(fn MoqUsual_Variadic_doReturnFn) *MoqUsual_Variadic_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() } - return + + r.Results.Results = append(r.Results.Results, struct { + Values *struct { + SResult string + Err error + } + Sequence uint32 + DoFn MoqUsual_Variadic_doFn + DoReturnFn MoqUsual_Variadic_doReturnFn + }{Sequence: sequence, DoReturnFn: fn}) + return r } -func (m *MoqUsual_mock) InterfaceParam(w io.Writer) (sResult string, err error) { - m.Moq.Scene.T.Helper() - params := MoqUsual_InterfaceParam_params{ - W: w, +func (r *MoqUsual_Variadic_fnRecorder) FindResults() { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Results.Repeat.Increment(r.Moq.Scene.T) + return } - var results *MoqUsual_InterfaceParam_results - for _, resultsByParams := range m.Moq.ResultsByParams_InterfaceParam { - paramsKey := m.Moq.ParamsKey_InterfaceParam(params, resultsByParams.AnyParams) - var ok bool - results, ok = resultsByParams.Results[paramsKey] - if ok { + + anyCount := bits.OnesCount64(r.AnyParams) + insertAt := -1 + var results *MoqUsual_Variadic_resultsByParams + for n, res := range r.Moq.ResultsByParams_Variadic { + if res.AnyParams == r.AnyParams { + results = &res break } + if res.AnyCount > anyCount { + insertAt = n + } } if results == nil { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_InterfaceParam(params)) + results = &MoqUsual_Variadic_resultsByParams{ + AnyCount: anyCount, + AnyParams: r.AnyParams, + Results: map[MoqUsual_Variadic_paramsKey]*MoqUsual_Variadic_results{}, } - return - } - - i := int(atomic.AddUint32(&results.Index, 1)) - 1 - if i >= results.Repeat.ResultCount { - if !results.Repeat.AnyTimes { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_InterfaceParam(params)) - } - return + r.Moq.ResultsByParams_Variadic = append(r.Moq.ResultsByParams_Variadic, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_Variadic) { + copy(r.Moq.ResultsByParams_Variadic[insertAt+1:], r.Moq.ResultsByParams_Variadic[insertAt:0]) + r.Moq.ResultsByParams_Variadic[insertAt] = *results } - i = results.Repeat.ResultCount - 1 } - result := results.Results[i] - if result.Sequence != 0 { - sequence := m.Moq.Scene.NextMockSequence() - if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_InterfaceParam(params)) + paramsKey := r.Moq.ParamsKey_Variadic(r.Params, r.AnyParams) + + var ok bool + r.Results, ok = results.Results[paramsKey] + if !ok { + r.Results = &MoqUsual_Variadic_results{ + Params: r.Params, + Results: nil, + Index: 0, + Repeat: &moq.RepeatVal{}, } + results.Results[paramsKey] = r.Results } - if result.DoFn != nil { - result.DoFn(w) - } + r.Results.Repeat.Increment(r.Moq.Scene.T) +} - if result.Values != nil { - sResult = result.Values.SResult - err = result.Values.Err +func (r *MoqUsual_Variadic_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_Variadic_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") + return nil } - if result.DoReturnFn != nil { - sResult, err = result.DoReturnFn(w) + r.Results.Repeat.Repeat(r.Moq.Scene.T, repeaters) + last := r.Results.Results[len(r.Results.Results)-1] + for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { + if r.Sequence { + last = struct { + Values *struct { + SResult string + Err error + } + Sequence uint32 + DoFn MoqUsual_Variadic_doFn + DoReturnFn MoqUsual_Variadic_doReturnFn + }{ + Values: last.Values, + Sequence: r.Moq.Scene.NextRecorderSequence(), + } + } + r.Results.Results = append(r.Results.Results, last) } - return + return r } -func (m *MoqUsual_mock) InterfaceResult(sParam string, bParam bool) (result1 io.Reader) { - m.Moq.Scene.T.Helper() - params := MoqUsual_InterfaceResult_params{ - SParam: sParam, - BParam: bParam, - } - var results *MoqUsual_InterfaceResult_results - for _, resultsByParams := range m.Moq.ResultsByParams_InterfaceResult { - paramsKey := m.Moq.ParamsKey_InterfaceResult(params, resultsByParams.AnyParams) - var ok bool - results, ok = resultsByParams.Results[paramsKey] - if ok { - break +func (m *MoqUsual) PrettyParams_Variadic(params MoqUsual_Variadic_params) string { + return fmt.Sprintf("Variadic(%#v, %#v)", params.Other, params.Args) +} + +func (m *MoqUsual) ParamsKey_Variadic(params MoqUsual_Variadic_params, anyParams uint64) MoqUsual_Variadic_paramsKey { + m.Scene.T.Helper() + var otherUsed bool + var otherUsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.Runtime.ParameterIndexing.Variadic.Other == moq.ParamIndexByValue { + otherUsed = params.Other + } else { + otherUsedHash = hash.DeepHash(params.Other) } } - if results == nil { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_InterfaceResult(params)) + var argsUsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.Runtime.ParameterIndexing.Variadic.Args == moq.ParamIndexByValue { + m.Scene.T.Fatalf("The args parameter of the Variadic function can't be indexed by value") } - return + argsUsedHash = hash.DeepHash(params.Args) } - - i := int(atomic.AddUint32(&results.Index, 1)) - 1 - if i >= results.Repeat.ResultCount { - if !results.Repeat.AnyTimes { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_InterfaceResult(params)) - } - return - } - i = results.Repeat.ResultCount - 1 + return MoqUsual_Variadic_paramsKey{ + Params: struct{ Other bool }{ + Other: otherUsed, + }, + Hashes: struct { + Other hash.Hash + Args hash.Hash + }{ + Other: otherUsedHash, + Args: argsUsedHash, + }, } +} - result := results.Results[i] - if result.Sequence != 0 { - sequence := m.Moq.Scene.NextMockSequence() - if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_InterfaceResult(params)) - } +func (m *MoqUsual_recorder) RepeatedIds(sParam1, sParam2 string, bParam bool) *MoqUsual_RepeatedIds_fnRecorder { + return &MoqUsual_RepeatedIds_fnRecorder{ + Params: MoqUsual_RepeatedIds_params{ + SParam1: sParam1, + SParam2: sParam2, + BParam: bParam, + }, + Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, + Moq: m.Moq, } +} - if result.DoFn != nil { - result.DoFn(sParam, bParam) +func (r *MoqUsual_RepeatedIds_fnRecorder) Any() *MoqUsual_RepeatedIds_anyParams { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_RepeatedIds(r.Params)) + return nil } + return &MoqUsual_RepeatedIds_anyParams{Recorder: r} +} - if result.Values != nil { - result1 = result.Values.Result1 - } - if result.DoReturnFn != nil { - result1 = result.DoReturnFn(sParam, bParam) - } - return +func (a *MoqUsual_RepeatedIds_anyParams) SParam1() *MoqUsual_RepeatedIds_fnRecorder { + a.Recorder.AnyParams |= 1 << 0 + return a.Recorder } -func (m *MoqUsual_mock) FnParam(fn func()) { - m.Moq.Scene.T.Helper() - params := MoqUsual_FnParam_params{ - Fn: fn, - } - var results *MoqUsual_FnParam_results - for _, resultsByParams := range m.Moq.ResultsByParams_FnParam { - paramsKey := m.Moq.ParamsKey_FnParam(params, resultsByParams.AnyParams) - var ok bool - results, ok = resultsByParams.Results[paramsKey] - if ok { - break - } +func (a *MoqUsual_RepeatedIds_anyParams) SParam2() *MoqUsual_RepeatedIds_fnRecorder { + a.Recorder.AnyParams |= 1 << 1 + return a.Recorder +} + +func (a *MoqUsual_RepeatedIds_anyParams) BParam() *MoqUsual_RepeatedIds_fnRecorder { + a.Recorder.AnyParams |= 1 << 2 + return a.Recorder +} + +func (r *MoqUsual_RepeatedIds_fnRecorder) Seq() *MoqUsual_RepeatedIds_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_RepeatedIds(r.Params)) + return nil } - if results == nil { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_FnParam(params)) - } - return + r.Sequence = true + return r +} + +func (r *MoqUsual_RepeatedIds_fnRecorder) NoSeq() *MoqUsual_RepeatedIds_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_RepeatedIds(r.Params)) + return nil } + r.Sequence = false + return r +} - i := int(atomic.AddUint32(&results.Index, 1)) - 1 - if i >= results.Repeat.ResultCount { - if !results.Repeat.AnyTimes { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_FnParam(params)) - } - return - } - i = results.Repeat.ResultCount - 1 +func (r *MoqUsual_RepeatedIds_fnRecorder) ReturnResults(sResult1, sResult2 string, err error) *MoqUsual_RepeatedIds_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() } - result := results.Results[i] - if result.Sequence != 0 { - sequence := m.Moq.Scene.NextMockSequence() - if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_FnParam(params)) + r.Results.Results = append(r.Results.Results, struct { + Values *struct { + SResult1, SResult2 string + Err error } - } + Sequence uint32 + DoFn MoqUsual_RepeatedIds_doFn + DoReturnFn MoqUsual_RepeatedIds_doReturnFn + }{ + Values: &struct { + SResult1, SResult2 string + Err error + }{ + SResult1: sResult1, + SResult2: sResult2, + Err: err, + }, + Sequence: sequence, + }) + return r +} - if result.DoFn != nil { - result.DoFn(fn) +func (r *MoqUsual_RepeatedIds_fnRecorder) AndDo(fn MoqUsual_RepeatedIds_doFn) *MoqUsual_RepeatedIds_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") + return nil } + last := &r.Results.Results[len(r.Results.Results)-1] + last.DoFn = fn + return r +} - if result.DoReturnFn != nil { - result.DoReturnFn(fn) +func (r *MoqUsual_RepeatedIds_fnRecorder) DoReturnResults(fn MoqUsual_RepeatedIds_doReturnFn) *MoqUsual_RepeatedIds_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() } - return + + r.Results.Results = append(r.Results.Results, struct { + Values *struct { + SResult1, SResult2 string + Err error + } + Sequence uint32 + DoFn MoqUsual_RepeatedIds_doFn + DoReturnFn MoqUsual_RepeatedIds_doReturnFn + }{Sequence: sequence, DoReturnFn: fn}) + return r } -func (m *MoqUsual_mock) Other(param1 other.Params) (result1 other.Results) { - m.Moq.Scene.T.Helper() - params := MoqUsual_Other_params{ - Param1: param1, +func (r *MoqUsual_RepeatedIds_fnRecorder) FindResults() { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Results.Repeat.Increment(r.Moq.Scene.T) + return } - var results *MoqUsual_Other_results - for _, resultsByParams := range m.Moq.ResultsByParams_Other { - paramsKey := m.Moq.ParamsKey_Other(params, resultsByParams.AnyParams) - var ok bool - results, ok = resultsByParams.Results[paramsKey] - if ok { + + anyCount := bits.OnesCount64(r.AnyParams) + insertAt := -1 + var results *MoqUsual_RepeatedIds_resultsByParams + for n, res := range r.Moq.ResultsByParams_RepeatedIds { + if res.AnyParams == r.AnyParams { + results = &res break } + if res.AnyCount > anyCount { + insertAt = n + } } if results == nil { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_Other(params)) + results = &MoqUsual_RepeatedIds_resultsByParams{ + AnyCount: anyCount, + AnyParams: r.AnyParams, + Results: map[MoqUsual_RepeatedIds_paramsKey]*MoqUsual_RepeatedIds_results{}, } - return - } - - i := int(atomic.AddUint32(&results.Index, 1)) - 1 - if i >= results.Repeat.ResultCount { - if !results.Repeat.AnyTimes { - if m.Moq.Config.Expectation == moq.Strict { - m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_Other(params)) - } - return + r.Moq.ResultsByParams_RepeatedIds = append(r.Moq.ResultsByParams_RepeatedIds, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_RepeatedIds) { + copy(r.Moq.ResultsByParams_RepeatedIds[insertAt+1:], r.Moq.ResultsByParams_RepeatedIds[insertAt:0]) + r.Moq.ResultsByParams_RepeatedIds[insertAt] = *results } - i = results.Repeat.ResultCount - 1 } - result := results.Results[i] - if result.Sequence != 0 { - sequence := m.Moq.Scene.NextMockSequence() - if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { - m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_Other(params)) + paramsKey := r.Moq.ParamsKey_RepeatedIds(r.Params, r.AnyParams) + + var ok bool + r.Results, ok = results.Results[paramsKey] + if !ok { + r.Results = &MoqUsual_RepeatedIds_results{ + Params: r.Params, + Results: nil, + Index: 0, + Repeat: &moq.RepeatVal{}, } + results.Results[paramsKey] = r.Results } - if result.DoFn != nil { - result.DoFn(param1) - } + r.Results.Repeat.Increment(r.Moq.Scene.T) +} - if result.Values != nil { - result1 = result.Values.Result1 +func (r *MoqUsual_RepeatedIds_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_RepeatedIds_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") + return nil } - if result.DoReturnFn != nil { - result1 = result.DoReturnFn(param1) + r.Results.Repeat.Repeat(r.Moq.Scene.T, repeaters) + last := r.Results.Results[len(r.Results.Results)-1] + for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { + if r.Sequence { + last = struct { + Values *struct { + SResult1, SResult2 string + Err error + } + Sequence uint32 + DoFn MoqUsual_RepeatedIds_doFn + DoReturnFn MoqUsual_RepeatedIds_doReturnFn + }{ + Values: last.Values, + Sequence: r.Moq.Scene.NextRecorderSequence(), + } + } + r.Results.Results = append(r.Results.Results, last) } - return + return r } -// OnCall returns the recorder implementation of the Usual type -func (m *MoqUsual) OnCall() *MoqUsual_recorder { - return &MoqUsual_recorder{ - Moq: m, +func (m *MoqUsual) PrettyParams_RepeatedIds(params MoqUsual_RepeatedIds_params) string { + return fmt.Sprintf("RepeatedIds(%#v, %#v, %#v)", params.SParam1, params.SParam2, params.BParam) +} + +func (m *MoqUsual) ParamsKey_RepeatedIds(params MoqUsual_RepeatedIds_params, anyParams uint64) MoqUsual_RepeatedIds_paramsKey { + m.Scene.T.Helper() + var sParam1Used string + var sParam1UsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.Runtime.ParameterIndexing.RepeatedIds.SParam1 == moq.ParamIndexByValue { + sParam1Used = params.SParam1 + } else { + sParam1UsedHash = hash.DeepHash(params.SParam1) + } + } + var sParam2Used string + var sParam2UsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.Runtime.ParameterIndexing.RepeatedIds.SParam2 == moq.ParamIndexByValue { + sParam2Used = params.SParam2 + } else { + sParam2UsedHash = hash.DeepHash(params.SParam2) + } + } + var bParamUsed bool + var bParamUsedHash hash.Hash + if anyParams&(1<<2) == 0 { + if m.Runtime.ParameterIndexing.RepeatedIds.BParam == moq.ParamIndexByValue { + bParamUsed = params.BParam + } else { + bParamUsedHash = hash.DeepHash(params.BParam) + } + } + return MoqUsual_RepeatedIds_paramsKey{ + Params: struct { + SParam1, SParam2 string + BParam bool + }{ + SParam1: sParam1Used, + SParam2: sParam2Used, + BParam: bParamUsed, + }, + Hashes: struct { + SParam1, SParam2 hash.Hash + BParam hash.Hash + }{ + SParam1: sParam1UsedHash, + SParam2: sParam2UsedHash, + BParam: bParamUsedHash, + }, } } -func (m *MoqUsual_recorder) Usual(sParam string, bParam bool) *MoqUsual_Usual_fnRecorder { - return &MoqUsual_Usual_fnRecorder{ - Params: MoqUsual_Usual_params{ +func (m *MoqUsual_recorder) Times(sParam string, times bool) *MoqUsual_Times_fnRecorder { + return &MoqUsual_Times_fnRecorder{ + Params: MoqUsual_Times_params{ SParam: sParam, - BParam: bParam, + Times: times, }, Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, Moq: m.Moq, } } -func (r *MoqUsual_Usual_fnRecorder) Any() *MoqUsual_Usual_anyParams { +func (r *MoqUsual_Times_fnRecorder) Any() *MoqUsual_Times_anyParams { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Times(r.Params)) return nil } - return &MoqUsual_Usual_anyParams{Recorder: r} + return &MoqUsual_Times_anyParams{Recorder: r} } -func (a *MoqUsual_Usual_anyParams) SParam() *MoqUsual_Usual_fnRecorder { +func (a *MoqUsual_Times_anyParams) SParam() *MoqUsual_Times_fnRecorder { a.Recorder.AnyParams |= 1 << 0 return a.Recorder } -func (a *MoqUsual_Usual_anyParams) BParam() *MoqUsual_Usual_fnRecorder { +func (a *MoqUsual_Times_anyParams) Times() *MoqUsual_Times_fnRecorder { a.Recorder.AnyParams |= 1 << 1 return a.Recorder } -func (r *MoqUsual_Usual_fnRecorder) Seq() *MoqUsual_Usual_fnRecorder { +func (r *MoqUsual_Times_fnRecorder) Seq() *MoqUsual_Times_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Times(r.Params)) return nil } r.Sequence = true return r } -func (r *MoqUsual_Usual_fnRecorder) NoSeq() *MoqUsual_Usual_fnRecorder { +func (r *MoqUsual_Times_fnRecorder) NoSeq() *MoqUsual_Times_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Times(r.Params)) return nil } r.Sequence = false return r } -func (r *MoqUsual_Usual_fnRecorder) ReturnResults(sResult string, err error) *MoqUsual_Usual_fnRecorder { +func (r *MoqUsual_Times_fnRecorder) ReturnResults(sResult string, err error) *MoqUsual_Times_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -10576,8 +14599,8 @@ func (r *MoqUsual_Usual_fnRecorder) ReturnResults(sResult string, err error) *Mo Err error } Sequence uint32 - DoFn MoqUsual_Usual_doFn - DoReturnFn MoqUsual_Usual_doReturnFn + DoFn MoqUsual_Times_doFn + DoReturnFn MoqUsual_Times_doReturnFn }{ Values: &struct { SResult string @@ -10591,7 +14614,7 @@ func (r *MoqUsual_Usual_fnRecorder) ReturnResults(sResult string, err error) *Mo return r } -func (r *MoqUsual_Usual_fnRecorder) AndDo(fn MoqUsual_Usual_doFn) *MoqUsual_Usual_fnRecorder { +func (r *MoqUsual_Times_fnRecorder) AndDo(fn MoqUsual_Times_doFn) *MoqUsual_Times_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") @@ -10602,7 +14625,7 @@ func (r *MoqUsual_Usual_fnRecorder) AndDo(fn MoqUsual_Usual_doFn) *MoqUsual_Usua return r } -func (r *MoqUsual_Usual_fnRecorder) DoReturnResults(fn MoqUsual_Usual_doReturnFn) *MoqUsual_Usual_fnRecorder { +func (r *MoqUsual_Times_fnRecorder) DoReturnResults(fn MoqUsual_Times_doReturnFn) *MoqUsual_Times_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -10617,13 +14640,13 @@ func (r *MoqUsual_Usual_fnRecorder) DoReturnResults(fn MoqUsual_Usual_doReturnFn Err error } Sequence uint32 - DoFn MoqUsual_Usual_doFn - DoReturnFn MoqUsual_Usual_doReturnFn + DoFn MoqUsual_Times_doFn + DoReturnFn MoqUsual_Times_doReturnFn }{Sequence: sequence, DoReturnFn: fn}) return r } -func (r *MoqUsual_Usual_fnRecorder) FindResults() { +func (r *MoqUsual_Times_fnRecorder) FindResults() { r.Moq.Scene.T.Helper() if r.Results != nil { r.Results.Repeat.Increment(r.Moq.Scene.T) @@ -10632,8 +14655,8 @@ func (r *MoqUsual_Usual_fnRecorder) FindResults() { anyCount := bits.OnesCount64(r.AnyParams) insertAt := -1 - var results *MoqUsual_Usual_resultsByParams - for n, res := range r.Moq.ResultsByParams_Usual { + var results *MoqUsual_Times_resultsByParams + for n, res := range r.Moq.ResultsByParams_Times { if res.AnyParams == r.AnyParams { results = &res break @@ -10643,24 +14666,24 @@ func (r *MoqUsual_Usual_fnRecorder) FindResults() { } } if results == nil { - results = &MoqUsual_Usual_resultsByParams{ + results = &MoqUsual_Times_resultsByParams{ AnyCount: anyCount, AnyParams: r.AnyParams, - Results: map[MoqUsual_Usual_paramsKey]*MoqUsual_Usual_results{}, + Results: map[MoqUsual_Times_paramsKey]*MoqUsual_Times_results{}, } - r.Moq.ResultsByParams_Usual = append(r.Moq.ResultsByParams_Usual, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_Usual) { - copy(r.Moq.ResultsByParams_Usual[insertAt+1:], r.Moq.ResultsByParams_Usual[insertAt:0]) - r.Moq.ResultsByParams_Usual[insertAt] = *results + r.Moq.ResultsByParams_Times = append(r.Moq.ResultsByParams_Times, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_Times) { + copy(r.Moq.ResultsByParams_Times[insertAt+1:], r.Moq.ResultsByParams_Times[insertAt:0]) + r.Moq.ResultsByParams_Times[insertAt] = *results } } - paramsKey := r.Moq.ParamsKey_Usual(r.Params, r.AnyParams) + paramsKey := r.Moq.ParamsKey_Times(r.Params, r.AnyParams) var ok bool r.Results, ok = results.Results[paramsKey] if !ok { - r.Results = &MoqUsual_Usual_results{ + r.Results = &MoqUsual_Times_results{ Params: r.Params, Results: nil, Index: 0, @@ -10672,7 +14695,7 @@ func (r *MoqUsual_Usual_fnRecorder) FindResults() { r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (r *MoqUsual_Usual_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_Usual_fnRecorder { +func (r *MoqUsual_Times_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_Times_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") @@ -10688,8 +14711,8 @@ func (r *MoqUsual_Usual_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_ Err error } Sequence uint32 - DoFn MoqUsual_Usual_doFn - DoReturnFn MoqUsual_Usual_doReturnFn + DoFn MoqUsual_Times_doFn + DoReturnFn MoqUsual_Times_doReturnFn }{ Values: last.Values, Sequence: r.Moq.Scene.NextRecorderSequence(), @@ -10700,99 +14723,141 @@ func (r *MoqUsual_Usual_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_ return r } -func (m *MoqUsual) PrettyParams_Usual(params MoqUsual_Usual_params) string { - return fmt.Sprintf("Usual(%#v, %#v)", params.SParam, params.BParam) +func (m *MoqUsual) PrettyParams_Times(params MoqUsual_Times_params) string { + return fmt.Sprintf("Times(%#v, %#v)", params.SParam, params.Times) } -func (m *MoqUsual) ParamsKey_Usual(params MoqUsual_Usual_params, anyParams uint64) MoqUsual_Usual_paramsKey { +func (m *MoqUsual) ParamsKey_Times(params MoqUsual_Times_params, anyParams uint64) MoqUsual_Times_paramsKey { m.Scene.T.Helper() var sParamUsed string var sParamUsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.Runtime.ParameterIndexing.Usual.SParam == moq.ParamIndexByValue { + if m.Runtime.ParameterIndexing.Times.SParam == moq.ParamIndexByValue { sParamUsed = params.SParam } else { sParamUsedHash = hash.DeepHash(params.SParam) } } - var bParamUsed bool - var bParamUsedHash hash.Hash + var timesUsed bool + var timesUsedHash hash.Hash if anyParams&(1<<1) == 0 { - if m.Runtime.ParameterIndexing.Usual.BParam == moq.ParamIndexByValue { - bParamUsed = params.BParam + if m.Runtime.ParameterIndexing.Times.Times == moq.ParamIndexByValue { + timesUsed = params.Times } else { - bParamUsedHash = hash.DeepHash(params.BParam) + timesUsedHash = hash.DeepHash(params.Times) } } - return MoqUsual_Usual_paramsKey{ + return MoqUsual_Times_paramsKey{ Params: struct { SParam string - BParam bool + Times bool }{ SParam: sParamUsed, - BParam: bParamUsed, + Times: timesUsed, }, Hashes: struct { SParam hash.Hash - BParam hash.Hash + Times hash.Hash }{ SParam: sParamUsedHash, - BParam: bParamUsedHash, + Times: timesUsedHash, }, } } -func (m *MoqUsual_recorder) NoNames(param1 string, param2 bool) *MoqUsual_NoNames_fnRecorder { - return &MoqUsual_NoNames_fnRecorder{ - Params: MoqUsual_NoNames_params{ +func (m *MoqUsual_recorder) DifficultParamNames(param1, param2 bool, param3 string, param, param5, param6 int, param7, param8, param9 float32) *MoqUsual_DifficultParamNames_fnRecorder { + return &MoqUsual_DifficultParamNames_fnRecorder{ + Params: MoqUsual_DifficultParamNames_params{ Param1: param1, Param2: param2, + Param3: param3, + Param: param, + Param5: param5, + Param6: param6, + Param7: param7, + Param8: param8, + Param9: param9, }, Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, Moq: m.Moq, } } -func (r *MoqUsual_NoNames_fnRecorder) Any() *MoqUsual_NoNames_anyParams { +func (r *MoqUsual_DifficultParamNames_fnRecorder) Any() *MoqUsual_DifficultParamNames_anyParams { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_NoNames(r.Params)) + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DifficultParamNames(r.Params)) return nil } - return &MoqUsual_NoNames_anyParams{Recorder: r} + return &MoqUsual_DifficultParamNames_anyParams{Recorder: r} } -func (a *MoqUsual_NoNames_anyParams) Param1() *MoqUsual_NoNames_fnRecorder { +func (a *MoqUsual_DifficultParamNames_anyParams) Param1() *MoqUsual_DifficultParamNames_fnRecorder { a.Recorder.AnyParams |= 1 << 0 return a.Recorder } -func (a *MoqUsual_NoNames_anyParams) Param2() *MoqUsual_NoNames_fnRecorder { +func (a *MoqUsual_DifficultParamNames_anyParams) Param2() *MoqUsual_DifficultParamNames_fnRecorder { a.Recorder.AnyParams |= 1 << 1 return a.Recorder } -func (r *MoqUsual_NoNames_fnRecorder) Seq() *MoqUsual_NoNames_fnRecorder { +func (a *MoqUsual_DifficultParamNames_anyParams) Param3() *MoqUsual_DifficultParamNames_fnRecorder { + a.Recorder.AnyParams |= 1 << 2 + return a.Recorder +} + +func (a *MoqUsual_DifficultParamNames_anyParams) Param() *MoqUsual_DifficultParamNames_fnRecorder { + a.Recorder.AnyParams |= 1 << 3 + return a.Recorder +} + +func (a *MoqUsual_DifficultParamNames_anyParams) Param5() *MoqUsual_DifficultParamNames_fnRecorder { + a.Recorder.AnyParams |= 1 << 4 + return a.Recorder +} + +func (a *MoqUsual_DifficultParamNames_anyParams) Param6() *MoqUsual_DifficultParamNames_fnRecorder { + a.Recorder.AnyParams |= 1 << 5 + return a.Recorder +} + +func (a *MoqUsual_DifficultParamNames_anyParams) Param7() *MoqUsual_DifficultParamNames_fnRecorder { + a.Recorder.AnyParams |= 1 << 6 + return a.Recorder +} + +func (a *MoqUsual_DifficultParamNames_anyParams) Param8() *MoqUsual_DifficultParamNames_fnRecorder { + a.Recorder.AnyParams |= 1 << 7 + return a.Recorder +} + +func (a *MoqUsual_DifficultParamNames_anyParams) Param9() *MoqUsual_DifficultParamNames_fnRecorder { + a.Recorder.AnyParams |= 1 << 8 + return a.Recorder +} + +func (r *MoqUsual_DifficultParamNames_fnRecorder) Seq() *MoqUsual_DifficultParamNames_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_NoNames(r.Params)) + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DifficultParamNames(r.Params)) return nil } r.Sequence = true return r } -func (r *MoqUsual_NoNames_fnRecorder) NoSeq() *MoqUsual_NoNames_fnRecorder { +func (r *MoqUsual_DifficultParamNames_fnRecorder) NoSeq() *MoqUsual_DifficultParamNames_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_NoNames(r.Params)) + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DifficultParamNames(r.Params)) return nil } r.Sequence = false return r } -func (r *MoqUsual_NoNames_fnRecorder) ReturnResults(result1 string, result2 error) *MoqUsual_NoNames_fnRecorder { +func (r *MoqUsual_DifficultParamNames_fnRecorder) ReturnResults() *MoqUsual_DifficultParamNames_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -10802,27 +14867,18 @@ func (r *MoqUsual_NoNames_fnRecorder) ReturnResults(result1 string, result2 erro } r.Results.Results = append(r.Results.Results, struct { - Values *struct { - Result1 string - Result2 error - } + Values *struct{} Sequence uint32 - DoFn MoqUsual_NoNames_doFn - DoReturnFn MoqUsual_NoNames_doReturnFn + DoFn MoqUsual_DifficultParamNames_doFn + DoReturnFn MoqUsual_DifficultParamNames_doReturnFn }{ - Values: &struct { - Result1 string - Result2 error - }{ - Result1: result1, - Result2: result2, - }, + Values: &struct{}{}, Sequence: sequence, }) return r } -func (r *MoqUsual_NoNames_fnRecorder) AndDo(fn MoqUsual_NoNames_doFn) *MoqUsual_NoNames_fnRecorder { +func (r *MoqUsual_DifficultParamNames_fnRecorder) AndDo(fn MoqUsual_DifficultParamNames_doFn) *MoqUsual_DifficultParamNames_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") @@ -10833,7 +14889,7 @@ func (r *MoqUsual_NoNames_fnRecorder) AndDo(fn MoqUsual_NoNames_doFn) *MoqUsual_ return r } -func (r *MoqUsual_NoNames_fnRecorder) DoReturnResults(fn MoqUsual_NoNames_doReturnFn) *MoqUsual_NoNames_fnRecorder { +func (r *MoqUsual_DifficultParamNames_fnRecorder) DoReturnResults(fn MoqUsual_DifficultParamNames_doReturnFn) *MoqUsual_DifficultParamNames_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -10843,18 +14899,15 @@ func (r *MoqUsual_NoNames_fnRecorder) DoReturnResults(fn MoqUsual_NoNames_doRetu } r.Results.Results = append(r.Results.Results, struct { - Values *struct { - Result1 string - Result2 error - } + Values *struct{} Sequence uint32 - DoFn MoqUsual_NoNames_doFn - DoReturnFn MoqUsual_NoNames_doReturnFn + DoFn MoqUsual_DifficultParamNames_doFn + DoReturnFn MoqUsual_DifficultParamNames_doReturnFn }{Sequence: sequence, DoReturnFn: fn}) return r } -func (r *MoqUsual_NoNames_fnRecorder) FindResults() { +func (r *MoqUsual_DifficultParamNames_fnRecorder) FindResults() { r.Moq.Scene.T.Helper() if r.Results != nil { r.Results.Repeat.Increment(r.Moq.Scene.T) @@ -10863,8 +14916,8 @@ func (r *MoqUsual_NoNames_fnRecorder) FindResults() { anyCount := bits.OnesCount64(r.AnyParams) insertAt := -1 - var results *MoqUsual_NoNames_resultsByParams - for n, res := range r.Moq.ResultsByParams_NoNames { + var results *MoqUsual_DifficultParamNames_resultsByParams + for n, res := range r.Moq.ResultsByParams_DifficultParamNames { if res.AnyParams == r.AnyParams { results = &res break @@ -10874,24 +14927,24 @@ func (r *MoqUsual_NoNames_fnRecorder) FindResults() { } } if results == nil { - results = &MoqUsual_NoNames_resultsByParams{ + results = &MoqUsual_DifficultParamNames_resultsByParams{ AnyCount: anyCount, AnyParams: r.AnyParams, - Results: map[MoqUsual_NoNames_paramsKey]*MoqUsual_NoNames_results{}, + Results: map[MoqUsual_DifficultParamNames_paramsKey]*MoqUsual_DifficultParamNames_results{}, } - r.Moq.ResultsByParams_NoNames = append(r.Moq.ResultsByParams_NoNames, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_NoNames) { - copy(r.Moq.ResultsByParams_NoNames[insertAt+1:], r.Moq.ResultsByParams_NoNames[insertAt:0]) - r.Moq.ResultsByParams_NoNames[insertAt] = *results + r.Moq.ResultsByParams_DifficultParamNames = append(r.Moq.ResultsByParams_DifficultParamNames, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_DifficultParamNames) { + copy(r.Moq.ResultsByParams_DifficultParamNames[insertAt+1:], r.Moq.ResultsByParams_DifficultParamNames[insertAt:0]) + r.Moq.ResultsByParams_DifficultParamNames[insertAt] = *results } } - paramsKey := r.Moq.ParamsKey_NoNames(r.Params, r.AnyParams) + paramsKey := r.Moq.ParamsKey_DifficultParamNames(r.Params, r.AnyParams) var ok bool r.Results, ok = results.Results[paramsKey] if !ok { - r.Results = &MoqUsual_NoNames_results{ + r.Results = &MoqUsual_DifficultParamNames_results{ Params: r.Params, Results: nil, Index: 0, @@ -10903,7 +14956,7 @@ func (r *MoqUsual_NoNames_fnRecorder) FindResults() { r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (r *MoqUsual_NoNames_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_NoNames_fnRecorder { +func (r *MoqUsual_DifficultParamNames_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_DifficultParamNames_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") @@ -10914,13 +14967,10 @@ func (r *MoqUsual_NoNames_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsua for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { if r.Sequence { last = struct { - Values *struct { - Result1 string - Result2 error - } + Values *struct{} Sequence uint32 - DoFn MoqUsual_NoNames_doFn - DoReturnFn MoqUsual_NoNames_doReturnFn + DoFn MoqUsual_DifficultParamNames_doFn + DoReturnFn MoqUsual_DifficultParamNames_doReturnFn }{ Values: last.Values, Sequence: r.Moq.Scene.NextRecorderSequence(), @@ -10931,16 +14981,16 @@ func (r *MoqUsual_NoNames_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsua return r } -func (m *MoqUsual) PrettyParams_NoNames(params MoqUsual_NoNames_params) string { - return fmt.Sprintf("NoNames(%#v, %#v)", params.Param1, params.Param2) +func (m *MoqUsual) PrettyParams_DifficultParamNames(params MoqUsual_DifficultParamNames_params) string { + return fmt.Sprintf("DifficultParamNames(%#v, %#v, %#v, %#v, %#v, %#v, %#v, %#v, %#v)", params.Param1, params.Param2, params.Param3, params.Param, params.Param5, params.Param6, params.Param7, params.Param8, params.Param9) } -func (m *MoqUsual) ParamsKey_NoNames(params MoqUsual_NoNames_params, anyParams uint64) MoqUsual_NoNames_paramsKey { +func (m *MoqUsual) ParamsKey_DifficultParamNames(params MoqUsual_DifficultParamNames_params, anyParams uint64) MoqUsual_DifficultParamNames_paramsKey { m.Scene.T.Helper() - var param1Used string + var param1Used bool var param1UsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.Runtime.ParameterIndexing.NoNames.Param1 == moq.ParamIndexByValue { + if m.Runtime.ParameterIndexing.DifficultParamNames.Param1 == moq.ParamIndexByValue { param1Used = params.Param1 } else { param1UsedHash = hash.DeepHash(params.Param1) @@ -10949,81 +14999,149 @@ func (m *MoqUsual) ParamsKey_NoNames(params MoqUsual_NoNames_params, anyParams u var param2Used bool var param2UsedHash hash.Hash if anyParams&(1<<1) == 0 { - if m.Runtime.ParameterIndexing.NoNames.Param2 == moq.ParamIndexByValue { + if m.Runtime.ParameterIndexing.DifficultParamNames.Param2 == moq.ParamIndexByValue { param2Used = params.Param2 } else { param2UsedHash = hash.DeepHash(params.Param2) } } - return MoqUsual_NoNames_paramsKey{ + var param3Used string + var param3UsedHash hash.Hash + if anyParams&(1<<2) == 0 { + if m.Runtime.ParameterIndexing.DifficultParamNames.Param3 == moq.ParamIndexByValue { + param3Used = params.Param3 + } else { + param3UsedHash = hash.DeepHash(params.Param3) + } + } + var paramUsed int + var paramUsedHash hash.Hash + if anyParams&(1<<3) == 0 { + if m.Runtime.ParameterIndexing.DifficultParamNames.Param == moq.ParamIndexByValue { + paramUsed = params.Param + } else { + paramUsedHash = hash.DeepHash(params.Param) + } + } + var param5Used int + var param5UsedHash hash.Hash + if anyParams&(1<<4) == 0 { + if m.Runtime.ParameterIndexing.DifficultParamNames.Param5 == moq.ParamIndexByValue { + param5Used = params.Param5 + } else { + param5UsedHash = hash.DeepHash(params.Param5) + } + } + var param6Used int + var param6UsedHash hash.Hash + if anyParams&(1<<5) == 0 { + if m.Runtime.ParameterIndexing.DifficultParamNames.Param6 == moq.ParamIndexByValue { + param6Used = params.Param6 + } else { + param6UsedHash = hash.DeepHash(params.Param6) + } + } + var param7Used float32 + var param7UsedHash hash.Hash + if anyParams&(1<<6) == 0 { + if m.Runtime.ParameterIndexing.DifficultParamNames.Param7 == moq.ParamIndexByValue { + param7Used = params.Param7 + } else { + param7UsedHash = hash.DeepHash(params.Param7) + } + } + var param8Used float32 + var param8UsedHash hash.Hash + if anyParams&(1<<7) == 0 { + if m.Runtime.ParameterIndexing.DifficultParamNames.Param8 == moq.ParamIndexByValue { + param8Used = params.Param8 + } else { + param8UsedHash = hash.DeepHash(params.Param8) + } + } + var param9Used float32 + var param9UsedHash hash.Hash + if anyParams&(1<<8) == 0 { + if m.Runtime.ParameterIndexing.DifficultParamNames.Param9 == moq.ParamIndexByValue { + param9Used = params.Param9 + } else { + param9UsedHash = hash.DeepHash(params.Param9) + } + } + return MoqUsual_DifficultParamNames_paramsKey{ Params: struct { - Param1 string - Param2 bool + Param1, Param2 bool + Param3 string + Param, Param5, Param6 int + Param7, Param8, Param9 float32 }{ Param1: param1Used, Param2: param2Used, + Param3: param3Used, + Param: paramUsed, + Param5: param5Used, + Param6: param6Used, + Param7: param7Used, + Param8: param8Used, + Param9: param9Used, }, Hashes: struct { - Param1 hash.Hash - Param2 hash.Hash + Param1, Param2 hash.Hash + Param3 hash.Hash + Param, Param5, Param6 hash.Hash + Param7, Param8, Param9 hash.Hash }{ Param1: param1UsedHash, Param2: param2UsedHash, + Param3: param3UsedHash, + Param: paramUsedHash, + Param5: param5UsedHash, + Param6: param6UsedHash, + Param7: param7UsedHash, + Param8: param8UsedHash, + Param9: param9UsedHash, }, } } -func (m *MoqUsual_recorder) NoResults(sParam string, bParam bool) *MoqUsual_NoResults_fnRecorder { - return &MoqUsual_NoResults_fnRecorder{ - Params: MoqUsual_NoResults_params{ - SParam: sParam, - BParam: bParam, - }, +func (m *MoqUsual_recorder) DifficultResultNames() *MoqUsual_DifficultResultNames_fnRecorder { + return &MoqUsual_DifficultResultNames_fnRecorder{ + Params: MoqUsual_DifficultResultNames_params{}, Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, Moq: m.Moq, } } -func (r *MoqUsual_NoResults_fnRecorder) Any() *MoqUsual_NoResults_anyParams { +func (r *MoqUsual_DifficultResultNames_fnRecorder) Any() *MoqUsual_DifficultResultNames_anyParams { r.Moq.Scene.T.Helper() - if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_NoResults(r.Params)) - return nil - } - return &MoqUsual_NoResults_anyParams{Recorder: r} -} - -func (a *MoqUsual_NoResults_anyParams) SParam() *MoqUsual_NoResults_fnRecorder { - a.Recorder.AnyParams |= 1 << 0 - return a.Recorder -} - -func (a *MoqUsual_NoResults_anyParams) BParam() *MoqUsual_NoResults_fnRecorder { - a.Recorder.AnyParams |= 1 << 1 - return a.Recorder + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DifficultResultNames(r.Params)) + return nil + } + return &MoqUsual_DifficultResultNames_anyParams{Recorder: r} } -func (r *MoqUsual_NoResults_fnRecorder) Seq() *MoqUsual_NoResults_fnRecorder { +func (r *MoqUsual_DifficultResultNames_fnRecorder) Seq() *MoqUsual_DifficultResultNames_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_NoResults(r.Params)) + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DifficultResultNames(r.Params)) return nil } r.Sequence = true return r } -func (r *MoqUsual_NoResults_fnRecorder) NoSeq() *MoqUsual_NoResults_fnRecorder { +func (r *MoqUsual_DifficultResultNames_fnRecorder) NoSeq() *MoqUsual_DifficultResultNames_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_NoResults(r.Params)) + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DifficultResultNames(r.Params)) return nil } r.Sequence = false return r } -func (r *MoqUsual_NoResults_fnRecorder) ReturnResults() *MoqUsual_NoResults_fnRecorder { +func (r *MoqUsual_DifficultResultNames_fnRecorder) ReturnResults(result1, result2 string, result3 error, param, result5, result6 int, result7, result8, result9 float32) *MoqUsual_DifficultResultNames_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -11033,18 +15151,38 @@ func (r *MoqUsual_NoResults_fnRecorder) ReturnResults() *MoqUsual_NoResults_fnRe } r.Results.Results = append(r.Results.Results, struct { - Values *struct{} + Values *struct { + Result1, Result2 string + Result3 error + Param, Result5, Result6 int + Result7, Result8, Result9 float32 + } Sequence uint32 - DoFn MoqUsual_NoResults_doFn - DoReturnFn MoqUsual_NoResults_doReturnFn + DoFn MoqUsual_DifficultResultNames_doFn + DoReturnFn MoqUsual_DifficultResultNames_doReturnFn }{ - Values: &struct{}{}, + Values: &struct { + Result1, Result2 string + Result3 error + Param, Result5, Result6 int + Result7, Result8, Result9 float32 + }{ + Result1: result1, + Result2: result2, + Result3: result3, + Param: param, + Result5: result5, + Result6: result6, + Result7: result7, + Result8: result8, + Result9: result9, + }, Sequence: sequence, }) return r } -func (r *MoqUsual_NoResults_fnRecorder) AndDo(fn MoqUsual_NoResults_doFn) *MoqUsual_NoResults_fnRecorder { +func (r *MoqUsual_DifficultResultNames_fnRecorder) AndDo(fn MoqUsual_DifficultResultNames_doFn) *MoqUsual_DifficultResultNames_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") @@ -11055,7 +15193,7 @@ func (r *MoqUsual_NoResults_fnRecorder) AndDo(fn MoqUsual_NoResults_doFn) *MoqUs return r } -func (r *MoqUsual_NoResults_fnRecorder) DoReturnResults(fn MoqUsual_NoResults_doReturnFn) *MoqUsual_NoResults_fnRecorder { +func (r *MoqUsual_DifficultResultNames_fnRecorder) DoReturnResults(fn MoqUsual_DifficultResultNames_doReturnFn) *MoqUsual_DifficultResultNames_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -11065,15 +15203,20 @@ func (r *MoqUsual_NoResults_fnRecorder) DoReturnResults(fn MoqUsual_NoResults_do } r.Results.Results = append(r.Results.Results, struct { - Values *struct{} + Values *struct { + Result1, Result2 string + Result3 error + Param, Result5, Result6 int + Result7, Result8, Result9 float32 + } Sequence uint32 - DoFn MoqUsual_NoResults_doFn - DoReturnFn MoqUsual_NoResults_doReturnFn + DoFn MoqUsual_DifficultResultNames_doFn + DoReturnFn MoqUsual_DifficultResultNames_doReturnFn }{Sequence: sequence, DoReturnFn: fn}) return r } -func (r *MoqUsual_NoResults_fnRecorder) FindResults() { +func (r *MoqUsual_DifficultResultNames_fnRecorder) FindResults() { r.Moq.Scene.T.Helper() if r.Results != nil { r.Results.Repeat.Increment(r.Moq.Scene.T) @@ -11082,8 +15225,8 @@ func (r *MoqUsual_NoResults_fnRecorder) FindResults() { anyCount := bits.OnesCount64(r.AnyParams) insertAt := -1 - var results *MoqUsual_NoResults_resultsByParams - for n, res := range r.Moq.ResultsByParams_NoResults { + var results *MoqUsual_DifficultResultNames_resultsByParams + for n, res := range r.Moq.ResultsByParams_DifficultResultNames { if res.AnyParams == r.AnyParams { results = &res break @@ -11093,24 +15236,24 @@ func (r *MoqUsual_NoResults_fnRecorder) FindResults() { } } if results == nil { - results = &MoqUsual_NoResults_resultsByParams{ + results = &MoqUsual_DifficultResultNames_resultsByParams{ AnyCount: anyCount, AnyParams: r.AnyParams, - Results: map[MoqUsual_NoResults_paramsKey]*MoqUsual_NoResults_results{}, + Results: map[MoqUsual_DifficultResultNames_paramsKey]*MoqUsual_DifficultResultNames_results{}, } - r.Moq.ResultsByParams_NoResults = append(r.Moq.ResultsByParams_NoResults, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_NoResults) { - copy(r.Moq.ResultsByParams_NoResults[insertAt+1:], r.Moq.ResultsByParams_NoResults[insertAt:0]) - r.Moq.ResultsByParams_NoResults[insertAt] = *results + r.Moq.ResultsByParams_DifficultResultNames = append(r.Moq.ResultsByParams_DifficultResultNames, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_DifficultResultNames) { + copy(r.Moq.ResultsByParams_DifficultResultNames[insertAt+1:], r.Moq.ResultsByParams_DifficultResultNames[insertAt:0]) + r.Moq.ResultsByParams_DifficultResultNames[insertAt] = *results } } - paramsKey := r.Moq.ParamsKey_NoResults(r.Params, r.AnyParams) + paramsKey := r.Moq.ParamsKey_DifficultResultNames(r.Params, r.AnyParams) var ok bool r.Results, ok = results.Results[paramsKey] if !ok { - r.Results = &MoqUsual_NoResults_results{ + r.Results = &MoqUsual_DifficultResultNames_results{ Params: r.Params, Results: nil, Index: 0, @@ -11122,7 +15265,7 @@ func (r *MoqUsual_NoResults_fnRecorder) FindResults() { r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (r *MoqUsual_NoResults_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_NoResults_fnRecorder { +func (r *MoqUsual_DifficultResultNames_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_DifficultResultNames_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") @@ -11133,10 +15276,15 @@ func (r *MoqUsual_NoResults_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUs for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { if r.Sequence { last = struct { - Values *struct{} + Values *struct { + Result1, Result2 string + Result3 error + Param, Result5, Result6 int + Result7, Result8, Result9 float32 + } Sequence uint32 - DoFn MoqUsual_NoResults_doFn - DoReturnFn MoqUsual_NoResults_doReturnFn + DoFn MoqUsual_DifficultResultNames_doFn + DoReturnFn MoqUsual_DifficultResultNames_doReturnFn }{ Values: last.Values, Sequence: r.Moq.Scene.NextRecorderSequence(), @@ -11147,86 +15295,63 @@ func (r *MoqUsual_NoResults_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUs return r } -func (m *MoqUsual) PrettyParams_NoResults(params MoqUsual_NoResults_params) string { - return fmt.Sprintf("NoResults(%#v, %#v)", params.SParam, params.BParam) +func (m *MoqUsual) PrettyParams_DifficultResultNames(params MoqUsual_DifficultResultNames_params) string { + return fmt.Sprintf("DifficultResultNames()") } -func (m *MoqUsual) ParamsKey_NoResults(params MoqUsual_NoResults_params, anyParams uint64) MoqUsual_NoResults_paramsKey { +func (m *MoqUsual) ParamsKey_DifficultResultNames(params MoqUsual_DifficultResultNames_params, anyParams uint64) MoqUsual_DifficultResultNames_paramsKey { m.Scene.T.Helper() - var sParamUsed string - var sParamUsedHash hash.Hash - if anyParams&(1<<0) == 0 { - if m.Runtime.ParameterIndexing.NoResults.SParam == moq.ParamIndexByValue { - sParamUsed = params.SParam - } else { - sParamUsedHash = hash.DeepHash(params.SParam) - } - } - var bParamUsed bool - var bParamUsedHash hash.Hash - if anyParams&(1<<1) == 0 { - if m.Runtime.ParameterIndexing.NoResults.BParam == moq.ParamIndexByValue { - bParamUsed = params.BParam - } else { - bParamUsedHash = hash.DeepHash(params.BParam) - } - } - return MoqUsual_NoResults_paramsKey{ - Params: struct { - SParam string - BParam bool - }{ - SParam: sParamUsed, - BParam: bParamUsed, - }, - Hashes: struct { - SParam hash.Hash - BParam hash.Hash - }{ - SParam: sParamUsedHash, - BParam: bParamUsedHash, - }, + return MoqUsual_DifficultResultNames_paramsKey{ + Params: struct{}{}, + Hashes: struct{}{}, } } -func (m *MoqUsual_recorder) NoParams() *MoqUsual_NoParams_fnRecorder { - return &MoqUsual_NoParams_fnRecorder{ - Params: MoqUsual_NoParams_params{}, +func (m *MoqUsual_recorder) PassByArray(p [3]testmoqs.Params) *MoqUsual_PassByArray_fnRecorder { + return &MoqUsual_PassByArray_fnRecorder{ + Params: MoqUsual_PassByArray_params{ + P: p, + }, Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, Moq: m.Moq, } } -func (r *MoqUsual_NoParams_fnRecorder) Any() *MoqUsual_NoParams_anyParams { +func (r *MoqUsual_PassByArray_fnRecorder) Any() *MoqUsual_PassByArray_anyParams { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_NoParams(r.Params)) + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByArray(r.Params)) return nil } - return &MoqUsual_NoParams_anyParams{Recorder: r} + return &MoqUsual_PassByArray_anyParams{Recorder: r} } -func (r *MoqUsual_NoParams_fnRecorder) Seq() *MoqUsual_NoParams_fnRecorder { +func (a *MoqUsual_PassByArray_anyParams) P() *MoqUsual_PassByArray_fnRecorder { + a.Recorder.AnyParams |= 1 << 0 + return a.Recorder +} + +func (r *MoqUsual_PassByArray_fnRecorder) Seq() *MoqUsual_PassByArray_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_NoParams(r.Params)) + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByArray(r.Params)) return nil } r.Sequence = true return r } -func (r *MoqUsual_NoParams_fnRecorder) NoSeq() *MoqUsual_NoParams_fnRecorder { +func (r *MoqUsual_PassByArray_fnRecorder) NoSeq() *MoqUsual_PassByArray_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_NoParams(r.Params)) + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByArray(r.Params)) return nil } r.Sequence = false return r } -func (r *MoqUsual_NoParams_fnRecorder) ReturnResults(sResult string, err error) *MoqUsual_NoParams_fnRecorder { +func (r *MoqUsual_PassByArray_fnRecorder) ReturnResults(result1 [3]testmoqs.Results) *MoqUsual_PassByArray_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -11237,26 +15362,23 @@ func (r *MoqUsual_NoParams_fnRecorder) ReturnResults(sResult string, err error) r.Results.Results = append(r.Results.Results, struct { Values *struct { - SResult string - Err error + Result1 [3]testmoqs.Results } Sequence uint32 - DoFn MoqUsual_NoParams_doFn - DoReturnFn MoqUsual_NoParams_doReturnFn + DoFn MoqUsual_PassByArray_doFn + DoReturnFn MoqUsual_PassByArray_doReturnFn }{ Values: &struct { - SResult string - Err error + Result1 [3]testmoqs.Results }{ - SResult: sResult, - Err: err, + Result1: result1, }, Sequence: sequence, }) return r } -func (r *MoqUsual_NoParams_fnRecorder) AndDo(fn MoqUsual_NoParams_doFn) *MoqUsual_NoParams_fnRecorder { +func (r *MoqUsual_PassByArray_fnRecorder) AndDo(fn MoqUsual_PassByArray_doFn) *MoqUsual_PassByArray_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") @@ -11267,7 +15389,7 @@ func (r *MoqUsual_NoParams_fnRecorder) AndDo(fn MoqUsual_NoParams_doFn) *MoqUsua return r } -func (r *MoqUsual_NoParams_fnRecorder) DoReturnResults(fn MoqUsual_NoParams_doReturnFn) *MoqUsual_NoParams_fnRecorder { +func (r *MoqUsual_PassByArray_fnRecorder) DoReturnResults(fn MoqUsual_PassByArray_doReturnFn) *MoqUsual_PassByArray_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -11278,17 +15400,16 @@ func (r *MoqUsual_NoParams_fnRecorder) DoReturnResults(fn MoqUsual_NoParams_doRe r.Results.Results = append(r.Results.Results, struct { Values *struct { - SResult string - Err error + Result1 [3]testmoqs.Results } Sequence uint32 - DoFn MoqUsual_NoParams_doFn - DoReturnFn MoqUsual_NoParams_doReturnFn + DoFn MoqUsual_PassByArray_doFn + DoReturnFn MoqUsual_PassByArray_doReturnFn }{Sequence: sequence, DoReturnFn: fn}) return r } -func (r *MoqUsual_NoParams_fnRecorder) FindResults() { +func (r *MoqUsual_PassByArray_fnRecorder) FindResults() { r.Moq.Scene.T.Helper() if r.Results != nil { r.Results.Repeat.Increment(r.Moq.Scene.T) @@ -11297,8 +15418,8 @@ func (r *MoqUsual_NoParams_fnRecorder) FindResults() { anyCount := bits.OnesCount64(r.AnyParams) insertAt := -1 - var results *MoqUsual_NoParams_resultsByParams - for n, res := range r.Moq.ResultsByParams_NoParams { + var results *MoqUsual_PassByArray_resultsByParams + for n, res := range r.Moq.ResultsByParams_PassByArray { if res.AnyParams == r.AnyParams { results = &res break @@ -11308,24 +15429,24 @@ func (r *MoqUsual_NoParams_fnRecorder) FindResults() { } } if results == nil { - results = &MoqUsual_NoParams_resultsByParams{ + results = &MoqUsual_PassByArray_resultsByParams{ AnyCount: anyCount, AnyParams: r.AnyParams, - Results: map[MoqUsual_NoParams_paramsKey]*MoqUsual_NoParams_results{}, + Results: map[MoqUsual_PassByArray_paramsKey]*MoqUsual_PassByArray_results{}, } - r.Moq.ResultsByParams_NoParams = append(r.Moq.ResultsByParams_NoParams, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_NoParams) { - copy(r.Moq.ResultsByParams_NoParams[insertAt+1:], r.Moq.ResultsByParams_NoParams[insertAt:0]) - r.Moq.ResultsByParams_NoParams[insertAt] = *results + r.Moq.ResultsByParams_PassByArray = append(r.Moq.ResultsByParams_PassByArray, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_PassByArray) { + copy(r.Moq.ResultsByParams_PassByArray[insertAt+1:], r.Moq.ResultsByParams_PassByArray[insertAt:0]) + r.Moq.ResultsByParams_PassByArray[insertAt] = *results } } - paramsKey := r.Moq.ParamsKey_NoParams(r.Params, r.AnyParams) + paramsKey := r.Moq.ParamsKey_PassByArray(r.Params, r.AnyParams) var ok bool r.Results, ok = results.Results[paramsKey] if !ok { - r.Results = &MoqUsual_NoParams_results{ + r.Results = &MoqUsual_PassByArray_results{ Params: r.Params, Results: nil, Index: 0, @@ -11337,7 +15458,7 @@ func (r *MoqUsual_NoParams_fnRecorder) FindResults() { r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (r *MoqUsual_NoParams_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_NoParams_fnRecorder { +func (r *MoqUsual_PassByArray_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_PassByArray_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") @@ -11349,12 +15470,11 @@ func (r *MoqUsual_NoParams_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsu if r.Sequence { last = struct { Values *struct { - SResult string - Err error + Result1 [3]testmoqs.Results } Sequence uint32 - DoFn MoqUsual_NoParams_doFn - DoReturnFn MoqUsual_NoParams_doReturnFn + DoFn MoqUsual_PassByArray_doFn + DoReturnFn MoqUsual_PassByArray_doReturnFn }{ Values: last.Values, Sequence: r.Moq.Scene.NextRecorderSequence(), @@ -11365,56 +15485,76 @@ func (r *MoqUsual_NoParams_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsu return r } -func (m *MoqUsual) PrettyParams_NoParams(params MoqUsual_NoParams_params) string { - return fmt.Sprintf("NoParams()") +func (m *MoqUsual) PrettyParams_PassByArray(params MoqUsual_PassByArray_params) string { + return fmt.Sprintf("PassByArray(%#v)", params.P) } -func (m *MoqUsual) ParamsKey_NoParams(params MoqUsual_NoParams_params, anyParams uint64) MoqUsual_NoParams_paramsKey { +func (m *MoqUsual) ParamsKey_PassByArray(params MoqUsual_PassByArray_params, anyParams uint64) MoqUsual_PassByArray_paramsKey { m.Scene.T.Helper() - return MoqUsual_NoParams_paramsKey{ - Params: struct{}{}, - Hashes: struct{}{}, + var pUsed [3]testmoqs.Params + var pUsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.Runtime.ParameterIndexing.PassByArray.P == moq.ParamIndexByValue { + pUsed = params.P + } else { + pUsedHash = hash.DeepHash(params.P) + } + } + return MoqUsual_PassByArray_paramsKey{ + Params: struct{ P [3]testmoqs.Params }{ + P: pUsed, + }, + Hashes: struct{ P hash.Hash }{ + P: pUsedHash, + }, } } -func (m *MoqUsual_recorder) Nothing() *MoqUsual_Nothing_fnRecorder { - return &MoqUsual_Nothing_fnRecorder{ - Params: MoqUsual_Nothing_params{}, +func (m *MoqUsual_recorder) PassByChan(p chan testmoqs.Params) *MoqUsual_PassByChan_fnRecorder { + return &MoqUsual_PassByChan_fnRecorder{ + Params: MoqUsual_PassByChan_params{ + P: p, + }, Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, Moq: m.Moq, } } -func (r *MoqUsual_Nothing_fnRecorder) Any() *MoqUsual_Nothing_anyParams { +func (r *MoqUsual_PassByChan_fnRecorder) Any() *MoqUsual_PassByChan_anyParams { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Nothing(r.Params)) + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByChan(r.Params)) return nil } - return &MoqUsual_Nothing_anyParams{Recorder: r} + return &MoqUsual_PassByChan_anyParams{Recorder: r} } -func (r *MoqUsual_Nothing_fnRecorder) Seq() *MoqUsual_Nothing_fnRecorder { +func (a *MoqUsual_PassByChan_anyParams) P() *MoqUsual_PassByChan_fnRecorder { + a.Recorder.AnyParams |= 1 << 0 + return a.Recorder +} + +func (r *MoqUsual_PassByChan_fnRecorder) Seq() *MoqUsual_PassByChan_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Nothing(r.Params)) + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByChan(r.Params)) return nil } r.Sequence = true return r } -func (r *MoqUsual_Nothing_fnRecorder) NoSeq() *MoqUsual_Nothing_fnRecorder { +func (r *MoqUsual_PassByChan_fnRecorder) NoSeq() *MoqUsual_PassByChan_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Nothing(r.Params)) + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByChan(r.Params)) return nil } r.Sequence = false return r } -func (r *MoqUsual_Nothing_fnRecorder) ReturnResults() *MoqUsual_Nothing_fnRecorder { +func (r *MoqUsual_PassByChan_fnRecorder) ReturnResults(result1 chan testmoqs.Results) *MoqUsual_PassByChan_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -11424,18 +15564,24 @@ func (r *MoqUsual_Nothing_fnRecorder) ReturnResults() *MoqUsual_Nothing_fnRecord } r.Results.Results = append(r.Results.Results, struct { - Values *struct{} + Values *struct { + Result1 chan testmoqs.Results + } Sequence uint32 - DoFn MoqUsual_Nothing_doFn - DoReturnFn MoqUsual_Nothing_doReturnFn + DoFn MoqUsual_PassByChan_doFn + DoReturnFn MoqUsual_PassByChan_doReturnFn }{ - Values: &struct{}{}, + Values: &struct { + Result1 chan testmoqs.Results + }{ + Result1: result1, + }, Sequence: sequence, }) return r } -func (r *MoqUsual_Nothing_fnRecorder) AndDo(fn MoqUsual_Nothing_doFn) *MoqUsual_Nothing_fnRecorder { +func (r *MoqUsual_PassByChan_fnRecorder) AndDo(fn MoqUsual_PassByChan_doFn) *MoqUsual_PassByChan_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") @@ -11446,7 +15592,7 @@ func (r *MoqUsual_Nothing_fnRecorder) AndDo(fn MoqUsual_Nothing_doFn) *MoqUsual_ return r } -func (r *MoqUsual_Nothing_fnRecorder) DoReturnResults(fn MoqUsual_Nothing_doReturnFn) *MoqUsual_Nothing_fnRecorder { +func (r *MoqUsual_PassByChan_fnRecorder) DoReturnResults(fn MoqUsual_PassByChan_doReturnFn) *MoqUsual_PassByChan_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -11456,15 +15602,17 @@ func (r *MoqUsual_Nothing_fnRecorder) DoReturnResults(fn MoqUsual_Nothing_doRetu } r.Results.Results = append(r.Results.Results, struct { - Values *struct{} + Values *struct { + Result1 chan testmoqs.Results + } Sequence uint32 - DoFn MoqUsual_Nothing_doFn - DoReturnFn MoqUsual_Nothing_doReturnFn + DoFn MoqUsual_PassByChan_doFn + DoReturnFn MoqUsual_PassByChan_doReturnFn }{Sequence: sequence, DoReturnFn: fn}) return r } -func (r *MoqUsual_Nothing_fnRecorder) FindResults() { +func (r *MoqUsual_PassByChan_fnRecorder) FindResults() { r.Moq.Scene.T.Helper() if r.Results != nil { r.Results.Repeat.Increment(r.Moq.Scene.T) @@ -11473,8 +15621,8 @@ func (r *MoqUsual_Nothing_fnRecorder) FindResults() { anyCount := bits.OnesCount64(r.AnyParams) insertAt := -1 - var results *MoqUsual_Nothing_resultsByParams - for n, res := range r.Moq.ResultsByParams_Nothing { + var results *MoqUsual_PassByChan_resultsByParams + for n, res := range r.Moq.ResultsByParams_PassByChan { if res.AnyParams == r.AnyParams { results = &res break @@ -11484,24 +15632,24 @@ func (r *MoqUsual_Nothing_fnRecorder) FindResults() { } } if results == nil { - results = &MoqUsual_Nothing_resultsByParams{ + results = &MoqUsual_PassByChan_resultsByParams{ AnyCount: anyCount, AnyParams: r.AnyParams, - Results: map[MoqUsual_Nothing_paramsKey]*MoqUsual_Nothing_results{}, + Results: map[MoqUsual_PassByChan_paramsKey]*MoqUsual_PassByChan_results{}, } - r.Moq.ResultsByParams_Nothing = append(r.Moq.ResultsByParams_Nothing, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_Nothing) { - copy(r.Moq.ResultsByParams_Nothing[insertAt+1:], r.Moq.ResultsByParams_Nothing[insertAt:0]) - r.Moq.ResultsByParams_Nothing[insertAt] = *results + r.Moq.ResultsByParams_PassByChan = append(r.Moq.ResultsByParams_PassByChan, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_PassByChan) { + copy(r.Moq.ResultsByParams_PassByChan[insertAt+1:], r.Moq.ResultsByParams_PassByChan[insertAt:0]) + r.Moq.ResultsByParams_PassByChan[insertAt] = *results } } - paramsKey := r.Moq.ParamsKey_Nothing(r.Params, r.AnyParams) + paramsKey := r.Moq.ParamsKey_PassByChan(r.Params, r.AnyParams) var ok bool r.Results, ok = results.Results[paramsKey] if !ok { - r.Results = &MoqUsual_Nothing_results{ + r.Results = &MoqUsual_PassByChan_results{ Params: r.Params, Results: nil, Index: 0, @@ -11513,7 +15661,7 @@ func (r *MoqUsual_Nothing_fnRecorder) FindResults() { r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (r *MoqUsual_Nothing_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_Nothing_fnRecorder { +func (r *MoqUsual_PassByChan_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_PassByChan_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") @@ -11524,10 +15672,12 @@ func (r *MoqUsual_Nothing_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsua for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { if r.Sequence { last = struct { - Values *struct{} + Values *struct { + Result1 chan testmoqs.Results + } Sequence uint32 - DoFn MoqUsual_Nothing_doFn - DoReturnFn MoqUsual_Nothing_doReturnFn + DoFn MoqUsual_PassByChan_doFn + DoReturnFn MoqUsual_PassByChan_doReturnFn }{ Values: last.Values, Sequence: r.Moq.Scene.NextRecorderSequence(), @@ -11538,69 +15688,76 @@ func (r *MoqUsual_Nothing_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsua return r } -func (m *MoqUsual) PrettyParams_Nothing(params MoqUsual_Nothing_params) string { - return fmt.Sprintf("Nothing()") +func (m *MoqUsual) PrettyParams_PassByChan(params MoqUsual_PassByChan_params) string { + return fmt.Sprintf("PassByChan(%#v)", params.P) } -func (m *MoqUsual) ParamsKey_Nothing(params MoqUsual_Nothing_params, anyParams uint64) MoqUsual_Nothing_paramsKey { +func (m *MoqUsual) ParamsKey_PassByChan(params MoqUsual_PassByChan_params, anyParams uint64) MoqUsual_PassByChan_paramsKey { m.Scene.T.Helper() - return MoqUsual_Nothing_paramsKey{ - Params: struct{}{}, - Hashes: struct{}{}, + var pUsed chan testmoqs.Params + var pUsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.Runtime.ParameterIndexing.PassByChan.P == moq.ParamIndexByValue { + pUsed = params.P + } else { + pUsedHash = hash.DeepHash(params.P) + } + } + return MoqUsual_PassByChan_paramsKey{ + Params: struct{ P chan testmoqs.Params }{ + P: pUsed, + }, + Hashes: struct{ P hash.Hash }{ + P: pUsedHash, + }, } } -func (m *MoqUsual_recorder) Variadic(other bool, args ...string) *MoqUsual_Variadic_fnRecorder { - return &MoqUsual_Variadic_fnRecorder{ - Params: MoqUsual_Variadic_params{ - Other: other, - Args: args, +func (m *MoqUsual_recorder) PassByEllipsis(p ...testmoqs.Params) *MoqUsual_PassByEllipsis_fnRecorder { + return &MoqUsual_PassByEllipsis_fnRecorder{ + Params: MoqUsual_PassByEllipsis_params{ + P: p, }, Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, Moq: m.Moq, } } -func (r *MoqUsual_Variadic_fnRecorder) Any() *MoqUsual_Variadic_anyParams { +func (r *MoqUsual_PassByEllipsis_fnRecorder) Any() *MoqUsual_PassByEllipsis_anyParams { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Variadic(r.Params)) + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByEllipsis(r.Params)) return nil } - return &MoqUsual_Variadic_anyParams{Recorder: r} + return &MoqUsual_PassByEllipsis_anyParams{Recorder: r} } -func (a *MoqUsual_Variadic_anyParams) Other() *MoqUsual_Variadic_fnRecorder { +func (a *MoqUsual_PassByEllipsis_anyParams) P() *MoqUsual_PassByEllipsis_fnRecorder { a.Recorder.AnyParams |= 1 << 0 return a.Recorder } -func (a *MoqUsual_Variadic_anyParams) Args() *MoqUsual_Variadic_fnRecorder { - a.Recorder.AnyParams |= 1 << 1 - return a.Recorder -} - -func (r *MoqUsual_Variadic_fnRecorder) Seq() *MoqUsual_Variadic_fnRecorder { +func (r *MoqUsual_PassByEllipsis_fnRecorder) Seq() *MoqUsual_PassByEllipsis_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Variadic(r.Params)) + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByEllipsis(r.Params)) return nil } r.Sequence = true return r } -func (r *MoqUsual_Variadic_fnRecorder) NoSeq() *MoqUsual_Variadic_fnRecorder { +func (r *MoqUsual_PassByEllipsis_fnRecorder) NoSeq() *MoqUsual_PassByEllipsis_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Variadic(r.Params)) + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByEllipsis(r.Params)) return nil } r.Sequence = false return r } -func (r *MoqUsual_Variadic_fnRecorder) ReturnResults(sResult string, err error) *MoqUsual_Variadic_fnRecorder { +func (r *MoqUsual_PassByEllipsis_fnRecorder) ReturnResults(result1 string, result2 error) *MoqUsual_PassByEllipsis_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -11611,26 +15768,26 @@ func (r *MoqUsual_Variadic_fnRecorder) ReturnResults(sResult string, err error) r.Results.Results = append(r.Results.Results, struct { Values *struct { - SResult string - Err error + Result1 string + Result2 error } Sequence uint32 - DoFn MoqUsual_Variadic_doFn - DoReturnFn MoqUsual_Variadic_doReturnFn + DoFn MoqUsual_PassByEllipsis_doFn + DoReturnFn MoqUsual_PassByEllipsis_doReturnFn }{ Values: &struct { - SResult string - Err error + Result1 string + Result2 error }{ - SResult: sResult, - Err: err, + Result1: result1, + Result2: result2, }, Sequence: sequence, }) return r } -func (r *MoqUsual_Variadic_fnRecorder) AndDo(fn MoqUsual_Variadic_doFn) *MoqUsual_Variadic_fnRecorder { +func (r *MoqUsual_PassByEllipsis_fnRecorder) AndDo(fn MoqUsual_PassByEllipsis_doFn) *MoqUsual_PassByEllipsis_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") @@ -11641,7 +15798,7 @@ func (r *MoqUsual_Variadic_fnRecorder) AndDo(fn MoqUsual_Variadic_doFn) *MoqUsua return r } -func (r *MoqUsual_Variadic_fnRecorder) DoReturnResults(fn MoqUsual_Variadic_doReturnFn) *MoqUsual_Variadic_fnRecorder { +func (r *MoqUsual_PassByEllipsis_fnRecorder) DoReturnResults(fn MoqUsual_PassByEllipsis_doReturnFn) *MoqUsual_PassByEllipsis_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -11652,17 +15809,17 @@ func (r *MoqUsual_Variadic_fnRecorder) DoReturnResults(fn MoqUsual_Variadic_doRe r.Results.Results = append(r.Results.Results, struct { Values *struct { - SResult string - Err error + Result1 string + Result2 error } Sequence uint32 - DoFn MoqUsual_Variadic_doFn - DoReturnFn MoqUsual_Variadic_doReturnFn + DoFn MoqUsual_PassByEllipsis_doFn + DoReturnFn MoqUsual_PassByEllipsis_doReturnFn }{Sequence: sequence, DoReturnFn: fn}) return r } -func (r *MoqUsual_Variadic_fnRecorder) FindResults() { +func (r *MoqUsual_PassByEllipsis_fnRecorder) FindResults() { r.Moq.Scene.T.Helper() if r.Results != nil { r.Results.Repeat.Increment(r.Moq.Scene.T) @@ -11671,8 +15828,8 @@ func (r *MoqUsual_Variadic_fnRecorder) FindResults() { anyCount := bits.OnesCount64(r.AnyParams) insertAt := -1 - var results *MoqUsual_Variadic_resultsByParams - for n, res := range r.Moq.ResultsByParams_Variadic { + var results *MoqUsual_PassByEllipsis_resultsByParams + for n, res := range r.Moq.ResultsByParams_PassByEllipsis { if res.AnyParams == r.AnyParams { results = &res break @@ -11682,24 +15839,24 @@ func (r *MoqUsual_Variadic_fnRecorder) FindResults() { } } if results == nil { - results = &MoqUsual_Variadic_resultsByParams{ + results = &MoqUsual_PassByEllipsis_resultsByParams{ AnyCount: anyCount, AnyParams: r.AnyParams, - Results: map[MoqUsual_Variadic_paramsKey]*MoqUsual_Variadic_results{}, + Results: map[MoqUsual_PassByEllipsis_paramsKey]*MoqUsual_PassByEllipsis_results{}, } - r.Moq.ResultsByParams_Variadic = append(r.Moq.ResultsByParams_Variadic, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_Variadic) { - copy(r.Moq.ResultsByParams_Variadic[insertAt+1:], r.Moq.ResultsByParams_Variadic[insertAt:0]) - r.Moq.ResultsByParams_Variadic[insertAt] = *results + r.Moq.ResultsByParams_PassByEllipsis = append(r.Moq.ResultsByParams_PassByEllipsis, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_PassByEllipsis) { + copy(r.Moq.ResultsByParams_PassByEllipsis[insertAt+1:], r.Moq.ResultsByParams_PassByEllipsis[insertAt:0]) + r.Moq.ResultsByParams_PassByEllipsis[insertAt] = *results } } - paramsKey := r.Moq.ParamsKey_Variadic(r.Params, r.AnyParams) + paramsKey := r.Moq.ParamsKey_PassByEllipsis(r.Params, r.AnyParams) var ok bool r.Results, ok = results.Results[paramsKey] if !ok { - r.Results = &MoqUsual_Variadic_results{ + r.Results = &MoqUsual_PassByEllipsis_results{ Params: r.Params, Results: nil, Index: 0, @@ -11711,7 +15868,7 @@ func (r *MoqUsual_Variadic_fnRecorder) FindResults() { r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (r *MoqUsual_Variadic_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_Variadic_fnRecorder { +func (r *MoqUsual_PassByEllipsis_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_PassByEllipsis_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") @@ -11723,12 +15880,12 @@ func (r *MoqUsual_Variadic_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsu if r.Sequence { last = struct { Values *struct { - SResult string - Err error + Result1 string + Result2 error } Sequence uint32 - DoFn MoqUsual_Variadic_doFn - DoReturnFn MoqUsual_Variadic_doReturnFn + DoFn MoqUsual_PassByEllipsis_doFn + DoReturnFn MoqUsual_PassByEllipsis_doReturnFn }{ Values: last.Values, Sequence: r.Moq.Scene.NextRecorderSequence(), @@ -11739,99 +15896,72 @@ func (r *MoqUsual_Variadic_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsu return r } -func (m *MoqUsual) PrettyParams_Variadic(params MoqUsual_Variadic_params) string { - return fmt.Sprintf("Variadic(%#v, %#v)", params.Other, params.Args) +func (m *MoqUsual) PrettyParams_PassByEllipsis(params MoqUsual_PassByEllipsis_params) string { + return fmt.Sprintf("PassByEllipsis(%#v)", params.P) } -func (m *MoqUsual) ParamsKey_Variadic(params MoqUsual_Variadic_params, anyParams uint64) MoqUsual_Variadic_paramsKey { +func (m *MoqUsual) ParamsKey_PassByEllipsis(params MoqUsual_PassByEllipsis_params, anyParams uint64) MoqUsual_PassByEllipsis_paramsKey { m.Scene.T.Helper() - var otherUsed bool - var otherUsedHash hash.Hash + var pUsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.Runtime.ParameterIndexing.Variadic.Other == moq.ParamIndexByValue { - otherUsed = params.Other - } else { - otherUsedHash = hash.DeepHash(params.Other) - } - } - var argsUsedHash hash.Hash - if anyParams&(1<<1) == 0 { - if m.Runtime.ParameterIndexing.Variadic.Args == moq.ParamIndexByValue { - m.Scene.T.Fatalf("The args parameter of the Variadic function can't be indexed by value") + if m.Runtime.ParameterIndexing.PassByEllipsis.P == moq.ParamIndexByValue { + m.Scene.T.Fatalf("The p parameter of the PassByEllipsis function can't be indexed by value") } - argsUsedHash = hash.DeepHash(params.Args) + pUsedHash = hash.DeepHash(params.P) } - return MoqUsual_Variadic_paramsKey{ - Params: struct{ Other bool }{ - Other: otherUsed, - }, - Hashes: struct { - Other hash.Hash - Args hash.Hash - }{ - Other: otherUsedHash, - Args: argsUsedHash, + return MoqUsual_PassByEllipsis_paramsKey{ + Params: struct{}{}, + Hashes: struct{ P hash.Hash }{ + P: pUsedHash, }, } } -func (m *MoqUsual_recorder) RepeatedIds(sParam1, sParam2 string, bParam bool) *MoqUsual_RepeatedIds_fnRecorder { - return &MoqUsual_RepeatedIds_fnRecorder{ - Params: MoqUsual_RepeatedIds_params{ - SParam1: sParam1, - SParam2: sParam2, - BParam: bParam, +func (m *MoqUsual_recorder) PassByMap(p map[string]testmoqs.Params) *MoqUsual_PassByMap_fnRecorder { + return &MoqUsual_PassByMap_fnRecorder{ + Params: MoqUsual_PassByMap_params{ + P: p, }, Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, Moq: m.Moq, } } -func (r *MoqUsual_RepeatedIds_fnRecorder) Any() *MoqUsual_RepeatedIds_anyParams { +func (r *MoqUsual_PassByMap_fnRecorder) Any() *MoqUsual_PassByMap_anyParams { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_RepeatedIds(r.Params)) - return nil - } - return &MoqUsual_RepeatedIds_anyParams{Recorder: r} -} - -func (a *MoqUsual_RepeatedIds_anyParams) SParam1() *MoqUsual_RepeatedIds_fnRecorder { - a.Recorder.AnyParams |= 1 << 0 - return a.Recorder -} - -func (a *MoqUsual_RepeatedIds_anyParams) SParam2() *MoqUsual_RepeatedIds_fnRecorder { - a.Recorder.AnyParams |= 1 << 1 - return a.Recorder + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByMap(r.Params)) + return nil + } + return &MoqUsual_PassByMap_anyParams{Recorder: r} } -func (a *MoqUsual_RepeatedIds_anyParams) BParam() *MoqUsual_RepeatedIds_fnRecorder { - a.Recorder.AnyParams |= 1 << 2 +func (a *MoqUsual_PassByMap_anyParams) P() *MoqUsual_PassByMap_fnRecorder { + a.Recorder.AnyParams |= 1 << 0 return a.Recorder } -func (r *MoqUsual_RepeatedIds_fnRecorder) Seq() *MoqUsual_RepeatedIds_fnRecorder { +func (r *MoqUsual_PassByMap_fnRecorder) Seq() *MoqUsual_PassByMap_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_RepeatedIds(r.Params)) + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByMap(r.Params)) return nil } r.Sequence = true return r } -func (r *MoqUsual_RepeatedIds_fnRecorder) NoSeq() *MoqUsual_RepeatedIds_fnRecorder { +func (r *MoqUsual_PassByMap_fnRecorder) NoSeq() *MoqUsual_PassByMap_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_RepeatedIds(r.Params)) + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByMap(r.Params)) return nil } r.Sequence = false return r } -func (r *MoqUsual_RepeatedIds_fnRecorder) ReturnResults(sResult1, sResult2 string, err error) *MoqUsual_RepeatedIds_fnRecorder { +func (r *MoqUsual_PassByMap_fnRecorder) ReturnResults(result1 map[string]testmoqs.Results) *MoqUsual_PassByMap_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -11842,27 +15972,23 @@ func (r *MoqUsual_RepeatedIds_fnRecorder) ReturnResults(sResult1, sResult2 strin r.Results.Results = append(r.Results.Results, struct { Values *struct { - SResult1, SResult2 string - Err error + Result1 map[string]testmoqs.Results } Sequence uint32 - DoFn MoqUsual_RepeatedIds_doFn - DoReturnFn MoqUsual_RepeatedIds_doReturnFn + DoFn MoqUsual_PassByMap_doFn + DoReturnFn MoqUsual_PassByMap_doReturnFn }{ Values: &struct { - SResult1, SResult2 string - Err error + Result1 map[string]testmoqs.Results }{ - SResult1: sResult1, - SResult2: sResult2, - Err: err, + Result1: result1, }, Sequence: sequence, }) return r } -func (r *MoqUsual_RepeatedIds_fnRecorder) AndDo(fn MoqUsual_RepeatedIds_doFn) *MoqUsual_RepeatedIds_fnRecorder { +func (r *MoqUsual_PassByMap_fnRecorder) AndDo(fn MoqUsual_PassByMap_doFn) *MoqUsual_PassByMap_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") @@ -11873,7 +15999,7 @@ func (r *MoqUsual_RepeatedIds_fnRecorder) AndDo(fn MoqUsual_RepeatedIds_doFn) *M return r } -func (r *MoqUsual_RepeatedIds_fnRecorder) DoReturnResults(fn MoqUsual_RepeatedIds_doReturnFn) *MoqUsual_RepeatedIds_fnRecorder { +func (r *MoqUsual_PassByMap_fnRecorder) DoReturnResults(fn MoqUsual_PassByMap_doReturnFn) *MoqUsual_PassByMap_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -11884,17 +16010,16 @@ func (r *MoqUsual_RepeatedIds_fnRecorder) DoReturnResults(fn MoqUsual_RepeatedId r.Results.Results = append(r.Results.Results, struct { Values *struct { - SResult1, SResult2 string - Err error + Result1 map[string]testmoqs.Results } Sequence uint32 - DoFn MoqUsual_RepeatedIds_doFn - DoReturnFn MoqUsual_RepeatedIds_doReturnFn + DoFn MoqUsual_PassByMap_doFn + DoReturnFn MoqUsual_PassByMap_doReturnFn }{Sequence: sequence, DoReturnFn: fn}) return r } -func (r *MoqUsual_RepeatedIds_fnRecorder) FindResults() { +func (r *MoqUsual_PassByMap_fnRecorder) FindResults() { r.Moq.Scene.T.Helper() if r.Results != nil { r.Results.Repeat.Increment(r.Moq.Scene.T) @@ -11903,8 +16028,8 @@ func (r *MoqUsual_RepeatedIds_fnRecorder) FindResults() { anyCount := bits.OnesCount64(r.AnyParams) insertAt := -1 - var results *MoqUsual_RepeatedIds_resultsByParams - for n, res := range r.Moq.ResultsByParams_RepeatedIds { + var results *MoqUsual_PassByMap_resultsByParams + for n, res := range r.Moq.ResultsByParams_PassByMap { if res.AnyParams == r.AnyParams { results = &res break @@ -11914,24 +16039,24 @@ func (r *MoqUsual_RepeatedIds_fnRecorder) FindResults() { } } if results == nil { - results = &MoqUsual_RepeatedIds_resultsByParams{ + results = &MoqUsual_PassByMap_resultsByParams{ AnyCount: anyCount, AnyParams: r.AnyParams, - Results: map[MoqUsual_RepeatedIds_paramsKey]*MoqUsual_RepeatedIds_results{}, + Results: map[MoqUsual_PassByMap_paramsKey]*MoqUsual_PassByMap_results{}, } - r.Moq.ResultsByParams_RepeatedIds = append(r.Moq.ResultsByParams_RepeatedIds, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_RepeatedIds) { - copy(r.Moq.ResultsByParams_RepeatedIds[insertAt+1:], r.Moq.ResultsByParams_RepeatedIds[insertAt:0]) - r.Moq.ResultsByParams_RepeatedIds[insertAt] = *results + r.Moq.ResultsByParams_PassByMap = append(r.Moq.ResultsByParams_PassByMap, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_PassByMap) { + copy(r.Moq.ResultsByParams_PassByMap[insertAt+1:], r.Moq.ResultsByParams_PassByMap[insertAt:0]) + r.Moq.ResultsByParams_PassByMap[insertAt] = *results } } - paramsKey := r.Moq.ParamsKey_RepeatedIds(r.Params, r.AnyParams) + paramsKey := r.Moq.ParamsKey_PassByMap(r.Params, r.AnyParams) var ok bool r.Results, ok = results.Results[paramsKey] if !ok { - r.Results = &MoqUsual_RepeatedIds_results{ + r.Results = &MoqUsual_PassByMap_results{ Params: r.Params, Results: nil, Index: 0, @@ -11943,7 +16068,7 @@ func (r *MoqUsual_RepeatedIds_fnRecorder) FindResults() { r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (r *MoqUsual_RepeatedIds_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_RepeatedIds_fnRecorder { +func (r *MoqUsual_PassByMap_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_PassByMap_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") @@ -11955,12 +16080,11 @@ func (r *MoqUsual_RepeatedIds_fnRecorder) Repeat(repeaters ...moq.Repeater) *Moq if r.Sequence { last = struct { Values *struct { - SResult1, SResult2 string - Err error + Result1 map[string]testmoqs.Results } Sequence uint32 - DoFn MoqUsual_RepeatedIds_doFn - DoReturnFn MoqUsual_RepeatedIds_doReturnFn + DoFn MoqUsual_PassByMap_doFn + DoReturnFn MoqUsual_PassByMap_doReturnFn }{ Values: last.Values, Sequence: r.Moq.Scene.NextRecorderSequence(), @@ -11971,110 +16095,72 @@ func (r *MoqUsual_RepeatedIds_fnRecorder) Repeat(repeaters ...moq.Repeater) *Moq return r } -func (m *MoqUsual) PrettyParams_RepeatedIds(params MoqUsual_RepeatedIds_params) string { - return fmt.Sprintf("RepeatedIds(%#v, %#v, %#v)", params.SParam1, params.SParam2, params.BParam) +func (m *MoqUsual) PrettyParams_PassByMap(params MoqUsual_PassByMap_params) string { + return fmt.Sprintf("PassByMap(%#v)", params.P) } -func (m *MoqUsual) ParamsKey_RepeatedIds(params MoqUsual_RepeatedIds_params, anyParams uint64) MoqUsual_RepeatedIds_paramsKey { +func (m *MoqUsual) ParamsKey_PassByMap(params MoqUsual_PassByMap_params, anyParams uint64) MoqUsual_PassByMap_paramsKey { m.Scene.T.Helper() - var sParam1Used string - var sParam1UsedHash hash.Hash + var pUsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.Runtime.ParameterIndexing.RepeatedIds.SParam1 == moq.ParamIndexByValue { - sParam1Used = params.SParam1 - } else { - sParam1UsedHash = hash.DeepHash(params.SParam1) - } - } - var sParam2Used string - var sParam2UsedHash hash.Hash - if anyParams&(1<<1) == 0 { - if m.Runtime.ParameterIndexing.RepeatedIds.SParam2 == moq.ParamIndexByValue { - sParam2Used = params.SParam2 - } else { - sParam2UsedHash = hash.DeepHash(params.SParam2) - } - } - var bParamUsed bool - var bParamUsedHash hash.Hash - if anyParams&(1<<2) == 0 { - if m.Runtime.ParameterIndexing.RepeatedIds.BParam == moq.ParamIndexByValue { - bParamUsed = params.BParam - } else { - bParamUsedHash = hash.DeepHash(params.BParam) + if m.Runtime.ParameterIndexing.PassByMap.P == moq.ParamIndexByValue { + m.Scene.T.Fatalf("The p parameter of the PassByMap function can't be indexed by value") } + pUsedHash = hash.DeepHash(params.P) } - return MoqUsual_RepeatedIds_paramsKey{ - Params: struct { - SParam1, SParam2 string - BParam bool - }{ - SParam1: sParam1Used, - SParam2: sParam2Used, - BParam: bParamUsed, - }, - Hashes: struct { - SParam1, SParam2 hash.Hash - BParam hash.Hash - }{ - SParam1: sParam1UsedHash, - SParam2: sParam2UsedHash, - BParam: bParamUsedHash, + return MoqUsual_PassByMap_paramsKey{ + Params: struct{}{}, + Hashes: struct{ P hash.Hash }{ + P: pUsedHash, }, } } -func (m *MoqUsual_recorder) Times(sParam string, times bool) *MoqUsual_Times_fnRecorder { - return &MoqUsual_Times_fnRecorder{ - Params: MoqUsual_Times_params{ - SParam: sParam, - Times: times, +func (m *MoqUsual_recorder) PassByReference(p *testmoqs.Params) *MoqUsual_PassByReference_fnRecorder { + return &MoqUsual_PassByReference_fnRecorder{ + Params: MoqUsual_PassByReference_params{ + P: p, }, Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, Moq: m.Moq, } } -func (r *MoqUsual_Times_fnRecorder) Any() *MoqUsual_Times_anyParams { +func (r *MoqUsual_PassByReference_fnRecorder) Any() *MoqUsual_PassByReference_anyParams { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Times(r.Params)) + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByReference(r.Params)) return nil } - return &MoqUsual_Times_anyParams{Recorder: r} + return &MoqUsual_PassByReference_anyParams{Recorder: r} } -func (a *MoqUsual_Times_anyParams) SParam() *MoqUsual_Times_fnRecorder { +func (a *MoqUsual_PassByReference_anyParams) P() *MoqUsual_PassByReference_fnRecorder { a.Recorder.AnyParams |= 1 << 0 return a.Recorder } -func (a *MoqUsual_Times_anyParams) Times() *MoqUsual_Times_fnRecorder { - a.Recorder.AnyParams |= 1 << 1 - return a.Recorder -} - -func (r *MoqUsual_Times_fnRecorder) Seq() *MoqUsual_Times_fnRecorder { +func (r *MoqUsual_PassByReference_fnRecorder) Seq() *MoqUsual_PassByReference_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Times(r.Params)) + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByReference(r.Params)) return nil } r.Sequence = true return r } -func (r *MoqUsual_Times_fnRecorder) NoSeq() *MoqUsual_Times_fnRecorder { +func (r *MoqUsual_PassByReference_fnRecorder) NoSeq() *MoqUsual_PassByReference_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Times(r.Params)) + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByReference(r.Params)) return nil } r.Sequence = false return r } -func (r *MoqUsual_Times_fnRecorder) ReturnResults(sResult string, err error) *MoqUsual_Times_fnRecorder { +func (r *MoqUsual_PassByReference_fnRecorder) ReturnResults(result1 *testmoqs.Results) *MoqUsual_PassByReference_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -12085,26 +16171,23 @@ func (r *MoqUsual_Times_fnRecorder) ReturnResults(sResult string, err error) *Mo r.Results.Results = append(r.Results.Results, struct { Values *struct { - SResult string - Err error + Result1 *testmoqs.Results } Sequence uint32 - DoFn MoqUsual_Times_doFn - DoReturnFn MoqUsual_Times_doReturnFn + DoFn MoqUsual_PassByReference_doFn + DoReturnFn MoqUsual_PassByReference_doReturnFn }{ Values: &struct { - SResult string - Err error + Result1 *testmoqs.Results }{ - SResult: sResult, - Err: err, + Result1: result1, }, Sequence: sequence, }) return r } -func (r *MoqUsual_Times_fnRecorder) AndDo(fn MoqUsual_Times_doFn) *MoqUsual_Times_fnRecorder { +func (r *MoqUsual_PassByReference_fnRecorder) AndDo(fn MoqUsual_PassByReference_doFn) *MoqUsual_PassByReference_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") @@ -12115,7 +16198,7 @@ func (r *MoqUsual_Times_fnRecorder) AndDo(fn MoqUsual_Times_doFn) *MoqUsual_Time return r } -func (r *MoqUsual_Times_fnRecorder) DoReturnResults(fn MoqUsual_Times_doReturnFn) *MoqUsual_Times_fnRecorder { +func (r *MoqUsual_PassByReference_fnRecorder) DoReturnResults(fn MoqUsual_PassByReference_doReturnFn) *MoqUsual_PassByReference_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -12126,17 +16209,16 @@ func (r *MoqUsual_Times_fnRecorder) DoReturnResults(fn MoqUsual_Times_doReturnFn r.Results.Results = append(r.Results.Results, struct { Values *struct { - SResult string - Err error + Result1 *testmoqs.Results } Sequence uint32 - DoFn MoqUsual_Times_doFn - DoReturnFn MoqUsual_Times_doReturnFn + DoFn MoqUsual_PassByReference_doFn + DoReturnFn MoqUsual_PassByReference_doReturnFn }{Sequence: sequence, DoReturnFn: fn}) return r } -func (r *MoqUsual_Times_fnRecorder) FindResults() { +func (r *MoqUsual_PassByReference_fnRecorder) FindResults() { r.Moq.Scene.T.Helper() if r.Results != nil { r.Results.Repeat.Increment(r.Moq.Scene.T) @@ -12145,8 +16227,8 @@ func (r *MoqUsual_Times_fnRecorder) FindResults() { anyCount := bits.OnesCount64(r.AnyParams) insertAt := -1 - var results *MoqUsual_Times_resultsByParams - for n, res := range r.Moq.ResultsByParams_Times { + var results *MoqUsual_PassByReference_resultsByParams + for n, res := range r.Moq.ResultsByParams_PassByReference { if res.AnyParams == r.AnyParams { results = &res break @@ -12156,24 +16238,24 @@ func (r *MoqUsual_Times_fnRecorder) FindResults() { } } if results == nil { - results = &MoqUsual_Times_resultsByParams{ + results = &MoqUsual_PassByReference_resultsByParams{ AnyCount: anyCount, AnyParams: r.AnyParams, - Results: map[MoqUsual_Times_paramsKey]*MoqUsual_Times_results{}, + Results: map[MoqUsual_PassByReference_paramsKey]*MoqUsual_PassByReference_results{}, } - r.Moq.ResultsByParams_Times = append(r.Moq.ResultsByParams_Times, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_Times) { - copy(r.Moq.ResultsByParams_Times[insertAt+1:], r.Moq.ResultsByParams_Times[insertAt:0]) - r.Moq.ResultsByParams_Times[insertAt] = *results + r.Moq.ResultsByParams_PassByReference = append(r.Moq.ResultsByParams_PassByReference, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_PassByReference) { + copy(r.Moq.ResultsByParams_PassByReference[insertAt+1:], r.Moq.ResultsByParams_PassByReference[insertAt:0]) + r.Moq.ResultsByParams_PassByReference[insertAt] = *results } } - paramsKey := r.Moq.ParamsKey_Times(r.Params, r.AnyParams) + paramsKey := r.Moq.ParamsKey_PassByReference(r.Params, r.AnyParams) var ok bool r.Results, ok = results.Results[paramsKey] if !ok { - r.Results = &MoqUsual_Times_results{ + r.Results = &MoqUsual_PassByReference_results{ Params: r.Params, Results: nil, Index: 0, @@ -12185,7 +16267,7 @@ func (r *MoqUsual_Times_fnRecorder) FindResults() { r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (r *MoqUsual_Times_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_Times_fnRecorder { +func (r *MoqUsual_PassByReference_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_PassByReference_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") @@ -12197,12 +16279,11 @@ func (r *MoqUsual_Times_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_ if r.Sequence { last = struct { Values *struct { - SResult string - Err error + Result1 *testmoqs.Results } Sequence uint32 - DoFn MoqUsual_Times_doFn - DoReturnFn MoqUsual_Times_doReturnFn + DoFn MoqUsual_PassByReference_doFn + DoReturnFn MoqUsual_PassByReference_doReturnFn }{ Values: last.Values, Sequence: r.Moq.Scene.NextRecorderSequence(), @@ -12213,141 +16294,76 @@ func (r *MoqUsual_Times_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_ return r } -func (m *MoqUsual) PrettyParams_Times(params MoqUsual_Times_params) string { - return fmt.Sprintf("Times(%#v, %#v)", params.SParam, params.Times) +func (m *MoqUsual) PrettyParams_PassByReference(params MoqUsual_PassByReference_params) string { + return fmt.Sprintf("PassByReference(%#v)", params.P) } -func (m *MoqUsual) ParamsKey_Times(params MoqUsual_Times_params, anyParams uint64) MoqUsual_Times_paramsKey { +func (m *MoqUsual) ParamsKey_PassByReference(params MoqUsual_PassByReference_params, anyParams uint64) MoqUsual_PassByReference_paramsKey { m.Scene.T.Helper() - var sParamUsed string - var sParamUsedHash hash.Hash + var pUsed *testmoqs.Params + var pUsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.Runtime.ParameterIndexing.Times.SParam == moq.ParamIndexByValue { - sParamUsed = params.SParam - } else { - sParamUsedHash = hash.DeepHash(params.SParam) - } - } - var timesUsed bool - var timesUsedHash hash.Hash - if anyParams&(1<<1) == 0 { - if m.Runtime.ParameterIndexing.Times.Times == moq.ParamIndexByValue { - timesUsed = params.Times + if m.Runtime.ParameterIndexing.PassByReference.P == moq.ParamIndexByValue { + pUsed = params.P } else { - timesUsedHash = hash.DeepHash(params.Times) + pUsedHash = hash.DeepHash(params.P) } } - return MoqUsual_Times_paramsKey{ - Params: struct { - SParam string - Times bool - }{ - SParam: sParamUsed, - Times: timesUsed, - }, - Hashes: struct { - SParam hash.Hash - Times hash.Hash - }{ - SParam: sParamUsedHash, - Times: timesUsedHash, + return MoqUsual_PassByReference_paramsKey{ + Params: struct{ P *testmoqs.Params }{ + P: pUsed, + }, + Hashes: struct{ P hash.Hash }{ + P: pUsedHash, }, } } -func (m *MoqUsual_recorder) DifficultParamNames(param1, param2 bool, param3 string, param, param5, param6 int, param7, param8, param9 float32) *MoqUsual_DifficultParamNames_fnRecorder { - return &MoqUsual_DifficultParamNames_fnRecorder{ - Params: MoqUsual_DifficultParamNames_params{ - Param1: param1, - Param2: param2, - Param3: param3, - Param: param, - Param5: param5, - Param6: param6, - Param7: param7, - Param8: param8, - Param9: param9, +func (m *MoqUsual_recorder) PassBySlice(p []testmoqs.Params) *MoqUsual_PassBySlice_fnRecorder { + return &MoqUsual_PassBySlice_fnRecorder{ + Params: MoqUsual_PassBySlice_params{ + P: p, }, Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, Moq: m.Moq, } } -func (r *MoqUsual_DifficultParamNames_fnRecorder) Any() *MoqUsual_DifficultParamNames_anyParams { +func (r *MoqUsual_PassBySlice_fnRecorder) Any() *MoqUsual_PassBySlice_anyParams { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DifficultParamNames(r.Params)) + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassBySlice(r.Params)) return nil } - return &MoqUsual_DifficultParamNames_anyParams{Recorder: r} + return &MoqUsual_PassBySlice_anyParams{Recorder: r} } -func (a *MoqUsual_DifficultParamNames_anyParams) Param1() *MoqUsual_DifficultParamNames_fnRecorder { +func (a *MoqUsual_PassBySlice_anyParams) P() *MoqUsual_PassBySlice_fnRecorder { a.Recorder.AnyParams |= 1 << 0 return a.Recorder } -func (a *MoqUsual_DifficultParamNames_anyParams) Param2() *MoqUsual_DifficultParamNames_fnRecorder { - a.Recorder.AnyParams |= 1 << 1 - return a.Recorder -} - -func (a *MoqUsual_DifficultParamNames_anyParams) Param3() *MoqUsual_DifficultParamNames_fnRecorder { - a.Recorder.AnyParams |= 1 << 2 - return a.Recorder -} - -func (a *MoqUsual_DifficultParamNames_anyParams) Param() *MoqUsual_DifficultParamNames_fnRecorder { - a.Recorder.AnyParams |= 1 << 3 - return a.Recorder -} - -func (a *MoqUsual_DifficultParamNames_anyParams) Param5() *MoqUsual_DifficultParamNames_fnRecorder { - a.Recorder.AnyParams |= 1 << 4 - return a.Recorder -} - -func (a *MoqUsual_DifficultParamNames_anyParams) Param6() *MoqUsual_DifficultParamNames_fnRecorder { - a.Recorder.AnyParams |= 1 << 5 - return a.Recorder -} - -func (a *MoqUsual_DifficultParamNames_anyParams) Param7() *MoqUsual_DifficultParamNames_fnRecorder { - a.Recorder.AnyParams |= 1 << 6 - return a.Recorder -} - -func (a *MoqUsual_DifficultParamNames_anyParams) Param8() *MoqUsual_DifficultParamNames_fnRecorder { - a.Recorder.AnyParams |= 1 << 7 - return a.Recorder -} - -func (a *MoqUsual_DifficultParamNames_anyParams) Param9() *MoqUsual_DifficultParamNames_fnRecorder { - a.Recorder.AnyParams |= 1 << 8 - return a.Recorder -} - -func (r *MoqUsual_DifficultParamNames_fnRecorder) Seq() *MoqUsual_DifficultParamNames_fnRecorder { +func (r *MoqUsual_PassBySlice_fnRecorder) Seq() *MoqUsual_PassBySlice_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DifficultParamNames(r.Params)) + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassBySlice(r.Params)) return nil } r.Sequence = true return r } -func (r *MoqUsual_DifficultParamNames_fnRecorder) NoSeq() *MoqUsual_DifficultParamNames_fnRecorder { +func (r *MoqUsual_PassBySlice_fnRecorder) NoSeq() *MoqUsual_PassBySlice_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DifficultParamNames(r.Params)) + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassBySlice(r.Params)) return nil } r.Sequence = false return r } -func (r *MoqUsual_DifficultParamNames_fnRecorder) ReturnResults() *MoqUsual_DifficultParamNames_fnRecorder { +func (r *MoqUsual_PassBySlice_fnRecorder) ReturnResults(result1 []testmoqs.Results) *MoqUsual_PassBySlice_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -12357,18 +16373,24 @@ func (r *MoqUsual_DifficultParamNames_fnRecorder) ReturnResults() *MoqUsual_Diff } r.Results.Results = append(r.Results.Results, struct { - Values *struct{} + Values *struct { + Result1 []testmoqs.Results + } Sequence uint32 - DoFn MoqUsual_DifficultParamNames_doFn - DoReturnFn MoqUsual_DifficultParamNames_doReturnFn + DoFn MoqUsual_PassBySlice_doFn + DoReturnFn MoqUsual_PassBySlice_doReturnFn }{ - Values: &struct{}{}, + Values: &struct { + Result1 []testmoqs.Results + }{ + Result1: result1, + }, Sequence: sequence, }) return r } -func (r *MoqUsual_DifficultParamNames_fnRecorder) AndDo(fn MoqUsual_DifficultParamNames_doFn) *MoqUsual_DifficultParamNames_fnRecorder { +func (r *MoqUsual_PassBySlice_fnRecorder) AndDo(fn MoqUsual_PassBySlice_doFn) *MoqUsual_PassBySlice_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") @@ -12379,7 +16401,7 @@ func (r *MoqUsual_DifficultParamNames_fnRecorder) AndDo(fn MoqUsual_DifficultPar return r } -func (r *MoqUsual_DifficultParamNames_fnRecorder) DoReturnResults(fn MoqUsual_DifficultParamNames_doReturnFn) *MoqUsual_DifficultParamNames_fnRecorder { +func (r *MoqUsual_PassBySlice_fnRecorder) DoReturnResults(fn MoqUsual_PassBySlice_doReturnFn) *MoqUsual_PassBySlice_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -12389,15 +16411,17 @@ func (r *MoqUsual_DifficultParamNames_fnRecorder) DoReturnResults(fn MoqUsual_Di } r.Results.Results = append(r.Results.Results, struct { - Values *struct{} + Values *struct { + Result1 []testmoqs.Results + } Sequence uint32 - DoFn MoqUsual_DifficultParamNames_doFn - DoReturnFn MoqUsual_DifficultParamNames_doReturnFn + DoFn MoqUsual_PassBySlice_doFn + DoReturnFn MoqUsual_PassBySlice_doReturnFn }{Sequence: sequence, DoReturnFn: fn}) return r } -func (r *MoqUsual_DifficultParamNames_fnRecorder) FindResults() { +func (r *MoqUsual_PassBySlice_fnRecorder) FindResults() { r.Moq.Scene.T.Helper() if r.Results != nil { r.Results.Repeat.Increment(r.Moq.Scene.T) @@ -12406,8 +16430,8 @@ func (r *MoqUsual_DifficultParamNames_fnRecorder) FindResults() { anyCount := bits.OnesCount64(r.AnyParams) insertAt := -1 - var results *MoqUsual_DifficultParamNames_resultsByParams - for n, res := range r.Moq.ResultsByParams_DifficultParamNames { + var results *MoqUsual_PassBySlice_resultsByParams + for n, res := range r.Moq.ResultsByParams_PassBySlice { if res.AnyParams == r.AnyParams { results = &res break @@ -12417,24 +16441,24 @@ func (r *MoqUsual_DifficultParamNames_fnRecorder) FindResults() { } } if results == nil { - results = &MoqUsual_DifficultParamNames_resultsByParams{ + results = &MoqUsual_PassBySlice_resultsByParams{ AnyCount: anyCount, AnyParams: r.AnyParams, - Results: map[MoqUsual_DifficultParamNames_paramsKey]*MoqUsual_DifficultParamNames_results{}, + Results: map[MoqUsual_PassBySlice_paramsKey]*MoqUsual_PassBySlice_results{}, } - r.Moq.ResultsByParams_DifficultParamNames = append(r.Moq.ResultsByParams_DifficultParamNames, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_DifficultParamNames) { - copy(r.Moq.ResultsByParams_DifficultParamNames[insertAt+1:], r.Moq.ResultsByParams_DifficultParamNames[insertAt:0]) - r.Moq.ResultsByParams_DifficultParamNames[insertAt] = *results + r.Moq.ResultsByParams_PassBySlice = append(r.Moq.ResultsByParams_PassBySlice, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_PassBySlice) { + copy(r.Moq.ResultsByParams_PassBySlice[insertAt+1:], r.Moq.ResultsByParams_PassBySlice[insertAt:0]) + r.Moq.ResultsByParams_PassBySlice[insertAt] = *results } } - paramsKey := r.Moq.ParamsKey_DifficultParamNames(r.Params, r.AnyParams) + paramsKey := r.Moq.ParamsKey_PassBySlice(r.Params, r.AnyParams) var ok bool r.Results, ok = results.Results[paramsKey] if !ok { - r.Results = &MoqUsual_DifficultParamNames_results{ + r.Results = &MoqUsual_PassBySlice_results{ Params: r.Params, Results: nil, Index: 0, @@ -12446,7 +16470,7 @@ func (r *MoqUsual_DifficultParamNames_fnRecorder) FindResults() { r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (r *MoqUsual_DifficultParamNames_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_DifficultParamNames_fnRecorder { +func (r *MoqUsual_PassBySlice_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_PassBySlice_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") @@ -12457,10 +16481,12 @@ func (r *MoqUsual_DifficultParamNames_fnRecorder) Repeat(repeaters ...moq.Repeat for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { if r.Sequence { last = struct { - Values *struct{} + Values *struct { + Result1 []testmoqs.Results + } Sequence uint32 - DoFn MoqUsual_DifficultParamNames_doFn - DoReturnFn MoqUsual_DifficultParamNames_doReturnFn + DoFn MoqUsual_PassBySlice_doFn + DoReturnFn MoqUsual_PassBySlice_doReturnFn }{ Values: last.Values, Sequence: r.Moq.Scene.NextRecorderSequence(), @@ -12471,167 +16497,72 @@ func (r *MoqUsual_DifficultParamNames_fnRecorder) Repeat(repeaters ...moq.Repeat return r } -func (m *MoqUsual) PrettyParams_DifficultParamNames(params MoqUsual_DifficultParamNames_params) string { - return fmt.Sprintf("DifficultParamNames(%#v, %#v, %#v, %#v, %#v, %#v, %#v, %#v, %#v)", params.Param1, params.Param2, params.Param3, params.Param, params.Param5, params.Param6, params.Param7, params.Param8, params.Param9) +func (m *MoqUsual) PrettyParams_PassBySlice(params MoqUsual_PassBySlice_params) string { + return fmt.Sprintf("PassBySlice(%#v)", params.P) } -func (m *MoqUsual) ParamsKey_DifficultParamNames(params MoqUsual_DifficultParamNames_params, anyParams uint64) MoqUsual_DifficultParamNames_paramsKey { +func (m *MoqUsual) ParamsKey_PassBySlice(params MoqUsual_PassBySlice_params, anyParams uint64) MoqUsual_PassBySlice_paramsKey { m.Scene.T.Helper() - var param1Used bool - var param1UsedHash hash.Hash + var pUsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.Runtime.ParameterIndexing.DifficultParamNames.Param1 == moq.ParamIndexByValue { - param1Used = params.Param1 - } else { - param1UsedHash = hash.DeepHash(params.Param1) - } - } - var param2Used bool - var param2UsedHash hash.Hash - if anyParams&(1<<1) == 0 { - if m.Runtime.ParameterIndexing.DifficultParamNames.Param2 == moq.ParamIndexByValue { - param2Used = params.Param2 - } else { - param2UsedHash = hash.DeepHash(params.Param2) - } - } - var param3Used string - var param3UsedHash hash.Hash - if anyParams&(1<<2) == 0 { - if m.Runtime.ParameterIndexing.DifficultParamNames.Param3 == moq.ParamIndexByValue { - param3Used = params.Param3 - } else { - param3UsedHash = hash.DeepHash(params.Param3) - } - } - var paramUsed int - var paramUsedHash hash.Hash - if anyParams&(1<<3) == 0 { - if m.Runtime.ParameterIndexing.DifficultParamNames.Param == moq.ParamIndexByValue { - paramUsed = params.Param - } else { - paramUsedHash = hash.DeepHash(params.Param) - } - } - var param5Used int - var param5UsedHash hash.Hash - if anyParams&(1<<4) == 0 { - if m.Runtime.ParameterIndexing.DifficultParamNames.Param5 == moq.ParamIndexByValue { - param5Used = params.Param5 - } else { - param5UsedHash = hash.DeepHash(params.Param5) - } - } - var param6Used int - var param6UsedHash hash.Hash - if anyParams&(1<<5) == 0 { - if m.Runtime.ParameterIndexing.DifficultParamNames.Param6 == moq.ParamIndexByValue { - param6Used = params.Param6 - } else { - param6UsedHash = hash.DeepHash(params.Param6) - } - } - var param7Used float32 - var param7UsedHash hash.Hash - if anyParams&(1<<6) == 0 { - if m.Runtime.ParameterIndexing.DifficultParamNames.Param7 == moq.ParamIndexByValue { - param7Used = params.Param7 - } else { - param7UsedHash = hash.DeepHash(params.Param7) - } - } - var param8Used float32 - var param8UsedHash hash.Hash - if anyParams&(1<<7) == 0 { - if m.Runtime.ParameterIndexing.DifficultParamNames.Param8 == moq.ParamIndexByValue { - param8Used = params.Param8 - } else { - param8UsedHash = hash.DeepHash(params.Param8) - } - } - var param9Used float32 - var param9UsedHash hash.Hash - if anyParams&(1<<8) == 0 { - if m.Runtime.ParameterIndexing.DifficultParamNames.Param9 == moq.ParamIndexByValue { - param9Used = params.Param9 - } else { - param9UsedHash = hash.DeepHash(params.Param9) + if m.Runtime.ParameterIndexing.PassBySlice.P == moq.ParamIndexByValue { + m.Scene.T.Fatalf("The p parameter of the PassBySlice function can't be indexed by value") } + pUsedHash = hash.DeepHash(params.P) } - return MoqUsual_DifficultParamNames_paramsKey{ - Params: struct { - Param1, Param2 bool - Param3 string - Param, Param5, Param6 int - Param7, Param8, Param9 float32 - }{ - Param1: param1Used, - Param2: param2Used, - Param3: param3Used, - Param: paramUsed, - Param5: param5Used, - Param6: param6Used, - Param7: param7Used, - Param8: param8Used, - Param9: param9Used, - }, - Hashes: struct { - Param1, Param2 hash.Hash - Param3 hash.Hash - Param, Param5, Param6 hash.Hash - Param7, Param8, Param9 hash.Hash - }{ - Param1: param1UsedHash, - Param2: param2UsedHash, - Param3: param3UsedHash, - Param: paramUsedHash, - Param5: param5UsedHash, - Param6: param6UsedHash, - Param7: param7UsedHash, - Param8: param8UsedHash, - Param9: param9UsedHash, + return MoqUsual_PassBySlice_paramsKey{ + Params: struct{}{}, + Hashes: struct{ P hash.Hash }{ + P: pUsedHash, }, } } -func (m *MoqUsual_recorder) DifficultResultNames() *MoqUsual_DifficultResultNames_fnRecorder { - return &MoqUsual_DifficultResultNames_fnRecorder{ - Params: MoqUsual_DifficultResultNames_params{}, +func (m *MoqUsual_recorder) PassByValue(p testmoqs.Params) *MoqUsual_PassByValue_fnRecorder { + return &MoqUsual_PassByValue_fnRecorder{ + Params: MoqUsual_PassByValue_params{ + P: p, + }, Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, Moq: m.Moq, } } -func (r *MoqUsual_DifficultResultNames_fnRecorder) Any() *MoqUsual_DifficultResultNames_anyParams { +func (r *MoqUsual_PassByValue_fnRecorder) Any() *MoqUsual_PassByValue_anyParams { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DifficultResultNames(r.Params)) + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByValue(r.Params)) return nil } - return &MoqUsual_DifficultResultNames_anyParams{Recorder: r} + return &MoqUsual_PassByValue_anyParams{Recorder: r} } -func (r *MoqUsual_DifficultResultNames_fnRecorder) Seq() *MoqUsual_DifficultResultNames_fnRecorder { +func (a *MoqUsual_PassByValue_anyParams) P() *MoqUsual_PassByValue_fnRecorder { + a.Recorder.AnyParams |= 1 << 0 + return a.Recorder +} + +func (r *MoqUsual_PassByValue_fnRecorder) Seq() *MoqUsual_PassByValue_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DifficultResultNames(r.Params)) + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByValue(r.Params)) return nil } r.Sequence = true return r } -func (r *MoqUsual_DifficultResultNames_fnRecorder) NoSeq() *MoqUsual_DifficultResultNames_fnRecorder { +func (r *MoqUsual_PassByValue_fnRecorder) NoSeq() *MoqUsual_PassByValue_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DifficultResultNames(r.Params)) + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByValue(r.Params)) return nil } r.Sequence = false return r } -func (r *MoqUsual_DifficultResultNames_fnRecorder) ReturnResults(result1, result2 string, result3 error, param, result5, result6 int, result7, result8, result9 float32) *MoqUsual_DifficultResultNames_fnRecorder { +func (r *MoqUsual_PassByValue_fnRecorder) ReturnResults(result1 testmoqs.Results) *MoqUsual_PassByValue_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -12642,37 +16573,23 @@ func (r *MoqUsual_DifficultResultNames_fnRecorder) ReturnResults(result1, result r.Results.Results = append(r.Results.Results, struct { Values *struct { - Result1, Result2 string - Result3 error - Param, Result5, Result6 int - Result7, Result8, Result9 float32 + Result1 testmoqs.Results } Sequence uint32 - DoFn MoqUsual_DifficultResultNames_doFn - DoReturnFn MoqUsual_DifficultResultNames_doReturnFn + DoFn MoqUsual_PassByValue_doFn + DoReturnFn MoqUsual_PassByValue_doReturnFn }{ Values: &struct { - Result1, Result2 string - Result3 error - Param, Result5, Result6 int - Result7, Result8, Result9 float32 + Result1 testmoqs.Results }{ Result1: result1, - Result2: result2, - Result3: result3, - Param: param, - Result5: result5, - Result6: result6, - Result7: result7, - Result8: result8, - Result9: result9, }, Sequence: sequence, }) return r } -func (r *MoqUsual_DifficultResultNames_fnRecorder) AndDo(fn MoqUsual_DifficultResultNames_doFn) *MoqUsual_DifficultResultNames_fnRecorder { +func (r *MoqUsual_PassByValue_fnRecorder) AndDo(fn MoqUsual_PassByValue_doFn) *MoqUsual_PassByValue_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") @@ -12683,7 +16600,7 @@ func (r *MoqUsual_DifficultResultNames_fnRecorder) AndDo(fn MoqUsual_DifficultRe return r } -func (r *MoqUsual_DifficultResultNames_fnRecorder) DoReturnResults(fn MoqUsual_DifficultResultNames_doReturnFn) *MoqUsual_DifficultResultNames_fnRecorder { +func (r *MoqUsual_PassByValue_fnRecorder) DoReturnResults(fn MoqUsual_PassByValue_doReturnFn) *MoqUsual_PassByValue_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -12694,19 +16611,16 @@ func (r *MoqUsual_DifficultResultNames_fnRecorder) DoReturnResults(fn MoqUsual_D r.Results.Results = append(r.Results.Results, struct { Values *struct { - Result1, Result2 string - Result3 error - Param, Result5, Result6 int - Result7, Result8, Result9 float32 + Result1 testmoqs.Results } Sequence uint32 - DoFn MoqUsual_DifficultResultNames_doFn - DoReturnFn MoqUsual_DifficultResultNames_doReturnFn + DoFn MoqUsual_PassByValue_doFn + DoReturnFn MoqUsual_PassByValue_doReturnFn }{Sequence: sequence, DoReturnFn: fn}) return r } -func (r *MoqUsual_DifficultResultNames_fnRecorder) FindResults() { +func (r *MoqUsual_PassByValue_fnRecorder) FindResults() { r.Moq.Scene.T.Helper() if r.Results != nil { r.Results.Repeat.Increment(r.Moq.Scene.T) @@ -12715,8 +16629,8 @@ func (r *MoqUsual_DifficultResultNames_fnRecorder) FindResults() { anyCount := bits.OnesCount64(r.AnyParams) insertAt := -1 - var results *MoqUsual_DifficultResultNames_resultsByParams - for n, res := range r.Moq.ResultsByParams_DifficultResultNames { + var results *MoqUsual_PassByValue_resultsByParams + for n, res := range r.Moq.ResultsByParams_PassByValue { if res.AnyParams == r.AnyParams { results = &res break @@ -12726,24 +16640,24 @@ func (r *MoqUsual_DifficultResultNames_fnRecorder) FindResults() { } } if results == nil { - results = &MoqUsual_DifficultResultNames_resultsByParams{ + results = &MoqUsual_PassByValue_resultsByParams{ AnyCount: anyCount, AnyParams: r.AnyParams, - Results: map[MoqUsual_DifficultResultNames_paramsKey]*MoqUsual_DifficultResultNames_results{}, + Results: map[MoqUsual_PassByValue_paramsKey]*MoqUsual_PassByValue_results{}, } - r.Moq.ResultsByParams_DifficultResultNames = append(r.Moq.ResultsByParams_DifficultResultNames, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_DifficultResultNames) { - copy(r.Moq.ResultsByParams_DifficultResultNames[insertAt+1:], r.Moq.ResultsByParams_DifficultResultNames[insertAt:0]) - r.Moq.ResultsByParams_DifficultResultNames[insertAt] = *results + r.Moq.ResultsByParams_PassByValue = append(r.Moq.ResultsByParams_PassByValue, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_PassByValue) { + copy(r.Moq.ResultsByParams_PassByValue[insertAt+1:], r.Moq.ResultsByParams_PassByValue[insertAt:0]) + r.Moq.ResultsByParams_PassByValue[insertAt] = *results } } - paramsKey := r.Moq.ParamsKey_DifficultResultNames(r.Params, r.AnyParams) + paramsKey := r.Moq.ParamsKey_PassByValue(r.Params, r.AnyParams) var ok bool r.Results, ok = results.Results[paramsKey] if !ok { - r.Results = &MoqUsual_DifficultResultNames_results{ + r.Results = &MoqUsual_PassByValue_results{ Params: r.Params, Results: nil, Index: 0, @@ -12755,7 +16669,7 @@ func (r *MoqUsual_DifficultResultNames_fnRecorder) FindResults() { r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (r *MoqUsual_DifficultResultNames_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_DifficultResultNames_fnRecorder { +func (r *MoqUsual_PassByValue_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_PassByValue_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") @@ -12767,14 +16681,11 @@ func (r *MoqUsual_DifficultResultNames_fnRecorder) Repeat(repeaters ...moq.Repea if r.Sequence { last = struct { Values *struct { - Result1, Result2 string - Result3 error - Param, Result5, Result6 int - Result7, Result8, Result9 float32 + Result1 testmoqs.Results } Sequence uint32 - DoFn MoqUsual_DifficultResultNames_doFn - DoReturnFn MoqUsual_DifficultResultNames_doReturnFn + DoFn MoqUsual_PassByValue_doFn + DoReturnFn MoqUsual_PassByValue_doReturnFn }{ Values: last.Values, Sequence: r.Moq.Scene.NextRecorderSequence(), @@ -12785,63 +16696,76 @@ func (r *MoqUsual_DifficultResultNames_fnRecorder) Repeat(repeaters ...moq.Repea return r } -func (m *MoqUsual) PrettyParams_DifficultResultNames(params MoqUsual_DifficultResultNames_params) string { - return fmt.Sprintf("DifficultResultNames()") +func (m *MoqUsual) PrettyParams_PassByValue(params MoqUsual_PassByValue_params) string { + return fmt.Sprintf("PassByValue(%#v)", params.P) } -func (m *MoqUsual) ParamsKey_DifficultResultNames(params MoqUsual_DifficultResultNames_params, anyParams uint64) MoqUsual_DifficultResultNames_paramsKey { +func (m *MoqUsual) ParamsKey_PassByValue(params MoqUsual_PassByValue_params, anyParams uint64) MoqUsual_PassByValue_paramsKey { m.Scene.T.Helper() - return MoqUsual_DifficultResultNames_paramsKey{ - Params: struct{}{}, - Hashes: struct{}{}, + var pUsed testmoqs.Params + var pUsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.Runtime.ParameterIndexing.PassByValue.P == moq.ParamIndexByValue { + pUsed = params.P + } else { + pUsedHash = hash.DeepHash(params.P) + } + } + return MoqUsual_PassByValue_paramsKey{ + Params: struct{ P testmoqs.Params }{ + P: pUsed, + }, + Hashes: struct{ P hash.Hash }{ + P: pUsedHash, + }, } } -func (m *MoqUsual_recorder) PassByArray(p [3]testmoqs.Params) *MoqUsual_PassByArray_fnRecorder { - return &MoqUsual_PassByArray_fnRecorder{ - Params: MoqUsual_PassByArray_params{ - P: p, +func (m *MoqUsual_recorder) InterfaceParam(w io.Writer) *MoqUsual_InterfaceParam_fnRecorder { + return &MoqUsual_InterfaceParam_fnRecorder{ + Params: MoqUsual_InterfaceParam_params{ + W: w, }, Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, Moq: m.Moq, } } -func (r *MoqUsual_PassByArray_fnRecorder) Any() *MoqUsual_PassByArray_anyParams { +func (r *MoqUsual_InterfaceParam_fnRecorder) Any() *MoqUsual_InterfaceParam_anyParams { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByArray(r.Params)) + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_InterfaceParam(r.Params)) return nil } - return &MoqUsual_PassByArray_anyParams{Recorder: r} + return &MoqUsual_InterfaceParam_anyParams{Recorder: r} } -func (a *MoqUsual_PassByArray_anyParams) P() *MoqUsual_PassByArray_fnRecorder { +func (a *MoqUsual_InterfaceParam_anyParams) W() *MoqUsual_InterfaceParam_fnRecorder { a.Recorder.AnyParams |= 1 << 0 return a.Recorder } -func (r *MoqUsual_PassByArray_fnRecorder) Seq() *MoqUsual_PassByArray_fnRecorder { +func (r *MoqUsual_InterfaceParam_fnRecorder) Seq() *MoqUsual_InterfaceParam_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByArray(r.Params)) + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_InterfaceParam(r.Params)) return nil } r.Sequence = true return r } -func (r *MoqUsual_PassByArray_fnRecorder) NoSeq() *MoqUsual_PassByArray_fnRecorder { +func (r *MoqUsual_InterfaceParam_fnRecorder) NoSeq() *MoqUsual_InterfaceParam_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByArray(r.Params)) + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_InterfaceParam(r.Params)) return nil } r.Sequence = false return r } -func (r *MoqUsual_PassByArray_fnRecorder) ReturnResults(result1 [3]testmoqs.Results) *MoqUsual_PassByArray_fnRecorder { +func (r *MoqUsual_InterfaceParam_fnRecorder) ReturnResults(sResult string, err error) *MoqUsual_InterfaceParam_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -12852,23 +16776,26 @@ func (r *MoqUsual_PassByArray_fnRecorder) ReturnResults(result1 [3]testmoqs.Resu r.Results.Results = append(r.Results.Results, struct { Values *struct { - Result1 [3]testmoqs.Results + SResult string + Err error } Sequence uint32 - DoFn MoqUsual_PassByArray_doFn - DoReturnFn MoqUsual_PassByArray_doReturnFn + DoFn MoqUsual_InterfaceParam_doFn + DoReturnFn MoqUsual_InterfaceParam_doReturnFn }{ Values: &struct { - Result1 [3]testmoqs.Results + SResult string + Err error }{ - Result1: result1, + SResult: sResult, + Err: err, }, Sequence: sequence, }) return r } -func (r *MoqUsual_PassByArray_fnRecorder) AndDo(fn MoqUsual_PassByArray_doFn) *MoqUsual_PassByArray_fnRecorder { +func (r *MoqUsual_InterfaceParam_fnRecorder) AndDo(fn MoqUsual_InterfaceParam_doFn) *MoqUsual_InterfaceParam_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") @@ -12879,7 +16806,7 @@ func (r *MoqUsual_PassByArray_fnRecorder) AndDo(fn MoqUsual_PassByArray_doFn) *M return r } -func (r *MoqUsual_PassByArray_fnRecorder) DoReturnResults(fn MoqUsual_PassByArray_doReturnFn) *MoqUsual_PassByArray_fnRecorder { +func (r *MoqUsual_InterfaceParam_fnRecorder) DoReturnResults(fn MoqUsual_InterfaceParam_doReturnFn) *MoqUsual_InterfaceParam_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -12890,16 +16817,17 @@ func (r *MoqUsual_PassByArray_fnRecorder) DoReturnResults(fn MoqUsual_PassByArra r.Results.Results = append(r.Results.Results, struct { Values *struct { - Result1 [3]testmoqs.Results + SResult string + Err error } Sequence uint32 - DoFn MoqUsual_PassByArray_doFn - DoReturnFn MoqUsual_PassByArray_doReturnFn + DoFn MoqUsual_InterfaceParam_doFn + DoReturnFn MoqUsual_InterfaceParam_doReturnFn }{Sequence: sequence, DoReturnFn: fn}) return r } -func (r *MoqUsual_PassByArray_fnRecorder) FindResults() { +func (r *MoqUsual_InterfaceParam_fnRecorder) FindResults() { r.Moq.Scene.T.Helper() if r.Results != nil { r.Results.Repeat.Increment(r.Moq.Scene.T) @@ -12908,8 +16836,8 @@ func (r *MoqUsual_PassByArray_fnRecorder) FindResults() { anyCount := bits.OnesCount64(r.AnyParams) insertAt := -1 - var results *MoqUsual_PassByArray_resultsByParams - for n, res := range r.Moq.ResultsByParams_PassByArray { + var results *MoqUsual_InterfaceParam_resultsByParams + for n, res := range r.Moq.ResultsByParams_InterfaceParam { if res.AnyParams == r.AnyParams { results = &res break @@ -12919,24 +16847,24 @@ func (r *MoqUsual_PassByArray_fnRecorder) FindResults() { } } if results == nil { - results = &MoqUsual_PassByArray_resultsByParams{ + results = &MoqUsual_InterfaceParam_resultsByParams{ AnyCount: anyCount, AnyParams: r.AnyParams, - Results: map[MoqUsual_PassByArray_paramsKey]*MoqUsual_PassByArray_results{}, + Results: map[MoqUsual_InterfaceParam_paramsKey]*MoqUsual_InterfaceParam_results{}, } - r.Moq.ResultsByParams_PassByArray = append(r.Moq.ResultsByParams_PassByArray, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_PassByArray) { - copy(r.Moq.ResultsByParams_PassByArray[insertAt+1:], r.Moq.ResultsByParams_PassByArray[insertAt:0]) - r.Moq.ResultsByParams_PassByArray[insertAt] = *results + r.Moq.ResultsByParams_InterfaceParam = append(r.Moq.ResultsByParams_InterfaceParam, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_InterfaceParam) { + copy(r.Moq.ResultsByParams_InterfaceParam[insertAt+1:], r.Moq.ResultsByParams_InterfaceParam[insertAt:0]) + r.Moq.ResultsByParams_InterfaceParam[insertAt] = *results } } - paramsKey := r.Moq.ParamsKey_PassByArray(r.Params, r.AnyParams) + paramsKey := r.Moq.ParamsKey_InterfaceParam(r.Params, r.AnyParams) var ok bool r.Results, ok = results.Results[paramsKey] if !ok { - r.Results = &MoqUsual_PassByArray_results{ + r.Results = &MoqUsual_InterfaceParam_results{ Params: r.Params, Results: nil, Index: 0, @@ -12948,7 +16876,7 @@ func (r *MoqUsual_PassByArray_fnRecorder) FindResults() { r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (r *MoqUsual_PassByArray_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_PassByArray_fnRecorder { +func (r *MoqUsual_InterfaceParam_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_InterfaceParam_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") @@ -12960,11 +16888,12 @@ func (r *MoqUsual_PassByArray_fnRecorder) Repeat(repeaters ...moq.Repeater) *Moq if r.Sequence { last = struct { Values *struct { - Result1 [3]testmoqs.Results + SResult string + Err error } Sequence uint32 - DoFn MoqUsual_PassByArray_doFn - DoReturnFn MoqUsual_PassByArray_doReturnFn + DoFn MoqUsual_InterfaceParam_doFn + DoReturnFn MoqUsual_InterfaceParam_doReturnFn }{ Values: last.Values, Sequence: r.Moq.Scene.NextRecorderSequence(), @@ -12975,76 +16904,82 @@ func (r *MoqUsual_PassByArray_fnRecorder) Repeat(repeaters ...moq.Repeater) *Moq return r } -func (m *MoqUsual) PrettyParams_PassByArray(params MoqUsual_PassByArray_params) string { - return fmt.Sprintf("PassByArray(%#v)", params.P) +func (m *MoqUsual) PrettyParams_InterfaceParam(params MoqUsual_InterfaceParam_params) string { + return fmt.Sprintf("InterfaceParam(%#v)", params.W) } -func (m *MoqUsual) ParamsKey_PassByArray(params MoqUsual_PassByArray_params, anyParams uint64) MoqUsual_PassByArray_paramsKey { +func (m *MoqUsual) ParamsKey_InterfaceParam(params MoqUsual_InterfaceParam_params, anyParams uint64) MoqUsual_InterfaceParam_paramsKey { m.Scene.T.Helper() - var pUsed [3]testmoqs.Params - var pUsedHash hash.Hash + var wUsed io.Writer + var wUsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.Runtime.ParameterIndexing.PassByArray.P == moq.ParamIndexByValue { - pUsed = params.P + if m.Runtime.ParameterIndexing.InterfaceParam.W == moq.ParamIndexByValue { + wUsed = params.W } else { - pUsedHash = hash.DeepHash(params.P) + wUsedHash = hash.DeepHash(params.W) } } - return MoqUsual_PassByArray_paramsKey{ - Params: struct{ P [3]testmoqs.Params }{ - P: pUsed, + return MoqUsual_InterfaceParam_paramsKey{ + Params: struct{ W io.Writer }{ + W: wUsed, }, - Hashes: struct{ P hash.Hash }{ - P: pUsedHash, + Hashes: struct{ W hash.Hash }{ + W: wUsedHash, }, } } -func (m *MoqUsual_recorder) PassByChan(p chan testmoqs.Params) *MoqUsual_PassByChan_fnRecorder { - return &MoqUsual_PassByChan_fnRecorder{ - Params: MoqUsual_PassByChan_params{ - P: p, +func (m *MoqUsual_recorder) InterfaceResult(sParam string, bParam bool) *MoqUsual_InterfaceResult_fnRecorder { + return &MoqUsual_InterfaceResult_fnRecorder{ + Params: MoqUsual_InterfaceResult_params{ + SParam: sParam, + BParam: bParam, }, Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, Moq: m.Moq, } } -func (r *MoqUsual_PassByChan_fnRecorder) Any() *MoqUsual_PassByChan_anyParams { +func (r *MoqUsual_InterfaceResult_fnRecorder) Any() *MoqUsual_InterfaceResult_anyParams { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByChan(r.Params)) + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_InterfaceResult(r.Params)) return nil } - return &MoqUsual_PassByChan_anyParams{Recorder: r} + return &MoqUsual_InterfaceResult_anyParams{Recorder: r} } -func (a *MoqUsual_PassByChan_anyParams) P() *MoqUsual_PassByChan_fnRecorder { +func (a *MoqUsual_InterfaceResult_anyParams) SParam() *MoqUsual_InterfaceResult_fnRecorder { a.Recorder.AnyParams |= 1 << 0 return a.Recorder } -func (r *MoqUsual_PassByChan_fnRecorder) Seq() *MoqUsual_PassByChan_fnRecorder { +func (a *MoqUsual_InterfaceResult_anyParams) BParam() *MoqUsual_InterfaceResult_fnRecorder { + a.Recorder.AnyParams |= 1 << 1 + return a.Recorder +} + +func (r *MoqUsual_InterfaceResult_fnRecorder) Seq() *MoqUsual_InterfaceResult_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByChan(r.Params)) + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_InterfaceResult(r.Params)) return nil } r.Sequence = true return r } -func (r *MoqUsual_PassByChan_fnRecorder) NoSeq() *MoqUsual_PassByChan_fnRecorder { +func (r *MoqUsual_InterfaceResult_fnRecorder) NoSeq() *MoqUsual_InterfaceResult_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByChan(r.Params)) + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_InterfaceResult(r.Params)) return nil } r.Sequence = false return r } -func (r *MoqUsual_PassByChan_fnRecorder) ReturnResults(result1 chan testmoqs.Results) *MoqUsual_PassByChan_fnRecorder { +func (r *MoqUsual_InterfaceResult_fnRecorder) ReturnResults(result1 io.Reader) *MoqUsual_InterfaceResult_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -13054,16 +16989,12 @@ func (r *MoqUsual_PassByChan_fnRecorder) ReturnResults(result1 chan testmoqs.Res } r.Results.Results = append(r.Results.Results, struct { - Values *struct { - Result1 chan testmoqs.Results - } + Values *struct{ Result1 io.Reader } Sequence uint32 - DoFn MoqUsual_PassByChan_doFn - DoReturnFn MoqUsual_PassByChan_doReturnFn + DoFn MoqUsual_InterfaceResult_doFn + DoReturnFn MoqUsual_InterfaceResult_doReturnFn }{ - Values: &struct { - Result1 chan testmoqs.Results - }{ + Values: &struct{ Result1 io.Reader }{ Result1: result1, }, Sequence: sequence, @@ -13071,7 +17002,7 @@ func (r *MoqUsual_PassByChan_fnRecorder) ReturnResults(result1 chan testmoqs.Res return r } -func (r *MoqUsual_PassByChan_fnRecorder) AndDo(fn MoqUsual_PassByChan_doFn) *MoqUsual_PassByChan_fnRecorder { +func (r *MoqUsual_InterfaceResult_fnRecorder) AndDo(fn MoqUsual_InterfaceResult_doFn) *MoqUsual_InterfaceResult_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") @@ -13082,7 +17013,7 @@ func (r *MoqUsual_PassByChan_fnRecorder) AndDo(fn MoqUsual_PassByChan_doFn) *Moq return r } -func (r *MoqUsual_PassByChan_fnRecorder) DoReturnResults(fn MoqUsual_PassByChan_doReturnFn) *MoqUsual_PassByChan_fnRecorder { +func (r *MoqUsual_InterfaceResult_fnRecorder) DoReturnResults(fn MoqUsual_InterfaceResult_doReturnFn) *MoqUsual_InterfaceResult_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -13092,17 +17023,15 @@ func (r *MoqUsual_PassByChan_fnRecorder) DoReturnResults(fn MoqUsual_PassByChan_ } r.Results.Results = append(r.Results.Results, struct { - Values *struct { - Result1 chan testmoqs.Results - } + Values *struct{ Result1 io.Reader } Sequence uint32 - DoFn MoqUsual_PassByChan_doFn - DoReturnFn MoqUsual_PassByChan_doReturnFn + DoFn MoqUsual_InterfaceResult_doFn + DoReturnFn MoqUsual_InterfaceResult_doReturnFn }{Sequence: sequence, DoReturnFn: fn}) return r } -func (r *MoqUsual_PassByChan_fnRecorder) FindResults() { +func (r *MoqUsual_InterfaceResult_fnRecorder) FindResults() { r.Moq.Scene.T.Helper() if r.Results != nil { r.Results.Repeat.Increment(r.Moq.Scene.T) @@ -13111,8 +17040,8 @@ func (r *MoqUsual_PassByChan_fnRecorder) FindResults() { anyCount := bits.OnesCount64(r.AnyParams) insertAt := -1 - var results *MoqUsual_PassByChan_resultsByParams - for n, res := range r.Moq.ResultsByParams_PassByChan { + var results *MoqUsual_InterfaceResult_resultsByParams + for n, res := range r.Moq.ResultsByParams_InterfaceResult { if res.AnyParams == r.AnyParams { results = &res break @@ -13122,24 +17051,24 @@ func (r *MoqUsual_PassByChan_fnRecorder) FindResults() { } } if results == nil { - results = &MoqUsual_PassByChan_resultsByParams{ + results = &MoqUsual_InterfaceResult_resultsByParams{ AnyCount: anyCount, AnyParams: r.AnyParams, - Results: map[MoqUsual_PassByChan_paramsKey]*MoqUsual_PassByChan_results{}, + Results: map[MoqUsual_InterfaceResult_paramsKey]*MoqUsual_InterfaceResult_results{}, } - r.Moq.ResultsByParams_PassByChan = append(r.Moq.ResultsByParams_PassByChan, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_PassByChan) { - copy(r.Moq.ResultsByParams_PassByChan[insertAt+1:], r.Moq.ResultsByParams_PassByChan[insertAt:0]) - r.Moq.ResultsByParams_PassByChan[insertAt] = *results + r.Moq.ResultsByParams_InterfaceResult = append(r.Moq.ResultsByParams_InterfaceResult, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_InterfaceResult) { + copy(r.Moq.ResultsByParams_InterfaceResult[insertAt+1:], r.Moq.ResultsByParams_InterfaceResult[insertAt:0]) + r.Moq.ResultsByParams_InterfaceResult[insertAt] = *results } } - paramsKey := r.Moq.ParamsKey_PassByChan(r.Params, r.AnyParams) + paramsKey := r.Moq.ParamsKey_InterfaceResult(r.Params, r.AnyParams) var ok bool r.Results, ok = results.Results[paramsKey] if !ok { - r.Results = &MoqUsual_PassByChan_results{ + r.Results = &MoqUsual_InterfaceResult_results{ Params: r.Params, Results: nil, Index: 0, @@ -13151,7 +17080,7 @@ func (r *MoqUsual_PassByChan_fnRecorder) FindResults() { r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (r *MoqUsual_PassByChan_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_PassByChan_fnRecorder { +func (r *MoqUsual_InterfaceResult_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_InterfaceResult_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") @@ -13162,12 +17091,10 @@ func (r *MoqUsual_PassByChan_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqU for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { if r.Sequence { last = struct { - Values *struct { - Result1 chan testmoqs.Results - } + Values *struct{ Result1 io.Reader } Sequence uint32 - DoFn MoqUsual_PassByChan_doFn - DoReturnFn MoqUsual_PassByChan_doReturnFn + DoFn MoqUsual_InterfaceResult_doFn + DoReturnFn MoqUsual_InterfaceResult_doReturnFn }{ Values: last.Values, Sequence: r.Moq.Scene.NextRecorderSequence(), @@ -13178,76 +17105,93 @@ func (r *MoqUsual_PassByChan_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqU return r } -func (m *MoqUsual) PrettyParams_PassByChan(params MoqUsual_PassByChan_params) string { - return fmt.Sprintf("PassByChan(%#v)", params.P) +func (m *MoqUsual) PrettyParams_InterfaceResult(params MoqUsual_InterfaceResult_params) string { + return fmt.Sprintf("InterfaceResult(%#v, %#v)", params.SParam, params.BParam) } -func (m *MoqUsual) ParamsKey_PassByChan(params MoqUsual_PassByChan_params, anyParams uint64) MoqUsual_PassByChan_paramsKey { +func (m *MoqUsual) ParamsKey_InterfaceResult(params MoqUsual_InterfaceResult_params, anyParams uint64) MoqUsual_InterfaceResult_paramsKey { m.Scene.T.Helper() - var pUsed chan testmoqs.Params - var pUsedHash hash.Hash + var sParamUsed string + var sParamUsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.Runtime.ParameterIndexing.PassByChan.P == moq.ParamIndexByValue { - pUsed = params.P + if m.Runtime.ParameterIndexing.InterfaceResult.SParam == moq.ParamIndexByValue { + sParamUsed = params.SParam } else { - pUsedHash = hash.DeepHash(params.P) + sParamUsedHash = hash.DeepHash(params.SParam) } } - return MoqUsual_PassByChan_paramsKey{ - Params: struct{ P chan testmoqs.Params }{ - P: pUsed, + var bParamUsed bool + var bParamUsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.Runtime.ParameterIndexing.InterfaceResult.BParam == moq.ParamIndexByValue { + bParamUsed = params.BParam + } else { + bParamUsedHash = hash.DeepHash(params.BParam) + } + } + return MoqUsual_InterfaceResult_paramsKey{ + Params: struct { + SParam string + BParam bool + }{ + SParam: sParamUsed, + BParam: bParamUsed, }, - Hashes: struct{ P hash.Hash }{ - P: pUsedHash, + Hashes: struct { + SParam hash.Hash + BParam hash.Hash + }{ + SParam: sParamUsedHash, + BParam: bParamUsedHash, }, } } -func (m *MoqUsual_recorder) PassByEllipsis(p ...testmoqs.Params) *MoqUsual_PassByEllipsis_fnRecorder { - return &MoqUsual_PassByEllipsis_fnRecorder{ - Params: MoqUsual_PassByEllipsis_params{ - P: p, +func (m *MoqUsual_recorder) FnParam(fn func()) *MoqUsual_FnParam_fnRecorder { + return &MoqUsual_FnParam_fnRecorder{ + Params: MoqUsual_FnParam_params{ + Fn: fn, }, Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, Moq: m.Moq, } } -func (r *MoqUsual_PassByEllipsis_fnRecorder) Any() *MoqUsual_PassByEllipsis_anyParams { +func (r *MoqUsual_FnParam_fnRecorder) Any() *MoqUsual_FnParam_anyParams { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByEllipsis(r.Params)) + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_FnParam(r.Params)) return nil } - return &MoqUsual_PassByEllipsis_anyParams{Recorder: r} + return &MoqUsual_FnParam_anyParams{Recorder: r} } -func (a *MoqUsual_PassByEllipsis_anyParams) P() *MoqUsual_PassByEllipsis_fnRecorder { +func (a *MoqUsual_FnParam_anyParams) Fn() *MoqUsual_FnParam_fnRecorder { a.Recorder.AnyParams |= 1 << 0 return a.Recorder } -func (r *MoqUsual_PassByEllipsis_fnRecorder) Seq() *MoqUsual_PassByEllipsis_fnRecorder { +func (r *MoqUsual_FnParam_fnRecorder) Seq() *MoqUsual_FnParam_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByEllipsis(r.Params)) + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_FnParam(r.Params)) return nil } r.Sequence = true return r } -func (r *MoqUsual_PassByEllipsis_fnRecorder) NoSeq() *MoqUsual_PassByEllipsis_fnRecorder { +func (r *MoqUsual_FnParam_fnRecorder) NoSeq() *MoqUsual_FnParam_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByEllipsis(r.Params)) + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_FnParam(r.Params)) return nil } r.Sequence = false return r } -func (r *MoqUsual_PassByEllipsis_fnRecorder) ReturnResults(result1 string, result2 error) *MoqUsual_PassByEllipsis_fnRecorder { +func (r *MoqUsual_FnParam_fnRecorder) ReturnResults() *MoqUsual_FnParam_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -13257,27 +17201,18 @@ func (r *MoqUsual_PassByEllipsis_fnRecorder) ReturnResults(result1 string, resul } r.Results.Results = append(r.Results.Results, struct { - Values *struct { - Result1 string - Result2 error - } + Values *struct{} Sequence uint32 - DoFn MoqUsual_PassByEllipsis_doFn - DoReturnFn MoqUsual_PassByEllipsis_doReturnFn + DoFn MoqUsual_FnParam_doFn + DoReturnFn MoqUsual_FnParam_doReturnFn }{ - Values: &struct { - Result1 string - Result2 error - }{ - Result1: result1, - Result2: result2, - }, + Values: &struct{}{}, Sequence: sequence, }) return r } -func (r *MoqUsual_PassByEllipsis_fnRecorder) AndDo(fn MoqUsual_PassByEllipsis_doFn) *MoqUsual_PassByEllipsis_fnRecorder { +func (r *MoqUsual_FnParam_fnRecorder) AndDo(fn MoqUsual_FnParam_doFn) *MoqUsual_FnParam_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") @@ -13288,7 +17223,7 @@ func (r *MoqUsual_PassByEllipsis_fnRecorder) AndDo(fn MoqUsual_PassByEllipsis_do return r } -func (r *MoqUsual_PassByEllipsis_fnRecorder) DoReturnResults(fn MoqUsual_PassByEllipsis_doReturnFn) *MoqUsual_PassByEllipsis_fnRecorder { +func (r *MoqUsual_FnParam_fnRecorder) DoReturnResults(fn MoqUsual_FnParam_doReturnFn) *MoqUsual_FnParam_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -13298,18 +17233,15 @@ func (r *MoqUsual_PassByEllipsis_fnRecorder) DoReturnResults(fn MoqUsual_PassByE } r.Results.Results = append(r.Results.Results, struct { - Values *struct { - Result1 string - Result2 error - } + Values *struct{} Sequence uint32 - DoFn MoqUsual_PassByEllipsis_doFn - DoReturnFn MoqUsual_PassByEllipsis_doReturnFn + DoFn MoqUsual_FnParam_doFn + DoReturnFn MoqUsual_FnParam_doReturnFn }{Sequence: sequence, DoReturnFn: fn}) return r } -func (r *MoqUsual_PassByEllipsis_fnRecorder) FindResults() { +func (r *MoqUsual_FnParam_fnRecorder) FindResults() { r.Moq.Scene.T.Helper() if r.Results != nil { r.Results.Repeat.Increment(r.Moq.Scene.T) @@ -13318,8 +17250,8 @@ func (r *MoqUsual_PassByEllipsis_fnRecorder) FindResults() { anyCount := bits.OnesCount64(r.AnyParams) insertAt := -1 - var results *MoqUsual_PassByEllipsis_resultsByParams - for n, res := range r.Moq.ResultsByParams_PassByEllipsis { + var results *MoqUsual_FnParam_resultsByParams + for n, res := range r.Moq.ResultsByParams_FnParam { if res.AnyParams == r.AnyParams { results = &res break @@ -13329,24 +17261,24 @@ func (r *MoqUsual_PassByEllipsis_fnRecorder) FindResults() { } } if results == nil { - results = &MoqUsual_PassByEllipsis_resultsByParams{ + results = &MoqUsual_FnParam_resultsByParams{ AnyCount: anyCount, AnyParams: r.AnyParams, - Results: map[MoqUsual_PassByEllipsis_paramsKey]*MoqUsual_PassByEllipsis_results{}, + Results: map[MoqUsual_FnParam_paramsKey]*MoqUsual_FnParam_results{}, } - r.Moq.ResultsByParams_PassByEllipsis = append(r.Moq.ResultsByParams_PassByEllipsis, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_PassByEllipsis) { - copy(r.Moq.ResultsByParams_PassByEllipsis[insertAt+1:], r.Moq.ResultsByParams_PassByEllipsis[insertAt:0]) - r.Moq.ResultsByParams_PassByEllipsis[insertAt] = *results + r.Moq.ResultsByParams_FnParam = append(r.Moq.ResultsByParams_FnParam, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_FnParam) { + copy(r.Moq.ResultsByParams_FnParam[insertAt+1:], r.Moq.ResultsByParams_FnParam[insertAt:0]) + r.Moq.ResultsByParams_FnParam[insertAt] = *results } } - paramsKey := r.Moq.ParamsKey_PassByEllipsis(r.Params, r.AnyParams) + paramsKey := r.Moq.ParamsKey_FnParam(r.Params, r.AnyParams) var ok bool r.Results, ok = results.Results[paramsKey] if !ok { - r.Results = &MoqUsual_PassByEllipsis_results{ + r.Results = &MoqUsual_FnParam_results{ Params: r.Params, Results: nil, Index: 0, @@ -13358,7 +17290,7 @@ func (r *MoqUsual_PassByEllipsis_fnRecorder) FindResults() { r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (r *MoqUsual_PassByEllipsis_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_PassByEllipsis_fnRecorder { +func (r *MoqUsual_FnParam_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_FnParam_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") @@ -13369,13 +17301,10 @@ func (r *MoqUsual_PassByEllipsis_fnRecorder) Repeat(repeaters ...moq.Repeater) * for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { if r.Sequence { last = struct { - Values *struct { - Result1 string - Result2 error - } + Values *struct{} Sequence uint32 - DoFn MoqUsual_PassByEllipsis_doFn - DoReturnFn MoqUsual_PassByEllipsis_doReturnFn + DoFn MoqUsual_FnParam_doFn + DoReturnFn MoqUsual_FnParam_doReturnFn }{ Values: last.Values, Sequence: r.Moq.Scene.NextRecorderSequence(), @@ -13386,72 +17315,72 @@ func (r *MoqUsual_PassByEllipsis_fnRecorder) Repeat(repeaters ...moq.Repeater) * return r } -func (m *MoqUsual) PrettyParams_PassByEllipsis(params MoqUsual_PassByEllipsis_params) string { - return fmt.Sprintf("PassByEllipsis(%#v)", params.P) +func (m *MoqUsual) PrettyParams_FnParam(params MoqUsual_FnParam_params) string { + return fmt.Sprintf("FnParam(%#v)", moq.FnString(params.Fn)) } -func (m *MoqUsual) ParamsKey_PassByEllipsis(params MoqUsual_PassByEllipsis_params, anyParams uint64) MoqUsual_PassByEllipsis_paramsKey { +func (m *MoqUsual) ParamsKey_FnParam(params MoqUsual_FnParam_params, anyParams uint64) MoqUsual_FnParam_paramsKey { m.Scene.T.Helper() - var pUsedHash hash.Hash + var fnUsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.Runtime.ParameterIndexing.PassByEllipsis.P == moq.ParamIndexByValue { - m.Scene.T.Fatalf("The p parameter of the PassByEllipsis function can't be indexed by value") + if m.Runtime.ParameterIndexing.FnParam.Fn == moq.ParamIndexByValue { + m.Scene.T.Fatalf("The fn parameter of the FnParam function can't be indexed by value") } - pUsedHash = hash.DeepHash(params.P) + fnUsedHash = hash.DeepHash(params.Fn) } - return MoqUsual_PassByEllipsis_paramsKey{ + return MoqUsual_FnParam_paramsKey{ Params: struct{}{}, - Hashes: struct{ P hash.Hash }{ - P: pUsedHash, + Hashes: struct{ Fn hash.Hash }{ + Fn: fnUsedHash, }, } } -func (m *MoqUsual_recorder) PassByMap(p map[string]testmoqs.Params) *MoqUsual_PassByMap_fnRecorder { - return &MoqUsual_PassByMap_fnRecorder{ - Params: MoqUsual_PassByMap_params{ - P: p, +func (m *MoqUsual_recorder) Other(param1 other.Params) *MoqUsual_Other_fnRecorder { + return &MoqUsual_Other_fnRecorder{ + Params: MoqUsual_Other_params{ + Param1: param1, }, Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, Moq: m.Moq, } } -func (r *MoqUsual_PassByMap_fnRecorder) Any() *MoqUsual_PassByMap_anyParams { +func (r *MoqUsual_Other_fnRecorder) Any() *MoqUsual_Other_anyParams { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByMap(r.Params)) + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Other(r.Params)) return nil } - return &MoqUsual_PassByMap_anyParams{Recorder: r} + return &MoqUsual_Other_anyParams{Recorder: r} } -func (a *MoqUsual_PassByMap_anyParams) P() *MoqUsual_PassByMap_fnRecorder { +func (a *MoqUsual_Other_anyParams) Param1() *MoqUsual_Other_fnRecorder { a.Recorder.AnyParams |= 1 << 0 return a.Recorder } -func (r *MoqUsual_PassByMap_fnRecorder) Seq() *MoqUsual_PassByMap_fnRecorder { +func (r *MoqUsual_Other_fnRecorder) Seq() *MoqUsual_Other_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByMap(r.Params)) + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Other(r.Params)) return nil } r.Sequence = true return r } -func (r *MoqUsual_PassByMap_fnRecorder) NoSeq() *MoqUsual_PassByMap_fnRecorder { +func (r *MoqUsual_Other_fnRecorder) NoSeq() *MoqUsual_Other_fnRecorder { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByMap(r.Params)) + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Other(r.Params)) return nil } r.Sequence = false return r } -func (r *MoqUsual_PassByMap_fnRecorder) ReturnResults(result1 map[string]testmoqs.Results) *MoqUsual_PassByMap_fnRecorder { +func (r *MoqUsual_Other_fnRecorder) ReturnResults(result1 other.Results) *MoqUsual_Other_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -13462,14 +17391,14 @@ func (r *MoqUsual_PassByMap_fnRecorder) ReturnResults(result1 map[string]testmoq r.Results.Results = append(r.Results.Results, struct { Values *struct { - Result1 map[string]testmoqs.Results + Result1 other.Results } Sequence uint32 - DoFn MoqUsual_PassByMap_doFn - DoReturnFn MoqUsual_PassByMap_doReturnFn + DoFn MoqUsual_Other_doFn + DoReturnFn MoqUsual_Other_doReturnFn }{ Values: &struct { - Result1 map[string]testmoqs.Results + Result1 other.Results }{ Result1: result1, }, @@ -13478,7 +17407,7 @@ func (r *MoqUsual_PassByMap_fnRecorder) ReturnResults(result1 map[string]testmoq return r } -func (r *MoqUsual_PassByMap_fnRecorder) AndDo(fn MoqUsual_PassByMap_doFn) *MoqUsual_PassByMap_fnRecorder { +func (r *MoqUsual_Other_fnRecorder) AndDo(fn MoqUsual_Other_doFn) *MoqUsual_Other_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") @@ -13489,7 +17418,7 @@ func (r *MoqUsual_PassByMap_fnRecorder) AndDo(fn MoqUsual_PassByMap_doFn) *MoqUs return r } -func (r *MoqUsual_PassByMap_fnRecorder) DoReturnResults(fn MoqUsual_PassByMap_doReturnFn) *MoqUsual_PassByMap_fnRecorder { +func (r *MoqUsual_Other_fnRecorder) DoReturnResults(fn MoqUsual_Other_doReturnFn) *MoqUsual_Other_fnRecorder { r.Moq.Scene.T.Helper() r.FindResults() @@ -13500,16 +17429,16 @@ func (r *MoqUsual_PassByMap_fnRecorder) DoReturnResults(fn MoqUsual_PassByMap_do r.Results.Results = append(r.Results.Results, struct { Values *struct { - Result1 map[string]testmoqs.Results + Result1 other.Results } Sequence uint32 - DoFn MoqUsual_PassByMap_doFn - DoReturnFn MoqUsual_PassByMap_doReturnFn + DoFn MoqUsual_Other_doFn + DoReturnFn MoqUsual_Other_doReturnFn }{Sequence: sequence, DoReturnFn: fn}) return r } -func (r *MoqUsual_PassByMap_fnRecorder) FindResults() { +func (r *MoqUsual_Other_fnRecorder) FindResults() { r.Moq.Scene.T.Helper() if r.Results != nil { r.Results.Repeat.Increment(r.Moq.Scene.T) @@ -13518,8 +17447,8 @@ func (r *MoqUsual_PassByMap_fnRecorder) FindResults() { anyCount := bits.OnesCount64(r.AnyParams) insertAt := -1 - var results *MoqUsual_PassByMap_resultsByParams - for n, res := range r.Moq.ResultsByParams_PassByMap { + var results *MoqUsual_Other_resultsByParams + for n, res := range r.Moq.ResultsByParams_Other { if res.AnyParams == r.AnyParams { results = &res break @@ -13529,24 +17458,24 @@ func (r *MoqUsual_PassByMap_fnRecorder) FindResults() { } } if results == nil { - results = &MoqUsual_PassByMap_resultsByParams{ + results = &MoqUsual_Other_resultsByParams{ AnyCount: anyCount, AnyParams: r.AnyParams, - Results: map[MoqUsual_PassByMap_paramsKey]*MoqUsual_PassByMap_results{}, + Results: map[MoqUsual_Other_paramsKey]*MoqUsual_Other_results{}, } - r.Moq.ResultsByParams_PassByMap = append(r.Moq.ResultsByParams_PassByMap, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_PassByMap) { - copy(r.Moq.ResultsByParams_PassByMap[insertAt+1:], r.Moq.ResultsByParams_PassByMap[insertAt:0]) - r.Moq.ResultsByParams_PassByMap[insertAt] = *results + r.Moq.ResultsByParams_Other = append(r.Moq.ResultsByParams_Other, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_Other) { + copy(r.Moq.ResultsByParams_Other[insertAt+1:], r.Moq.ResultsByParams_Other[insertAt:0]) + r.Moq.ResultsByParams_Other[insertAt] = *results } } - paramsKey := r.Moq.ParamsKey_PassByMap(r.Params, r.AnyParams) + paramsKey := r.Moq.ParamsKey_Other(r.Params, r.AnyParams) var ok bool r.Results, ok = results.Results[paramsKey] if !ok { - r.Results = &MoqUsual_PassByMap_results{ + r.Results = &MoqUsual_Other_results{ Params: r.Params, Results: nil, Index: 0, @@ -13558,7 +17487,7 @@ func (r *MoqUsual_PassByMap_fnRecorder) FindResults() { r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (r *MoqUsual_PassByMap_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_PassByMap_fnRecorder { +func (r *MoqUsual_Other_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_Other_fnRecorder { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") @@ -13570,290 +17499,495 @@ func (r *MoqUsual_PassByMap_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUs if r.Sequence { last = struct { Values *struct { - Result1 map[string]testmoqs.Results + Result1 other.Results } Sequence uint32 - DoFn MoqUsual_PassByMap_doFn - DoReturnFn MoqUsual_PassByMap_doReturnFn + DoFn MoqUsual_Other_doFn + DoReturnFn MoqUsual_Other_doReturnFn }{ Values: last.Values, Sequence: r.Moq.Scene.NextRecorderSequence(), } } - r.Results.Results = append(r.Results.Results, last) + r.Results.Results = append(r.Results.Results, last) + } + return r +} + +func (m *MoqUsual) PrettyParams_Other(params MoqUsual_Other_params) string { + return fmt.Sprintf("Other(%#v)", params.Param1) +} + +func (m *MoqUsual) ParamsKey_Other(params MoqUsual_Other_params, anyParams uint64) MoqUsual_Other_paramsKey { + m.Scene.T.Helper() + var param1Used other.Params + var param1UsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.Runtime.ParameterIndexing.Other.Param1 == moq.ParamIndexByValue { + param1Used = params.Param1 + } else { + param1UsedHash = hash.DeepHash(params.Param1) + } + } + return MoqUsual_Other_paramsKey{ + Params: struct{ Param1 other.Params }{ + Param1: param1Used, + }, + Hashes: struct{ Param1 hash.Hash }{ + Param1: param1UsedHash, + }, + } +} + +// Reset resets the state of the moq +func (m *MoqUsual) Reset() { + m.ResultsByParams_Usual = nil + m.ResultsByParams_NoNames = nil + m.ResultsByParams_NoResults = nil + m.ResultsByParams_NoParams = nil + m.ResultsByParams_Nothing = nil + m.ResultsByParams_Variadic = nil + m.ResultsByParams_RepeatedIds = nil + m.ResultsByParams_Times = nil + m.ResultsByParams_DifficultParamNames = nil + m.ResultsByParams_DifficultResultNames = nil + m.ResultsByParams_PassByArray = nil + m.ResultsByParams_PassByChan = nil + m.ResultsByParams_PassByEllipsis = nil + m.ResultsByParams_PassByMap = nil + m.ResultsByParams_PassByReference = nil + m.ResultsByParams_PassBySlice = nil + m.ResultsByParams_PassByValue = nil + m.ResultsByParams_InterfaceParam = nil + m.ResultsByParams_InterfaceResult = nil + m.ResultsByParams_FnParam = nil + m.ResultsByParams_Other = nil +} + +// AssertExpectationsMet asserts that all expectations have been met +func (m *MoqUsual) AssertExpectationsMet() { + m.Scene.T.Helper() + for _, res := range m.ResultsByParams_Usual { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_Usual(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_NoNames { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_NoNames(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_NoResults { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_NoResults(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_NoParams { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_NoParams(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_Nothing { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_Nothing(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_Variadic { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_Variadic(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_RepeatedIds { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_RepeatedIds(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_Times { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_Times(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_DifficultParamNames { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_DifficultParamNames(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_DifficultResultNames { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_DifficultResultNames(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_PassByArray { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_PassByArray(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_PassByChan { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_PassByChan(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_PassByEllipsis { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_PassByEllipsis(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_PassByMap { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_PassByMap(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_PassByReference { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_PassByReference(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_PassBySlice { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_PassBySlice(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_PassByValue { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_PassByValue(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_InterfaceParam { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_InterfaceParam(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_InterfaceResult { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_InterfaceResult(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_FnParam { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_FnParam(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_Other { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_Other(results.Params)) + } + } } - return r } -func (m *MoqUsual) PrettyParams_PassByMap(params MoqUsual_PassByMap_params) string { - return fmt.Sprintf("PassByMap(%#v)", params.P) -} +// The following type assertion assures that testmoqs.GenericParams is mocked +// completely +var _ testmoqs.GenericParams[any, any] = (*MoqGenericParams_mock[any, any])(nil) -func (m *MoqUsual) ParamsKey_PassByMap(params MoqUsual_PassByMap_params, anyParams uint64) MoqUsual_PassByMap_paramsKey { - m.Scene.T.Helper() - var pUsedHash hash.Hash - if anyParams&(1<<0) == 0 { - if m.Runtime.ParameterIndexing.PassByMap.P == moq.ParamIndexByValue { - m.Scene.T.Fatalf("The p parameter of the PassByMap function can't be indexed by value") +// MoqGenericParams holds the state of a moq of the GenericParams type +type MoqGenericParams[S, B any] struct { + Scene *moq.Scene + Config moq.Config + Moq *MoqGenericParams_mock[S, B] + + ResultsByParams_Usual []MoqGenericParams_Usual_resultsByParams[S, B] + + Runtime struct { + ParameterIndexing struct { + Usual struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } } - pUsedHash = hash.DeepHash(params.P) - } - return MoqUsual_PassByMap_paramsKey{ - Params: struct{}{}, - Hashes: struct{ P hash.Hash }{ - P: pUsedHash, - }, } + // MoqGenericParams_mock isolates the mock interface of the GenericParams type } -func (m *MoqUsual_recorder) PassByReference(p *testmoqs.Params) *MoqUsual_PassByReference_fnRecorder { - return &MoqUsual_PassByReference_fnRecorder{ - Params: MoqUsual_PassByReference_params{ - P: p, - }, - Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, - Moq: m.Moq, - } +type MoqGenericParams_mock[S, B any] struct { + Moq *MoqGenericParams[S, B] } -func (r *MoqUsual_PassByReference_fnRecorder) Any() *MoqUsual_PassByReference_anyParams { - r.Moq.Scene.T.Helper() - if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByReference(r.Params)) - return nil - } - return &MoqUsual_PassByReference_anyParams{Recorder: r} +// MoqGenericParams_recorder isolates the recorder interface of the +// GenericParams type +type MoqGenericParams_recorder[S, B any] struct { + Moq *MoqGenericParams[S, B] } -func (a *MoqUsual_PassByReference_anyParams) P() *MoqUsual_PassByReference_fnRecorder { - a.Recorder.AnyParams |= 1 << 0 - return a.Recorder +// MoqGenericParams_Usual_params holds the params of the GenericParams type +type MoqGenericParams_Usual_params[S, B any] struct { + Param1 S + Param2 B } -func (r *MoqUsual_PassByReference_fnRecorder) Seq() *MoqUsual_PassByReference_fnRecorder { - r.Moq.Scene.T.Helper() - if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByReference(r.Params)) - return nil +// MoqGenericParams_Usual_paramsKey holds the map key params of the +// GenericParams type +type MoqGenericParams_Usual_paramsKey[S, B any] struct { + Params struct{} + Hashes struct { + Param1 hash.Hash + Param2 hash.Hash } - r.Sequence = true - return r } -func (r *MoqUsual_PassByReference_fnRecorder) NoSeq() *MoqUsual_PassByReference_fnRecorder { - r.Moq.Scene.T.Helper() - if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByReference(r.Params)) - return nil - } - r.Sequence = false - return r +// MoqGenericParams_Usual_resultsByParams contains the results for a given set +// of parameters for the GenericParams type +type MoqGenericParams_Usual_resultsByParams[S, B any] struct { + AnyCount int + AnyParams uint64 + Results map[MoqGenericParams_Usual_paramsKey[S, B]]*MoqGenericParams_Usual_results[S, B] } -func (r *MoqUsual_PassByReference_fnRecorder) ReturnResults(result1 *testmoqs.Results) *MoqUsual_PassByReference_fnRecorder { - r.Moq.Scene.T.Helper() - r.FindResults() +// MoqGenericParams_Usual_doFn defines the type of function needed when calling +// AndDo for the GenericParams type +type MoqGenericParams_Usual_doFn[S, B any] func(S, B) - var sequence uint32 - if r.Sequence { - sequence = r.Moq.Scene.NextRecorderSequence() - } +// MoqGenericParams_Usual_doReturnFn defines the type of function needed when +// calling DoReturnResults for the GenericParams type +type MoqGenericParams_Usual_doReturnFn[S, B any] func(S, B) (string, error) - r.Results.Results = append(r.Results.Results, struct { +// MoqGenericParams_Usual_results holds the results of the GenericParams type +type MoqGenericParams_Usual_results[S, B any] struct { + Params MoqGenericParams_Usual_params[S, B] + Results []struct { Values *struct { - Result1 *testmoqs.Results + Result1 string + Result2 error } Sequence uint32 - DoFn MoqUsual_PassByReference_doFn - DoReturnFn MoqUsual_PassByReference_doReturnFn - }{ - Values: &struct { - Result1 *testmoqs.Results - }{ - Result1: result1, - }, - Sequence: sequence, - }) - return r + DoFn MoqGenericParams_Usual_doFn[S, B] + DoReturnFn MoqGenericParams_Usual_doReturnFn[S, B] + } + Index uint32 + Repeat *moq.RepeatVal } -func (r *MoqUsual_PassByReference_fnRecorder) AndDo(fn MoqUsual_PassByReference_doFn) *MoqUsual_PassByReference_fnRecorder { - r.Moq.Scene.T.Helper() - if r.Results == nil { - r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") - return nil - } - last := &r.Results.Results[len(r.Results.Results)-1] - last.DoFn = fn - return r +// MoqGenericParams_Usual_fnRecorder routes recorded function calls to the +// MoqGenericParams moq +type MoqGenericParams_Usual_fnRecorder[S, B any] struct { + Params MoqGenericParams_Usual_params[S, B] + AnyParams uint64 + Sequence bool + Results *MoqGenericParams_Usual_results[S, B] + Moq *MoqGenericParams[S, B] } -func (r *MoqUsual_PassByReference_fnRecorder) DoReturnResults(fn MoqUsual_PassByReference_doReturnFn) *MoqUsual_PassByReference_fnRecorder { - r.Moq.Scene.T.Helper() - r.FindResults() +// MoqGenericParams_Usual_anyParams isolates the any params functions of the +// GenericParams type +type MoqGenericParams_Usual_anyParams[S, B any] struct { + Recorder *MoqGenericParams_Usual_fnRecorder[S, B] +} - var sequence uint32 - if r.Sequence { - sequence = r.Moq.Scene.NextRecorderSequence() +// NewMoqGenericParams creates a new moq of the GenericParams type +func NewMoqGenericParams[S, B any](scene *moq.Scene, config *moq.Config) *MoqGenericParams[S, B] { + if config == nil { + config = &moq.Config{} } + m := &MoqGenericParams[S, B]{ + Scene: scene, + Config: *config, + Moq: &MoqGenericParams_mock[S, B]{}, - r.Results.Results = append(r.Results.Results, struct { - Values *struct { - Result1 *testmoqs.Results - } - Sequence uint32 - DoFn MoqUsual_PassByReference_doFn - DoReturnFn MoqUsual_PassByReference_doReturnFn - }{Sequence: sequence, DoReturnFn: fn}) - return r + Runtime: struct { + ParameterIndexing struct { + Usual struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } + } + }{ParameterIndexing: struct { + Usual struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } + }{ + Usual: struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + }{ + Param1: moq.ParamIndexByHash, + Param2: moq.ParamIndexByHash, + }, + }}, + } + m.Moq.Moq = m + + scene.AddMoq(m) + return m } -func (r *MoqUsual_PassByReference_fnRecorder) FindResults() { - r.Moq.Scene.T.Helper() - if r.Results != nil { - r.Results.Repeat.Increment(r.Moq.Scene.T) - return - } +// Mock returns the mock implementation of the GenericParams type +func (m *MoqGenericParams[S, B]) Mock() *MoqGenericParams_mock[S, B] { return m.Moq } - anyCount := bits.OnesCount64(r.AnyParams) - insertAt := -1 - var results *MoqUsual_PassByReference_resultsByParams - for n, res := range r.Moq.ResultsByParams_PassByReference { - if res.AnyParams == r.AnyParams { - results = &res +func (m *MoqGenericParams_mock[S, B]) Usual(param1 S, param2 B) (result1 string, result2 error) { + m.Moq.Scene.T.Helper() + params := MoqGenericParams_Usual_params[S, B]{ + Param1: param1, + Param2: param2, + } + var results *MoqGenericParams_Usual_results[S, B] + for _, resultsByParams := range m.Moq.ResultsByParams_Usual { + paramsKey := m.Moq.ParamsKey_Usual(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { break } - if res.AnyCount > anyCount { - insertAt = n - } } if results == nil { - results = &MoqUsual_PassByReference_resultsByParams{ - AnyCount: anyCount, - AnyParams: r.AnyParams, - Results: map[MoqUsual_PassByReference_paramsKey]*MoqUsual_PassByReference_results{}, - } - r.Moq.ResultsByParams_PassByReference = append(r.Moq.ResultsByParams_PassByReference, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_PassByReference) { - copy(r.Moq.ResultsByParams_PassByReference[insertAt+1:], r.Moq.ResultsByParams_PassByReference[insertAt:0]) - r.Moq.ResultsByParams_PassByReference[insertAt] = *results + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_Usual(params)) } + return } - paramsKey := r.Moq.ParamsKey_PassByReference(r.Params, r.AnyParams) - - var ok bool - r.Results, ok = results.Results[paramsKey] - if !ok { - r.Results = &MoqUsual_PassByReference_results{ - Params: r.Params, - Results: nil, - Index: 0, - Repeat: &moq.RepeatVal{}, + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_Usual(params)) + } + return } - results.Results[paramsKey] = r.Results + i = results.Repeat.ResultCount - 1 } - r.Results.Repeat.Increment(r.Moq.Scene.T) -} - -func (r *MoqUsual_PassByReference_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_PassByReference_fnRecorder { - r.Moq.Scene.T.Helper() - if r.Results == nil { - r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") - return nil - } - r.Results.Repeat.Repeat(r.Moq.Scene.T, repeaters) - last := r.Results.Results[len(r.Results.Results)-1] - for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { - if r.Sequence { - last = struct { - Values *struct { - Result1 *testmoqs.Results - } - Sequence uint32 - DoFn MoqUsual_PassByReference_doFn - DoReturnFn MoqUsual_PassByReference_doReturnFn - }{ - Values: last.Values, - Sequence: r.Moq.Scene.NextRecorderSequence(), - } + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_Usual(params)) } - r.Results.Results = append(r.Results.Results, last) } - return r -} -func (m *MoqUsual) PrettyParams_PassByReference(params MoqUsual_PassByReference_params) string { - return fmt.Sprintf("PassByReference(%#v)", params.P) -} + if result.DoFn != nil { + result.DoFn(param1, param2) + } -func (m *MoqUsual) ParamsKey_PassByReference(params MoqUsual_PassByReference_params, anyParams uint64) MoqUsual_PassByReference_paramsKey { - m.Scene.T.Helper() - var pUsed *testmoqs.Params - var pUsedHash hash.Hash - if anyParams&(1<<0) == 0 { - if m.Runtime.ParameterIndexing.PassByReference.P == moq.ParamIndexByValue { - pUsed = params.P - } else { - pUsedHash = hash.DeepHash(params.P) - } + if result.Values != nil { + result1 = result.Values.Result1 + result2 = result.Values.Result2 } - return MoqUsual_PassByReference_paramsKey{ - Params: struct{ P *testmoqs.Params }{ - P: pUsed, - }, - Hashes: struct{ P hash.Hash }{ - P: pUsedHash, - }, + if result.DoReturnFn != nil { + result1, result2 = result.DoReturnFn(param1, param2) } + return } -func (m *MoqUsual_recorder) PassBySlice(p []testmoqs.Params) *MoqUsual_PassBySlice_fnRecorder { - return &MoqUsual_PassBySlice_fnRecorder{ - Params: MoqUsual_PassBySlice_params{ - P: p, +// OnCall returns the recorder implementation of the GenericParams type +func (m *MoqGenericParams[S, B]) OnCall() *MoqGenericParams_recorder[S, B] { + return &MoqGenericParams_recorder[S, B]{ + Moq: m, + } +} + +func (m *MoqGenericParams_recorder[S, B]) Usual(param1 S, param2 B) *MoqGenericParams_Usual_fnRecorder[S, B] { + return &MoqGenericParams_Usual_fnRecorder[S, B]{ + Params: MoqGenericParams_Usual_params[S, B]{ + Param1: param1, + Param2: param2, }, Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, Moq: m.Moq, } } -func (r *MoqUsual_PassBySlice_fnRecorder) Any() *MoqUsual_PassBySlice_anyParams { +func (r *MoqGenericParams_Usual_fnRecorder[S, B]) Any() *MoqGenericParams_Usual_anyParams[S, B] { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassBySlice(r.Params)) + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) return nil } - return &MoqUsual_PassBySlice_anyParams{Recorder: r} + return &MoqGenericParams_Usual_anyParams[S, B]{Recorder: r} } -func (a *MoqUsual_PassBySlice_anyParams) P() *MoqUsual_PassBySlice_fnRecorder { +func (a *MoqGenericParams_Usual_anyParams[S, B]) Param1() *MoqGenericParams_Usual_fnRecorder[S, B] { a.Recorder.AnyParams |= 1 << 0 return a.Recorder } -func (r *MoqUsual_PassBySlice_fnRecorder) Seq() *MoqUsual_PassBySlice_fnRecorder { +func (a *MoqGenericParams_Usual_anyParams[S, B]) Param2() *MoqGenericParams_Usual_fnRecorder[S, B] { + a.Recorder.AnyParams |= 1 << 1 + return a.Recorder +} + +func (r *MoqGenericParams_Usual_fnRecorder[S, B]) Seq() *MoqGenericParams_Usual_fnRecorder[S, B] { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassBySlice(r.Params)) + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) return nil } r.Sequence = true return r } -func (r *MoqUsual_PassBySlice_fnRecorder) NoSeq() *MoqUsual_PassBySlice_fnRecorder { +func (r *MoqGenericParams_Usual_fnRecorder[S, B]) NoSeq() *MoqGenericParams_Usual_fnRecorder[S, B] { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassBySlice(r.Params)) + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) return nil } r.Sequence = false return r } -func (r *MoqUsual_PassBySlice_fnRecorder) ReturnResults(result1 []testmoqs.Results) *MoqUsual_PassBySlice_fnRecorder { +func (r *MoqGenericParams_Usual_fnRecorder[S, B]) ReturnResults(result1 string, result2 error) *MoqGenericParams_Usual_fnRecorder[S, B] { r.Moq.Scene.T.Helper() r.FindResults() @@ -13864,23 +17998,26 @@ func (r *MoqUsual_PassBySlice_fnRecorder) ReturnResults(result1 []testmoqs.Resul r.Results.Results = append(r.Results.Results, struct { Values *struct { - Result1 []testmoqs.Results + Result1 string + Result2 error } Sequence uint32 - DoFn MoqUsual_PassBySlice_doFn - DoReturnFn MoqUsual_PassBySlice_doReturnFn + DoFn MoqGenericParams_Usual_doFn[S, B] + DoReturnFn MoqGenericParams_Usual_doReturnFn[S, B] }{ Values: &struct { - Result1 []testmoqs.Results + Result1 string + Result2 error }{ Result1: result1, + Result2: result2, }, Sequence: sequence, }) return r } -func (r *MoqUsual_PassBySlice_fnRecorder) AndDo(fn MoqUsual_PassBySlice_doFn) *MoqUsual_PassBySlice_fnRecorder { +func (r *MoqGenericParams_Usual_fnRecorder[S, B]) AndDo(fn MoqGenericParams_Usual_doFn[S, B]) *MoqGenericParams_Usual_fnRecorder[S, B] { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") @@ -13891,7 +18028,7 @@ func (r *MoqUsual_PassBySlice_fnRecorder) AndDo(fn MoqUsual_PassBySlice_doFn) *M return r } -func (r *MoqUsual_PassBySlice_fnRecorder) DoReturnResults(fn MoqUsual_PassBySlice_doReturnFn) *MoqUsual_PassBySlice_fnRecorder { +func (r *MoqGenericParams_Usual_fnRecorder[S, B]) DoReturnResults(fn MoqGenericParams_Usual_doReturnFn[S, B]) *MoqGenericParams_Usual_fnRecorder[S, B] { r.Moq.Scene.T.Helper() r.FindResults() @@ -13902,16 +18039,17 @@ func (r *MoqUsual_PassBySlice_fnRecorder) DoReturnResults(fn MoqUsual_PassBySlic r.Results.Results = append(r.Results.Results, struct { Values *struct { - Result1 []testmoqs.Results + Result1 string + Result2 error } Sequence uint32 - DoFn MoqUsual_PassBySlice_doFn - DoReturnFn MoqUsual_PassBySlice_doReturnFn + DoFn MoqGenericParams_Usual_doFn[S, B] + DoReturnFn MoqGenericParams_Usual_doReturnFn[S, B] }{Sequence: sequence, DoReturnFn: fn}) return r } -func (r *MoqUsual_PassBySlice_fnRecorder) FindResults() { +func (r *MoqGenericParams_Usual_fnRecorder[S, B]) FindResults() { r.Moq.Scene.T.Helper() if r.Results != nil { r.Results.Repeat.Increment(r.Moq.Scene.T) @@ -13920,8 +18058,8 @@ func (r *MoqUsual_PassBySlice_fnRecorder) FindResults() { anyCount := bits.OnesCount64(r.AnyParams) insertAt := -1 - var results *MoqUsual_PassBySlice_resultsByParams - for n, res := range r.Moq.ResultsByParams_PassBySlice { + var results *MoqGenericParams_Usual_resultsByParams[S, B] + for n, res := range r.Moq.ResultsByParams_Usual { if res.AnyParams == r.AnyParams { results = &res break @@ -13931,24 +18069,24 @@ func (r *MoqUsual_PassBySlice_fnRecorder) FindResults() { } } if results == nil { - results = &MoqUsual_PassBySlice_resultsByParams{ + results = &MoqGenericParams_Usual_resultsByParams[S, B]{ AnyCount: anyCount, AnyParams: r.AnyParams, - Results: map[MoqUsual_PassBySlice_paramsKey]*MoqUsual_PassBySlice_results{}, + Results: map[MoqGenericParams_Usual_paramsKey[S, B]]*MoqGenericParams_Usual_results[S, B]{}, } - r.Moq.ResultsByParams_PassBySlice = append(r.Moq.ResultsByParams_PassBySlice, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_PassBySlice) { - copy(r.Moq.ResultsByParams_PassBySlice[insertAt+1:], r.Moq.ResultsByParams_PassBySlice[insertAt:0]) - r.Moq.ResultsByParams_PassBySlice[insertAt] = *results + r.Moq.ResultsByParams_Usual = append(r.Moq.ResultsByParams_Usual, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_Usual) { + copy(r.Moq.ResultsByParams_Usual[insertAt+1:], r.Moq.ResultsByParams_Usual[insertAt:0]) + r.Moq.ResultsByParams_Usual[insertAt] = *results } } - paramsKey := r.Moq.ParamsKey_PassBySlice(r.Params, r.AnyParams) + paramsKey := r.Moq.ParamsKey_Usual(r.Params, r.AnyParams) var ok bool r.Results, ok = results.Results[paramsKey] if !ok { - r.Results = &MoqUsual_PassBySlice_results{ + r.Results = &MoqGenericParams_Usual_results[S, B]{ Params: r.Params, Results: nil, Index: 0, @@ -13960,7 +18098,7 @@ func (r *MoqUsual_PassBySlice_fnRecorder) FindResults() { r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (r *MoqUsual_PassBySlice_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_PassBySlice_fnRecorder { +func (r *MoqGenericParams_Usual_fnRecorder[S, B]) Repeat(repeaters ...moq.Repeater) *MoqGenericParams_Usual_fnRecorder[S, B] { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") @@ -13972,11 +18110,12 @@ func (r *MoqUsual_PassBySlice_fnRecorder) Repeat(repeaters ...moq.Repeater) *Moq if r.Sequence { last = struct { Values *struct { - Result1 []testmoqs.Results + Result1 string + Result2 error } Sequence uint32 - DoFn MoqUsual_PassBySlice_doFn - DoReturnFn MoqUsual_PassBySlice_doReturnFn + DoFn MoqGenericParams_Usual_doFn[S, B] + DoReturnFn MoqGenericParams_Usual_doReturnFn[S, B] }{ Values: last.Values, Sequence: r.Moq.Scene.NextRecorderSequence(), @@ -13987,72 +18126,310 @@ func (r *MoqUsual_PassBySlice_fnRecorder) Repeat(repeaters ...moq.Repeater) *Moq return r } -func (m *MoqUsual) PrettyParams_PassBySlice(params MoqUsual_PassBySlice_params) string { - return fmt.Sprintf("PassBySlice(%#v)", params.P) +func (m *MoqGenericParams[S, B]) PrettyParams_Usual(params MoqGenericParams_Usual_params[S, B]) string { + return fmt.Sprintf("Usual(%#v, %#v)", params.Param1, params.Param2) } -func (m *MoqUsual) ParamsKey_PassBySlice(params MoqUsual_PassBySlice_params, anyParams uint64) MoqUsual_PassBySlice_paramsKey { +func (m *MoqGenericParams[S, B]) ParamsKey_Usual(params MoqGenericParams_Usual_params[S, B], anyParams uint64) MoqGenericParams_Usual_paramsKey[S, B] { m.Scene.T.Helper() - var pUsedHash hash.Hash + var param1UsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.Runtime.ParameterIndexing.PassBySlice.P == moq.ParamIndexByValue { - m.Scene.T.Fatalf("The p parameter of the PassBySlice function can't be indexed by value") + if m.Runtime.ParameterIndexing.Usual.Param1 == moq.ParamIndexByValue { + m.Scene.T.Fatalf("The param1 parameter of the Usual function can't be indexed by value") } - pUsedHash = hash.DeepHash(params.P) + param1UsedHash = hash.DeepHash(params.Param1) } - return MoqUsual_PassBySlice_paramsKey{ + var param2UsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.Runtime.ParameterIndexing.Usual.Param2 == moq.ParamIndexByValue { + m.Scene.T.Fatalf("The param2 parameter of the Usual function can't be indexed by value") + } + param2UsedHash = hash.DeepHash(params.Param2) + } + return MoqGenericParams_Usual_paramsKey[S, B]{ Params: struct{}{}, - Hashes: struct{ P hash.Hash }{ - P: pUsedHash, + Hashes: struct { + Param1 hash.Hash + Param2 hash.Hash + }{ + Param1: param1UsedHash, + Param2: param2UsedHash, }, } } -func (m *MoqUsual_recorder) PassByValue(p testmoqs.Params) *MoqUsual_PassByValue_fnRecorder { - return &MoqUsual_PassByValue_fnRecorder{ - Params: MoqUsual_PassByValue_params{ - P: p, +// Reset resets the state of the moq +func (m *MoqGenericParams[S, B]) Reset() { m.ResultsByParams_Usual = nil } + +// AssertExpectationsMet asserts that all expectations have been met +func (m *MoqGenericParams[S, B]) AssertExpectationsMet() { + m.Scene.T.Helper() + for _, res := range m.ResultsByParams_Usual { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_Usual(results.Params)) + } + } + } +} + +// The following type assertion assures that testmoqs.PartialGenericParams is +// mocked completely +var _ testmoqs.PartialGenericParams[any] = (*MoqPartialGenericParams_mock[any])(nil) + +// MoqPartialGenericParams holds the state of a moq of the PartialGenericParams +// type +type MoqPartialGenericParams[S any] struct { + Scene *moq.Scene + Config moq.Config + Moq *MoqPartialGenericParams_mock[S] + + ResultsByParams_Usual []MoqPartialGenericParams_Usual_resultsByParams[S] + + Runtime struct { + ParameterIndexing struct { + Usual struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } + } + } + // MoqPartialGenericParams_mock isolates the mock interface of the +} + +// PartialGenericParams type +type MoqPartialGenericParams_mock[S any] struct { + Moq *MoqPartialGenericParams[S] +} + +// MoqPartialGenericParams_recorder isolates the recorder interface of the +// PartialGenericParams type +type MoqPartialGenericParams_recorder[S any] struct { + Moq *MoqPartialGenericParams[S] +} + +// MoqPartialGenericParams_Usual_params holds the params of the +// PartialGenericParams type +type MoqPartialGenericParams_Usual_params[S any] struct { + Param1 S + Param2 bool +} + +// MoqPartialGenericParams_Usual_paramsKey holds the map key params of the +// PartialGenericParams type +type MoqPartialGenericParams_Usual_paramsKey[S any] struct { + Params struct{ Param2 bool } + Hashes struct { + Param1 hash.Hash + Param2 hash.Hash + } +} + +// MoqPartialGenericParams_Usual_resultsByParams contains the results for a +// given set of parameters for the PartialGenericParams type +type MoqPartialGenericParams_Usual_resultsByParams[S any] struct { + AnyCount int + AnyParams uint64 + Results map[MoqPartialGenericParams_Usual_paramsKey[S]]*MoqPartialGenericParams_Usual_results[S] +} + +// MoqPartialGenericParams_Usual_doFn defines the type of function needed when +// calling AndDo for the PartialGenericParams type +type MoqPartialGenericParams_Usual_doFn[S any] func(S, bool) + +// MoqPartialGenericParams_Usual_doReturnFn defines the type of function needed +// when calling DoReturnResults for the PartialGenericParams type +type MoqPartialGenericParams_Usual_doReturnFn[S any] func(S, bool) (string, error) + +// MoqPartialGenericParams_Usual_results holds the results of the +// PartialGenericParams type +type MoqPartialGenericParams_Usual_results[S any] struct { + Params MoqPartialGenericParams_Usual_params[S] + Results []struct { + Values *struct { + Result1 string + Result2 error + } + Sequence uint32 + DoFn MoqPartialGenericParams_Usual_doFn[S] + DoReturnFn MoqPartialGenericParams_Usual_doReturnFn[S] + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqPartialGenericParams_Usual_fnRecorder routes recorded function calls to +// the MoqPartialGenericParams moq +type MoqPartialGenericParams_Usual_fnRecorder[S any] struct { + Params MoqPartialGenericParams_Usual_params[S] + AnyParams uint64 + Sequence bool + Results *MoqPartialGenericParams_Usual_results[S] + Moq *MoqPartialGenericParams[S] +} + +// MoqPartialGenericParams_Usual_anyParams isolates the any params functions of +// the PartialGenericParams type +type MoqPartialGenericParams_Usual_anyParams[S any] struct { + Recorder *MoqPartialGenericParams_Usual_fnRecorder[S] +} + +// NewMoqPartialGenericParams creates a new moq of the PartialGenericParams +// type +func NewMoqPartialGenericParams[S any](scene *moq.Scene, config *moq.Config) *MoqPartialGenericParams[S] { + if config == nil { + config = &moq.Config{} + } + m := &MoqPartialGenericParams[S]{ + Scene: scene, + Config: *config, + Moq: &MoqPartialGenericParams_mock[S]{}, + + Runtime: struct { + ParameterIndexing struct { + Usual struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } + } + }{ParameterIndexing: struct { + Usual struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } + }{ + Usual: struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + }{ + Param1: moq.ParamIndexByHash, + Param2: moq.ParamIndexByValue, + }, + }}, + } + m.Moq.Moq = m + + scene.AddMoq(m) + return m +} + +// Mock returns the mock implementation of the PartialGenericParams type +func (m *MoqPartialGenericParams[S]) Mock() *MoqPartialGenericParams_mock[S] { return m.Moq } + +func (m *MoqPartialGenericParams_mock[S]) Usual(param1 S, param2 bool) (result1 string, result2 error) { + m.Moq.Scene.T.Helper() + params := MoqPartialGenericParams_Usual_params[S]{ + Param1: param1, + Param2: param2, + } + var results *MoqPartialGenericParams_Usual_results[S] + for _, resultsByParams := range m.Moq.ResultsByParams_Usual { + paramsKey := m.Moq.ParamsKey_Usual(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_Usual(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_Usual(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_Usual(params)) + } + } + + if result.DoFn != nil { + result.DoFn(param1, param2) + } + + if result.Values != nil { + result1 = result.Values.Result1 + result2 = result.Values.Result2 + } + if result.DoReturnFn != nil { + result1, result2 = result.DoReturnFn(param1, param2) + } + return +} + +// OnCall returns the recorder implementation of the PartialGenericParams type +func (m *MoqPartialGenericParams[S]) OnCall() *MoqPartialGenericParams_recorder[S] { + return &MoqPartialGenericParams_recorder[S]{ + Moq: m, + } +} + +func (m *MoqPartialGenericParams_recorder[S]) Usual(param1 S, param2 bool) *MoqPartialGenericParams_Usual_fnRecorder[S] { + return &MoqPartialGenericParams_Usual_fnRecorder[S]{ + Params: MoqPartialGenericParams_Usual_params[S]{ + Param1: param1, + Param2: param2, }, Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, Moq: m.Moq, } } -func (r *MoqUsual_PassByValue_fnRecorder) Any() *MoqUsual_PassByValue_anyParams { +func (r *MoqPartialGenericParams_Usual_fnRecorder[S]) Any() *MoqPartialGenericParams_Usual_anyParams[S] { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByValue(r.Params)) + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) return nil } - return &MoqUsual_PassByValue_anyParams{Recorder: r} + return &MoqPartialGenericParams_Usual_anyParams[S]{Recorder: r} } -func (a *MoqUsual_PassByValue_anyParams) P() *MoqUsual_PassByValue_fnRecorder { +func (a *MoqPartialGenericParams_Usual_anyParams[S]) Param1() *MoqPartialGenericParams_Usual_fnRecorder[S] { a.Recorder.AnyParams |= 1 << 0 return a.Recorder } -func (r *MoqUsual_PassByValue_fnRecorder) Seq() *MoqUsual_PassByValue_fnRecorder { +func (a *MoqPartialGenericParams_Usual_anyParams[S]) Param2() *MoqPartialGenericParams_Usual_fnRecorder[S] { + a.Recorder.AnyParams |= 1 << 1 + return a.Recorder +} + +func (r *MoqPartialGenericParams_Usual_fnRecorder[S]) Seq() *MoqPartialGenericParams_Usual_fnRecorder[S] { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByValue(r.Params)) + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) return nil } r.Sequence = true return r } -func (r *MoqUsual_PassByValue_fnRecorder) NoSeq() *MoqUsual_PassByValue_fnRecorder { +func (r *MoqPartialGenericParams_Usual_fnRecorder[S]) NoSeq() *MoqPartialGenericParams_Usual_fnRecorder[S] { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_PassByValue(r.Params)) + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) return nil } r.Sequence = false return r } -func (r *MoqUsual_PassByValue_fnRecorder) ReturnResults(result1 testmoqs.Results) *MoqUsual_PassByValue_fnRecorder { +func (r *MoqPartialGenericParams_Usual_fnRecorder[S]) ReturnResults(result1 string, result2 error) *MoqPartialGenericParams_Usual_fnRecorder[S] { r.Moq.Scene.T.Helper() r.FindResults() @@ -14063,23 +18440,26 @@ func (r *MoqUsual_PassByValue_fnRecorder) ReturnResults(result1 testmoqs.Results r.Results.Results = append(r.Results.Results, struct { Values *struct { - Result1 testmoqs.Results + Result1 string + Result2 error } Sequence uint32 - DoFn MoqUsual_PassByValue_doFn - DoReturnFn MoqUsual_PassByValue_doReturnFn + DoFn MoqPartialGenericParams_Usual_doFn[S] + DoReturnFn MoqPartialGenericParams_Usual_doReturnFn[S] }{ Values: &struct { - Result1 testmoqs.Results + Result1 string + Result2 error }{ Result1: result1, + Result2: result2, }, Sequence: sequence, }) return r } -func (r *MoqUsual_PassByValue_fnRecorder) AndDo(fn MoqUsual_PassByValue_doFn) *MoqUsual_PassByValue_fnRecorder { +func (r *MoqPartialGenericParams_Usual_fnRecorder[S]) AndDo(fn MoqPartialGenericParams_Usual_doFn[S]) *MoqPartialGenericParams_Usual_fnRecorder[S] { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") @@ -14090,7 +18470,7 @@ func (r *MoqUsual_PassByValue_fnRecorder) AndDo(fn MoqUsual_PassByValue_doFn) *M return r } -func (r *MoqUsual_PassByValue_fnRecorder) DoReturnResults(fn MoqUsual_PassByValue_doReturnFn) *MoqUsual_PassByValue_fnRecorder { +func (r *MoqPartialGenericParams_Usual_fnRecorder[S]) DoReturnResults(fn MoqPartialGenericParams_Usual_doReturnFn[S]) *MoqPartialGenericParams_Usual_fnRecorder[S] { r.Moq.Scene.T.Helper() r.FindResults() @@ -14101,16 +18481,17 @@ func (r *MoqUsual_PassByValue_fnRecorder) DoReturnResults(fn MoqUsual_PassByValu r.Results.Results = append(r.Results.Results, struct { Values *struct { - Result1 testmoqs.Results + Result1 string + Result2 error } Sequence uint32 - DoFn MoqUsual_PassByValue_doFn - DoReturnFn MoqUsual_PassByValue_doReturnFn + DoFn MoqPartialGenericParams_Usual_doFn[S] + DoReturnFn MoqPartialGenericParams_Usual_doReturnFn[S] }{Sequence: sequence, DoReturnFn: fn}) return r } -func (r *MoqUsual_PassByValue_fnRecorder) FindResults() { +func (r *MoqPartialGenericParams_Usual_fnRecorder[S]) FindResults() { r.Moq.Scene.T.Helper() if r.Results != nil { r.Results.Repeat.Increment(r.Moq.Scene.T) @@ -14119,8 +18500,8 @@ func (r *MoqUsual_PassByValue_fnRecorder) FindResults() { anyCount := bits.OnesCount64(r.AnyParams) insertAt := -1 - var results *MoqUsual_PassByValue_resultsByParams - for n, res := range r.Moq.ResultsByParams_PassByValue { + var results *MoqPartialGenericParams_Usual_resultsByParams[S] + for n, res := range r.Moq.ResultsByParams_Usual { if res.AnyParams == r.AnyParams { results = &res break @@ -14130,24 +18511,24 @@ func (r *MoqUsual_PassByValue_fnRecorder) FindResults() { } } if results == nil { - results = &MoqUsual_PassByValue_resultsByParams{ + results = &MoqPartialGenericParams_Usual_resultsByParams[S]{ AnyCount: anyCount, AnyParams: r.AnyParams, - Results: map[MoqUsual_PassByValue_paramsKey]*MoqUsual_PassByValue_results{}, + Results: map[MoqPartialGenericParams_Usual_paramsKey[S]]*MoqPartialGenericParams_Usual_results[S]{}, } - r.Moq.ResultsByParams_PassByValue = append(r.Moq.ResultsByParams_PassByValue, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_PassByValue) { - copy(r.Moq.ResultsByParams_PassByValue[insertAt+1:], r.Moq.ResultsByParams_PassByValue[insertAt:0]) - r.Moq.ResultsByParams_PassByValue[insertAt] = *results + r.Moq.ResultsByParams_Usual = append(r.Moq.ResultsByParams_Usual, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_Usual) { + copy(r.Moq.ResultsByParams_Usual[insertAt+1:], r.Moq.ResultsByParams_Usual[insertAt:0]) + r.Moq.ResultsByParams_Usual[insertAt] = *results } } - paramsKey := r.Moq.ParamsKey_PassByValue(r.Params, r.AnyParams) + paramsKey := r.Moq.ParamsKey_Usual(r.Params, r.AnyParams) var ok bool r.Results, ok = results.Results[paramsKey] if !ok { - r.Results = &MoqUsual_PassByValue_results{ + r.Results = &MoqPartialGenericParams_Usual_results[S]{ Params: r.Params, Results: nil, Index: 0, @@ -14159,7 +18540,7 @@ func (r *MoqUsual_PassByValue_fnRecorder) FindResults() { r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (r *MoqUsual_PassByValue_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_PassByValue_fnRecorder { +func (r *MoqPartialGenericParams_Usual_fnRecorder[S]) Repeat(repeaters ...moq.Repeater) *MoqPartialGenericParams_Usual_fnRecorder[S] { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") @@ -14171,11 +18552,12 @@ func (r *MoqUsual_PassByValue_fnRecorder) Repeat(repeaters ...moq.Repeater) *Moq if r.Sequence { last = struct { Values *struct { - Result1 testmoqs.Results + Result1 string + Result2 error } Sequence uint32 - DoFn MoqUsual_PassByValue_doFn - DoReturnFn MoqUsual_PassByValue_doReturnFn + DoFn MoqPartialGenericParams_Usual_doFn[S] + DoReturnFn MoqPartialGenericParams_Usual_doReturnFn[S] }{ Values: last.Values, Sequence: r.Moq.Scene.NextRecorderSequence(), @@ -14186,76 +18568,313 @@ func (r *MoqUsual_PassByValue_fnRecorder) Repeat(repeaters ...moq.Repeater) *Moq return r } -func (m *MoqUsual) PrettyParams_PassByValue(params MoqUsual_PassByValue_params) string { - return fmt.Sprintf("PassByValue(%#v)", params.P) +func (m *MoqPartialGenericParams[S]) PrettyParams_Usual(params MoqPartialGenericParams_Usual_params[S]) string { + return fmt.Sprintf("Usual(%#v, %#v)", params.Param1, params.Param2) } -func (m *MoqUsual) ParamsKey_PassByValue(params MoqUsual_PassByValue_params, anyParams uint64) MoqUsual_PassByValue_paramsKey { +func (m *MoqPartialGenericParams[S]) ParamsKey_Usual(params MoqPartialGenericParams_Usual_params[S], anyParams uint64) MoqPartialGenericParams_Usual_paramsKey[S] { m.Scene.T.Helper() - var pUsed testmoqs.Params - var pUsedHash hash.Hash + var param1UsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.Runtime.ParameterIndexing.PassByValue.P == moq.ParamIndexByValue { - pUsed = params.P + if m.Runtime.ParameterIndexing.Usual.Param1 == moq.ParamIndexByValue { + m.Scene.T.Fatalf("The param1 parameter of the Usual function can't be indexed by value") + } + param1UsedHash = hash.DeepHash(params.Param1) + } + var param2Used bool + var param2UsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.Runtime.ParameterIndexing.Usual.Param2 == moq.ParamIndexByValue { + param2Used = params.Param2 } else { - pUsedHash = hash.DeepHash(params.P) + param2UsedHash = hash.DeepHash(params.Param2) } } - return MoqUsual_PassByValue_paramsKey{ - Params: struct{ P testmoqs.Params }{ - P: pUsed, + return MoqPartialGenericParams_Usual_paramsKey[S]{ + Params: struct{ Param2 bool }{ + Param2: param2Used, }, - Hashes: struct{ P hash.Hash }{ - P: pUsedHash, + Hashes: struct { + Param1 hash.Hash + Param2 hash.Hash + }{ + Param1: param1UsedHash, + Param2: param2UsedHash, }, } } -func (m *MoqUsual_recorder) InterfaceParam(w io.Writer) *MoqUsual_InterfaceParam_fnRecorder { - return &MoqUsual_InterfaceParam_fnRecorder{ - Params: MoqUsual_InterfaceParam_params{ - W: w, +// Reset resets the state of the moq +func (m *MoqPartialGenericParams[S]) Reset() { m.ResultsByParams_Usual = nil } + +// AssertExpectationsMet asserts that all expectations have been met +func (m *MoqPartialGenericParams[S]) AssertExpectationsMet() { + m.Scene.T.Helper() + for _, res := range m.ResultsByParams_Usual { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_Usual(results.Params)) + } + } + } +} + +// The following type assertion assures that testmoqs.GenericResults is mocked +// completely +var _ testmoqs.GenericResults[string, error] = (*MoqGenericResults_mock[string, error])(nil) + +// MoqGenericResults holds the state of a moq of the GenericResults type +type MoqGenericResults[S ~string, E error] struct { + Scene *moq.Scene + Config moq.Config + Moq *MoqGenericResults_mock[S, E] + + ResultsByParams_Usual []MoqGenericResults_Usual_resultsByParams[S, E] + + Runtime struct { + ParameterIndexing struct { + Usual struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } + } + } + // MoqGenericResults_mock isolates the mock interface of the GenericResults +} + +// type +type MoqGenericResults_mock[S ~string, E error] struct { + Moq *MoqGenericResults[S, E] +} + +// MoqGenericResults_recorder isolates the recorder interface of the +// GenericResults type +type MoqGenericResults_recorder[S ~string, E error] struct { + Moq *MoqGenericResults[S, E] +} + +// MoqGenericResults_Usual_params holds the params of the GenericResults type +type MoqGenericResults_Usual_params[S ~string, E error] struct { + Param1 string + Param2 bool +} + +// MoqGenericResults_Usual_paramsKey holds the map key params of the +// GenericResults type +type MoqGenericResults_Usual_paramsKey[S ~string, E error] struct { + Params struct { + Param1 string + Param2 bool + } + Hashes struct { + Param1 hash.Hash + Param2 hash.Hash + } +} + +// MoqGenericResults_Usual_resultsByParams contains the results for a given set +// of parameters for the GenericResults type +type MoqGenericResults_Usual_resultsByParams[S ~string, E error] struct { + AnyCount int + AnyParams uint64 + Results map[MoqGenericResults_Usual_paramsKey[S, E]]*MoqGenericResults_Usual_results[S, E] +} + +// MoqGenericResults_Usual_doFn defines the type of function needed when +// calling AndDo for the GenericResults type +type MoqGenericResults_Usual_doFn[S ~string, E error] func(string, bool) + +// MoqGenericResults_Usual_doReturnFn defines the type of function needed when +// calling DoReturnResults for the GenericResults type +type MoqGenericResults_Usual_doReturnFn[S ~string, E error] func(string, bool) (S, E) + +// MoqGenericResults_Usual_results holds the results of the GenericResults type +type MoqGenericResults_Usual_results[S ~string, E error] struct { + Params MoqGenericResults_Usual_params[S, E] + Results []struct { + Values *struct { + Result1 S + Result2 E + } + Sequence uint32 + DoFn MoqGenericResults_Usual_doFn[S, E] + DoReturnFn MoqGenericResults_Usual_doReturnFn[S, E] + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqGenericResults_Usual_fnRecorder routes recorded function calls to the +// MoqGenericResults moq +type MoqGenericResults_Usual_fnRecorder[S ~string, E error] struct { + Params MoqGenericResults_Usual_params[S, E] + AnyParams uint64 + Sequence bool + Results *MoqGenericResults_Usual_results[S, E] + Moq *MoqGenericResults[S, E] +} + +// MoqGenericResults_Usual_anyParams isolates the any params functions of the +// GenericResults type +type MoqGenericResults_Usual_anyParams[S ~string, E error] struct { + Recorder *MoqGenericResults_Usual_fnRecorder[S, E] +} + +// NewMoqGenericResults creates a new moq of the GenericResults type +func NewMoqGenericResults[S ~string, E error](scene *moq.Scene, config *moq.Config) *MoqGenericResults[S, E] { + if config == nil { + config = &moq.Config{} + } + m := &MoqGenericResults[S, E]{ + Scene: scene, + Config: *config, + Moq: &MoqGenericResults_mock[S, E]{}, + + Runtime: struct { + ParameterIndexing struct { + Usual struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } + } + }{ParameterIndexing: struct { + Usual struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } + }{ + Usual: struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + }{ + Param1: moq.ParamIndexByValue, + Param2: moq.ParamIndexByValue, + }, + }}, + } + m.Moq.Moq = m + + scene.AddMoq(m) + return m +} + +// Mock returns the mock implementation of the GenericResults type +func (m *MoqGenericResults[S, E]) Mock() *MoqGenericResults_mock[S, E] { return m.Moq } + +func (m *MoqGenericResults_mock[S, E]) Usual(param1 string, param2 bool) (result1 S, result2 E) { + m.Moq.Scene.T.Helper() + params := MoqGenericResults_Usual_params[S, E]{ + Param1: param1, + Param2: param2, + } + var results *MoqGenericResults_Usual_results[S, E] + for _, resultsByParams := range m.Moq.ResultsByParams_Usual { + paramsKey := m.Moq.ParamsKey_Usual(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_Usual(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_Usual(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_Usual(params)) + } + } + + if result.DoFn != nil { + result.DoFn(param1, param2) + } + + if result.Values != nil { + result1 = result.Values.Result1 + result2 = result.Values.Result2 + } + if result.DoReturnFn != nil { + result1, result2 = result.DoReturnFn(param1, param2) + } + return +} + +// OnCall returns the recorder implementation of the GenericResults type +func (m *MoqGenericResults[S, E]) OnCall() *MoqGenericResults_recorder[S, E] { + return &MoqGenericResults_recorder[S, E]{ + Moq: m, + } +} + +func (m *MoqGenericResults_recorder[S, E]) Usual(param1 string, param2 bool) *MoqGenericResults_Usual_fnRecorder[S, E] { + return &MoqGenericResults_Usual_fnRecorder[S, E]{ + Params: MoqGenericResults_Usual_params[S, E]{ + Param1: param1, + Param2: param2, }, Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, Moq: m.Moq, } } -func (r *MoqUsual_InterfaceParam_fnRecorder) Any() *MoqUsual_InterfaceParam_anyParams { +func (r *MoqGenericResults_Usual_fnRecorder[S, E]) Any() *MoqGenericResults_Usual_anyParams[S, E] { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_InterfaceParam(r.Params)) + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) return nil } - return &MoqUsual_InterfaceParam_anyParams{Recorder: r} + return &MoqGenericResults_Usual_anyParams[S, E]{Recorder: r} } -func (a *MoqUsual_InterfaceParam_anyParams) W() *MoqUsual_InterfaceParam_fnRecorder { +func (a *MoqGenericResults_Usual_anyParams[S, E]) Param1() *MoqGenericResults_Usual_fnRecorder[S, E] { a.Recorder.AnyParams |= 1 << 0 return a.Recorder } -func (r *MoqUsual_InterfaceParam_fnRecorder) Seq() *MoqUsual_InterfaceParam_fnRecorder { +func (a *MoqGenericResults_Usual_anyParams[S, E]) Param2() *MoqGenericResults_Usual_fnRecorder[S, E] { + a.Recorder.AnyParams |= 1 << 1 + return a.Recorder +} + +func (r *MoqGenericResults_Usual_fnRecorder[S, E]) Seq() *MoqGenericResults_Usual_fnRecorder[S, E] { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_InterfaceParam(r.Params)) + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) return nil } r.Sequence = true return r } -func (r *MoqUsual_InterfaceParam_fnRecorder) NoSeq() *MoqUsual_InterfaceParam_fnRecorder { +func (r *MoqGenericResults_Usual_fnRecorder[S, E]) NoSeq() *MoqGenericResults_Usual_fnRecorder[S, E] { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_InterfaceParam(r.Params)) + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) return nil } r.Sequence = false return r } -func (r *MoqUsual_InterfaceParam_fnRecorder) ReturnResults(sResult string, err error) *MoqUsual_InterfaceParam_fnRecorder { +func (r *MoqGenericResults_Usual_fnRecorder[S, E]) ReturnResults(result1 S, result2 E) *MoqGenericResults_Usual_fnRecorder[S, E] { r.Moq.Scene.T.Helper() r.FindResults() @@ -14266,26 +18885,26 @@ func (r *MoqUsual_InterfaceParam_fnRecorder) ReturnResults(sResult string, err e r.Results.Results = append(r.Results.Results, struct { Values *struct { - SResult string - Err error + Result1 S + Result2 E } Sequence uint32 - DoFn MoqUsual_InterfaceParam_doFn - DoReturnFn MoqUsual_InterfaceParam_doReturnFn + DoFn MoqGenericResults_Usual_doFn[S, E] + DoReturnFn MoqGenericResults_Usual_doReturnFn[S, E] }{ Values: &struct { - SResult string - Err error + Result1 S + Result2 E }{ - SResult: sResult, - Err: err, + Result1: result1, + Result2: result2, }, Sequence: sequence, }) return r } -func (r *MoqUsual_InterfaceParam_fnRecorder) AndDo(fn MoqUsual_InterfaceParam_doFn) *MoqUsual_InterfaceParam_fnRecorder { +func (r *MoqGenericResults_Usual_fnRecorder[S, E]) AndDo(fn MoqGenericResults_Usual_doFn[S, E]) *MoqGenericResults_Usual_fnRecorder[S, E] { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") @@ -14296,7 +18915,7 @@ func (r *MoqUsual_InterfaceParam_fnRecorder) AndDo(fn MoqUsual_InterfaceParam_do return r } -func (r *MoqUsual_InterfaceParam_fnRecorder) DoReturnResults(fn MoqUsual_InterfaceParam_doReturnFn) *MoqUsual_InterfaceParam_fnRecorder { +func (r *MoqGenericResults_Usual_fnRecorder[S, E]) DoReturnResults(fn MoqGenericResults_Usual_doReturnFn[S, E]) *MoqGenericResults_Usual_fnRecorder[S, E] { r.Moq.Scene.T.Helper() r.FindResults() @@ -14307,17 +18926,17 @@ func (r *MoqUsual_InterfaceParam_fnRecorder) DoReturnResults(fn MoqUsual_Interfa r.Results.Results = append(r.Results.Results, struct { Values *struct { - SResult string - Err error + Result1 S + Result2 E } Sequence uint32 - DoFn MoqUsual_InterfaceParam_doFn - DoReturnFn MoqUsual_InterfaceParam_doReturnFn + DoFn MoqGenericResults_Usual_doFn[S, E] + DoReturnFn MoqGenericResults_Usual_doReturnFn[S, E] }{Sequence: sequence, DoReturnFn: fn}) return r } -func (r *MoqUsual_InterfaceParam_fnRecorder) FindResults() { +func (r *MoqGenericResults_Usual_fnRecorder[S, E]) FindResults() { r.Moq.Scene.T.Helper() if r.Results != nil { r.Results.Repeat.Increment(r.Moq.Scene.T) @@ -14326,8 +18945,8 @@ func (r *MoqUsual_InterfaceParam_fnRecorder) FindResults() { anyCount := bits.OnesCount64(r.AnyParams) insertAt := -1 - var results *MoqUsual_InterfaceParam_resultsByParams - for n, res := range r.Moq.ResultsByParams_InterfaceParam { + var results *MoqGenericResults_Usual_resultsByParams[S, E] + for n, res := range r.Moq.ResultsByParams_Usual { if res.AnyParams == r.AnyParams { results = &res break @@ -14337,24 +18956,24 @@ func (r *MoqUsual_InterfaceParam_fnRecorder) FindResults() { } } if results == nil { - results = &MoqUsual_InterfaceParam_resultsByParams{ + results = &MoqGenericResults_Usual_resultsByParams[S, E]{ AnyCount: anyCount, AnyParams: r.AnyParams, - Results: map[MoqUsual_InterfaceParam_paramsKey]*MoqUsual_InterfaceParam_results{}, + Results: map[MoqGenericResults_Usual_paramsKey[S, E]]*MoqGenericResults_Usual_results[S, E]{}, } - r.Moq.ResultsByParams_InterfaceParam = append(r.Moq.ResultsByParams_InterfaceParam, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_InterfaceParam) { - copy(r.Moq.ResultsByParams_InterfaceParam[insertAt+1:], r.Moq.ResultsByParams_InterfaceParam[insertAt:0]) - r.Moq.ResultsByParams_InterfaceParam[insertAt] = *results + r.Moq.ResultsByParams_Usual = append(r.Moq.ResultsByParams_Usual, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_Usual) { + copy(r.Moq.ResultsByParams_Usual[insertAt+1:], r.Moq.ResultsByParams_Usual[insertAt:0]) + r.Moq.ResultsByParams_Usual[insertAt] = *results } } - paramsKey := r.Moq.ParamsKey_InterfaceParam(r.Params, r.AnyParams) + paramsKey := r.Moq.ParamsKey_Usual(r.Params, r.AnyParams) var ok bool r.Results, ok = results.Results[paramsKey] if !ok { - r.Results = &MoqUsual_InterfaceParam_results{ + r.Results = &MoqGenericResults_Usual_results[S, E]{ Params: r.Params, Results: nil, Index: 0, @@ -14366,7 +18985,7 @@ func (r *MoqUsual_InterfaceParam_fnRecorder) FindResults() { r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (r *MoqUsual_InterfaceParam_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_InterfaceParam_fnRecorder { +func (r *MoqGenericResults_Usual_fnRecorder[S, E]) Repeat(repeaters ...moq.Repeater) *MoqGenericResults_Usual_fnRecorder[S, E] { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") @@ -14378,12 +18997,12 @@ func (r *MoqUsual_InterfaceParam_fnRecorder) Repeat(repeaters ...moq.Repeater) * if r.Sequence { last = struct { Values *struct { - SResult string - Err error + Result1 S + Result2 E } Sequence uint32 - DoFn MoqUsual_InterfaceParam_doFn - DoReturnFn MoqUsual_InterfaceParam_doReturnFn + DoFn MoqGenericResults_Usual_doFn[S, E] + DoReturnFn MoqGenericResults_Usual_doReturnFn[S, E] }{ Values: last.Values, Sequence: r.Moq.Scene.NextRecorderSequence(), @@ -14394,82 +19013,323 @@ func (r *MoqUsual_InterfaceParam_fnRecorder) Repeat(repeaters ...moq.Repeater) * return r } -func (m *MoqUsual) PrettyParams_InterfaceParam(params MoqUsual_InterfaceParam_params) string { - return fmt.Sprintf("InterfaceParam(%#v)", params.W) +func (m *MoqGenericResults[S, E]) PrettyParams_Usual(params MoqGenericResults_Usual_params[S, E]) string { + return fmt.Sprintf("Usual(%#v, %#v)", params.Param1, params.Param2) } -func (m *MoqUsual) ParamsKey_InterfaceParam(params MoqUsual_InterfaceParam_params, anyParams uint64) MoqUsual_InterfaceParam_paramsKey { +func (m *MoqGenericResults[S, E]) ParamsKey_Usual(params MoqGenericResults_Usual_params[S, E], anyParams uint64) MoqGenericResults_Usual_paramsKey[S, E] { m.Scene.T.Helper() - var wUsed io.Writer - var wUsedHash hash.Hash + var param1Used string + var param1UsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.Runtime.ParameterIndexing.InterfaceParam.W == moq.ParamIndexByValue { - wUsed = params.W + if m.Runtime.ParameterIndexing.Usual.Param1 == moq.ParamIndexByValue { + param1Used = params.Param1 } else { - wUsedHash = hash.DeepHash(params.W) + param1UsedHash = hash.DeepHash(params.Param1) } } - return MoqUsual_InterfaceParam_paramsKey{ - Params: struct{ W io.Writer }{ - W: wUsed, + var param2Used bool + var param2UsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.Runtime.ParameterIndexing.Usual.Param2 == moq.ParamIndexByValue { + param2Used = params.Param2 + } else { + param2UsedHash = hash.DeepHash(params.Param2) + } + } + return MoqGenericResults_Usual_paramsKey[S, E]{ + Params: struct { + Param1 string + Param2 bool + }{ + Param1: param1Used, + Param2: param2Used, }, - Hashes: struct{ W hash.Hash }{ - W: wUsedHash, + Hashes: struct { + Param1 hash.Hash + Param2 hash.Hash + }{ + Param1: param1UsedHash, + Param2: param2UsedHash, }, } } -func (m *MoqUsual_recorder) InterfaceResult(sParam string, bParam bool) *MoqUsual_InterfaceResult_fnRecorder { - return &MoqUsual_InterfaceResult_fnRecorder{ - Params: MoqUsual_InterfaceResult_params{ - SParam: sParam, - BParam: bParam, +// Reset resets the state of the moq +func (m *MoqGenericResults[S, E]) Reset() { m.ResultsByParams_Usual = nil } + +// AssertExpectationsMet asserts that all expectations have been met +func (m *MoqGenericResults[S, E]) AssertExpectationsMet() { + m.Scene.T.Helper() + for _, res := range m.ResultsByParams_Usual { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_Usual(results.Params)) + } + } + } +} + +// The following type assertion assures that testmoqs.PartialGenericResults is +// mocked completely +var _ testmoqs.PartialGenericResults[string] = (*MoqPartialGenericResults_mock[string])(nil) + +// MoqPartialGenericResults holds the state of a moq of the +// PartialGenericResults type +type MoqPartialGenericResults[S ~string] struct { + Scene *moq.Scene + Config moq.Config + Moq *MoqPartialGenericResults_mock[S] + + ResultsByParams_Usual []MoqPartialGenericResults_Usual_resultsByParams[S] + + Runtime struct { + ParameterIndexing struct { + Usual struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } + } + } + // MoqPartialGenericResults_mock isolates the mock interface of the +} + +// PartialGenericResults type +type MoqPartialGenericResults_mock[S ~string] struct { + Moq *MoqPartialGenericResults[S] +} + +// MoqPartialGenericResults_recorder isolates the recorder interface of the +// PartialGenericResults type +type MoqPartialGenericResults_recorder[S ~string] struct { + Moq *MoqPartialGenericResults[S] +} + +// MoqPartialGenericResults_Usual_params holds the params of the +// PartialGenericResults type +type MoqPartialGenericResults_Usual_params[S ~string] struct { + Param1 string + Param2 bool +} + +// MoqPartialGenericResults_Usual_paramsKey holds the map key params of the +// PartialGenericResults type +type MoqPartialGenericResults_Usual_paramsKey[S ~string] struct { + Params struct { + Param1 string + Param2 bool + } + Hashes struct { + Param1 hash.Hash + Param2 hash.Hash + } +} + +// MoqPartialGenericResults_Usual_resultsByParams contains the results for a +// given set of parameters for the PartialGenericResults type +type MoqPartialGenericResults_Usual_resultsByParams[S ~string] struct { + AnyCount int + AnyParams uint64 + Results map[MoqPartialGenericResults_Usual_paramsKey[S]]*MoqPartialGenericResults_Usual_results[S] +} + +// MoqPartialGenericResults_Usual_doFn defines the type of function needed when +// calling AndDo for the PartialGenericResults type +type MoqPartialGenericResults_Usual_doFn[S ~string] func(string, bool) + +// MoqPartialGenericResults_Usual_doReturnFn defines the type of function +// needed when calling DoReturnResults for the PartialGenericResults type +type MoqPartialGenericResults_Usual_doReturnFn[S ~string] func(string, bool) (S, error) + +// MoqPartialGenericResults_Usual_results holds the results of the +// PartialGenericResults type +type MoqPartialGenericResults_Usual_results[S ~string] struct { + Params MoqPartialGenericResults_Usual_params[S] + Results []struct { + Values *struct { + Result1 S + Result2 error + } + Sequence uint32 + DoFn MoqPartialGenericResults_Usual_doFn[S] + DoReturnFn MoqPartialGenericResults_Usual_doReturnFn[S] + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqPartialGenericResults_Usual_fnRecorder routes recorded function calls to +// the MoqPartialGenericResults moq +type MoqPartialGenericResults_Usual_fnRecorder[S ~string] struct { + Params MoqPartialGenericResults_Usual_params[S] + AnyParams uint64 + Sequence bool + Results *MoqPartialGenericResults_Usual_results[S] + Moq *MoqPartialGenericResults[S] +} + +// MoqPartialGenericResults_Usual_anyParams isolates the any params functions +// of the PartialGenericResults type +type MoqPartialGenericResults_Usual_anyParams[S ~string] struct { + Recorder *MoqPartialGenericResults_Usual_fnRecorder[S] +} + +// NewMoqPartialGenericResults creates a new moq of the PartialGenericResults +// type +func NewMoqPartialGenericResults[S ~string](scene *moq.Scene, config *moq.Config) *MoqPartialGenericResults[S] { + if config == nil { + config = &moq.Config{} + } + m := &MoqPartialGenericResults[S]{ + Scene: scene, + Config: *config, + Moq: &MoqPartialGenericResults_mock[S]{}, + + Runtime: struct { + ParameterIndexing struct { + Usual struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } + } + }{ParameterIndexing: struct { + Usual struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + } + }{ + Usual: struct { + Param1 moq.ParamIndexing + Param2 moq.ParamIndexing + }{ + Param1: moq.ParamIndexByValue, + Param2: moq.ParamIndexByValue, + }, + }}, + } + m.Moq.Moq = m + + scene.AddMoq(m) + return m +} + +// Mock returns the mock implementation of the PartialGenericResults type +func (m *MoqPartialGenericResults[S]) Mock() *MoqPartialGenericResults_mock[S] { return m.Moq } + +func (m *MoqPartialGenericResults_mock[S]) Usual(param1 string, param2 bool) (result1 S, result2 error) { + m.Moq.Scene.T.Helper() + params := MoqPartialGenericResults_Usual_params[S]{ + Param1: param1, + Param2: param2, + } + var results *MoqPartialGenericResults_Usual_results[S] + for _, resultsByParams := range m.Moq.ResultsByParams_Usual { + paramsKey := m.Moq.ParamsKey_Usual(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_Usual(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_Usual(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_Usual(params)) + } + } + + if result.DoFn != nil { + result.DoFn(param1, param2) + } + + if result.Values != nil { + result1 = result.Values.Result1 + result2 = result.Values.Result2 + } + if result.DoReturnFn != nil { + result1, result2 = result.DoReturnFn(param1, param2) + } + return +} + +// OnCall returns the recorder implementation of the PartialGenericResults type +func (m *MoqPartialGenericResults[S]) OnCall() *MoqPartialGenericResults_recorder[S] { + return &MoqPartialGenericResults_recorder[S]{ + Moq: m, + } +} + +func (m *MoqPartialGenericResults_recorder[S]) Usual(param1 string, param2 bool) *MoqPartialGenericResults_Usual_fnRecorder[S] { + return &MoqPartialGenericResults_Usual_fnRecorder[S]{ + Params: MoqPartialGenericResults_Usual_params[S]{ + Param1: param1, + Param2: param2, }, Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, Moq: m.Moq, } } -func (r *MoqUsual_InterfaceResult_fnRecorder) Any() *MoqUsual_InterfaceResult_anyParams { +func (r *MoqPartialGenericResults_Usual_fnRecorder[S]) Any() *MoqPartialGenericResults_Usual_anyParams[S] { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_InterfaceResult(r.Params)) + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) return nil } - return &MoqUsual_InterfaceResult_anyParams{Recorder: r} + return &MoqPartialGenericResults_Usual_anyParams[S]{Recorder: r} } -func (a *MoqUsual_InterfaceResult_anyParams) SParam() *MoqUsual_InterfaceResult_fnRecorder { +func (a *MoqPartialGenericResults_Usual_anyParams[S]) Param1() *MoqPartialGenericResults_Usual_fnRecorder[S] { a.Recorder.AnyParams |= 1 << 0 return a.Recorder } -func (a *MoqUsual_InterfaceResult_anyParams) BParam() *MoqUsual_InterfaceResult_fnRecorder { +func (a *MoqPartialGenericResults_Usual_anyParams[S]) Param2() *MoqPartialGenericResults_Usual_fnRecorder[S] { a.Recorder.AnyParams |= 1 << 1 return a.Recorder } -func (r *MoqUsual_InterfaceResult_fnRecorder) Seq() *MoqUsual_InterfaceResult_fnRecorder { +func (r *MoqPartialGenericResults_Usual_fnRecorder[S]) Seq() *MoqPartialGenericResults_Usual_fnRecorder[S] { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_InterfaceResult(r.Params)) + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) return nil } r.Sequence = true return r } -func (r *MoqUsual_InterfaceResult_fnRecorder) NoSeq() *MoqUsual_InterfaceResult_fnRecorder { +func (r *MoqPartialGenericResults_Usual_fnRecorder[S]) NoSeq() *MoqPartialGenericResults_Usual_fnRecorder[S] { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_InterfaceResult(r.Params)) + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) return nil } r.Sequence = false return r } -func (r *MoqUsual_InterfaceResult_fnRecorder) ReturnResults(result1 io.Reader) *MoqUsual_InterfaceResult_fnRecorder { +func (r *MoqPartialGenericResults_Usual_fnRecorder[S]) ReturnResults(result1 S, result2 error) *MoqPartialGenericResults_Usual_fnRecorder[S] { r.Moq.Scene.T.Helper() r.FindResults() @@ -14479,20 +19339,27 @@ func (r *MoqUsual_InterfaceResult_fnRecorder) ReturnResults(result1 io.Reader) * } r.Results.Results = append(r.Results.Results, struct { - Values *struct{ Result1 io.Reader } + Values *struct { + Result1 S + Result2 error + } Sequence uint32 - DoFn MoqUsual_InterfaceResult_doFn - DoReturnFn MoqUsual_InterfaceResult_doReturnFn + DoFn MoqPartialGenericResults_Usual_doFn[S] + DoReturnFn MoqPartialGenericResults_Usual_doReturnFn[S] }{ - Values: &struct{ Result1 io.Reader }{ + Values: &struct { + Result1 S + Result2 error + }{ Result1: result1, + Result2: result2, }, Sequence: sequence, }) return r } -func (r *MoqUsual_InterfaceResult_fnRecorder) AndDo(fn MoqUsual_InterfaceResult_doFn) *MoqUsual_InterfaceResult_fnRecorder { +func (r *MoqPartialGenericResults_Usual_fnRecorder[S]) AndDo(fn MoqPartialGenericResults_Usual_doFn[S]) *MoqPartialGenericResults_Usual_fnRecorder[S] { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") @@ -14503,7 +19370,7 @@ func (r *MoqUsual_InterfaceResult_fnRecorder) AndDo(fn MoqUsual_InterfaceResult_ return r } -func (r *MoqUsual_InterfaceResult_fnRecorder) DoReturnResults(fn MoqUsual_InterfaceResult_doReturnFn) *MoqUsual_InterfaceResult_fnRecorder { +func (r *MoqPartialGenericResults_Usual_fnRecorder[S]) DoReturnResults(fn MoqPartialGenericResults_Usual_doReturnFn[S]) *MoqPartialGenericResults_Usual_fnRecorder[S] { r.Moq.Scene.T.Helper() r.FindResults() @@ -14513,15 +19380,18 @@ func (r *MoqUsual_InterfaceResult_fnRecorder) DoReturnResults(fn MoqUsual_Interf } r.Results.Results = append(r.Results.Results, struct { - Values *struct{ Result1 io.Reader } + Values *struct { + Result1 S + Result2 error + } Sequence uint32 - DoFn MoqUsual_InterfaceResult_doFn - DoReturnFn MoqUsual_InterfaceResult_doReturnFn + DoFn MoqPartialGenericResults_Usual_doFn[S] + DoReturnFn MoqPartialGenericResults_Usual_doReturnFn[S] }{Sequence: sequence, DoReturnFn: fn}) return r } -func (r *MoqUsual_InterfaceResult_fnRecorder) FindResults() { +func (r *MoqPartialGenericResults_Usual_fnRecorder[S]) FindResults() { r.Moq.Scene.T.Helper() if r.Results != nil { r.Results.Repeat.Increment(r.Moq.Scene.T) @@ -14530,8 +19400,8 @@ func (r *MoqUsual_InterfaceResult_fnRecorder) FindResults() { anyCount := bits.OnesCount64(r.AnyParams) insertAt := -1 - var results *MoqUsual_InterfaceResult_resultsByParams - for n, res := range r.Moq.ResultsByParams_InterfaceResult { + var results *MoqPartialGenericResults_Usual_resultsByParams[S] + for n, res := range r.Moq.ResultsByParams_Usual { if res.AnyParams == r.AnyParams { results = &res break @@ -14541,24 +19411,24 @@ func (r *MoqUsual_InterfaceResult_fnRecorder) FindResults() { } } if results == nil { - results = &MoqUsual_InterfaceResult_resultsByParams{ + results = &MoqPartialGenericResults_Usual_resultsByParams[S]{ AnyCount: anyCount, AnyParams: r.AnyParams, - Results: map[MoqUsual_InterfaceResult_paramsKey]*MoqUsual_InterfaceResult_results{}, + Results: map[MoqPartialGenericResults_Usual_paramsKey[S]]*MoqPartialGenericResults_Usual_results[S]{}, } - r.Moq.ResultsByParams_InterfaceResult = append(r.Moq.ResultsByParams_InterfaceResult, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_InterfaceResult) { - copy(r.Moq.ResultsByParams_InterfaceResult[insertAt+1:], r.Moq.ResultsByParams_InterfaceResult[insertAt:0]) - r.Moq.ResultsByParams_InterfaceResult[insertAt] = *results + r.Moq.ResultsByParams_Usual = append(r.Moq.ResultsByParams_Usual, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_Usual) { + copy(r.Moq.ResultsByParams_Usual[insertAt+1:], r.Moq.ResultsByParams_Usual[insertAt:0]) + r.Moq.ResultsByParams_Usual[insertAt] = *results } } - paramsKey := r.Moq.ParamsKey_InterfaceResult(r.Params, r.AnyParams) + paramsKey := r.Moq.ParamsKey_Usual(r.Params, r.AnyParams) var ok bool r.Results, ok = results.Results[paramsKey] if !ok { - r.Results = &MoqUsual_InterfaceResult_results{ + r.Results = &MoqPartialGenericResults_Usual_results[S]{ Params: r.Params, Results: nil, Index: 0, @@ -14570,7 +19440,7 @@ func (r *MoqUsual_InterfaceResult_fnRecorder) FindResults() { r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (r *MoqUsual_InterfaceResult_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_InterfaceResult_fnRecorder { +func (r *MoqPartialGenericResults_Usual_fnRecorder[S]) Repeat(repeaters ...moq.Repeater) *MoqPartialGenericResults_Usual_fnRecorder[S] { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") @@ -14581,10 +19451,13 @@ func (r *MoqUsual_InterfaceResult_fnRecorder) Repeat(repeaters ...moq.Repeater) for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { if r.Sequence { last = struct { - Values *struct{ Result1 io.Reader } + Values *struct { + Result1 S + Result2 error + } Sequence uint32 - DoFn MoqUsual_InterfaceResult_doFn - DoReturnFn MoqUsual_InterfaceResult_doReturnFn + DoFn MoqPartialGenericResults_Usual_doFn[S] + DoReturnFn MoqPartialGenericResults_Usual_doReturnFn[S] }{ Values: last.Values, Sequence: r.Moq.Scene.NextRecorderSequence(), @@ -14595,93 +19468,302 @@ func (r *MoqUsual_InterfaceResult_fnRecorder) Repeat(repeaters ...moq.Repeater) return r } -func (m *MoqUsual) PrettyParams_InterfaceResult(params MoqUsual_InterfaceResult_params) string { - return fmt.Sprintf("InterfaceResult(%#v, %#v)", params.SParam, params.BParam) +func (m *MoqPartialGenericResults[S]) PrettyParams_Usual(params MoqPartialGenericResults_Usual_params[S]) string { + return fmt.Sprintf("Usual(%#v, %#v)", params.Param1, params.Param2) } -func (m *MoqUsual) ParamsKey_InterfaceResult(params MoqUsual_InterfaceResult_params, anyParams uint64) MoqUsual_InterfaceResult_paramsKey { +func (m *MoqPartialGenericResults[S]) ParamsKey_Usual(params MoqPartialGenericResults_Usual_params[S], anyParams uint64) MoqPartialGenericResults_Usual_paramsKey[S] { m.Scene.T.Helper() - var sParamUsed string - var sParamUsedHash hash.Hash + var param1Used string + var param1UsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.Runtime.ParameterIndexing.InterfaceResult.SParam == moq.ParamIndexByValue { - sParamUsed = params.SParam + if m.Runtime.ParameterIndexing.Usual.Param1 == moq.ParamIndexByValue { + param1Used = params.Param1 } else { - sParamUsedHash = hash.DeepHash(params.SParam) + param1UsedHash = hash.DeepHash(params.Param1) } } - var bParamUsed bool - var bParamUsedHash hash.Hash + var param2Used bool + var param2UsedHash hash.Hash if anyParams&(1<<1) == 0 { - if m.Runtime.ParameterIndexing.InterfaceResult.BParam == moq.ParamIndexByValue { - bParamUsed = params.BParam + if m.Runtime.ParameterIndexing.Usual.Param2 == moq.ParamIndexByValue { + param2Used = params.Param2 } else { - bParamUsedHash = hash.DeepHash(params.BParam) + param2UsedHash = hash.DeepHash(params.Param2) } } - return MoqUsual_InterfaceResult_paramsKey{ + return MoqPartialGenericResults_Usual_paramsKey[S]{ Params: struct { - SParam string - BParam bool + Param1 string + Param2 bool }{ - SParam: sParamUsed, - BParam: bParamUsed, + Param1: param1Used, + Param2: param2Used, }, Hashes: struct { - SParam hash.Hash - BParam hash.Hash + Param1 hash.Hash + Param2 hash.Hash }{ - SParam: sParamUsedHash, - BParam: bParamUsedHash, + Param1: param1UsedHash, + Param2: param2UsedHash, }, } } -func (m *MoqUsual_recorder) FnParam(fn func()) *MoqUsual_FnParam_fnRecorder { - return &MoqUsual_FnParam_fnRecorder{ - Params: MoqUsual_FnParam_params{ - Fn: fn, +// Reset resets the state of the moq +func (m *MoqPartialGenericResults[S]) Reset() { m.ResultsByParams_Usual = nil } + +// AssertExpectationsMet asserts that all expectations have been met +func (m *MoqPartialGenericResults[S]) AssertExpectationsMet() { + m.Scene.T.Helper() + for _, res := range m.ResultsByParams_Usual { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_Usual(results.Params)) + } + } + } +} + +// The following type assertion assures that testmoqs.GenericInterfaceParam is +// mocked completely +var _ testmoqs.GenericInterfaceParam[testmoqs.MyWriter] = (*MoqGenericInterfaceParam_mock[testmoqs.MyWriter])(nil) + +// MoqGenericInterfaceParam holds the state of a moq of the +// GenericInterfaceParam type +type MoqGenericInterfaceParam[W testmoqs.MyWriter] struct { + Scene *moq.Scene + Config moq.Config + Moq *MoqGenericInterfaceParam_mock[W] + + ResultsByParams_Usual []MoqGenericInterfaceParam_Usual_resultsByParams[W] + + Runtime struct { + ParameterIndexing struct { + Usual struct { + W moq.ParamIndexing + } + } + } + // MoqGenericInterfaceParam_mock isolates the mock interface of the +} + +// GenericInterfaceParam type +type MoqGenericInterfaceParam_mock[W testmoqs.MyWriter] struct { + Moq *MoqGenericInterfaceParam[W] +} + +// MoqGenericInterfaceParam_recorder isolates the recorder interface of the +// GenericInterfaceParam type +type MoqGenericInterfaceParam_recorder[W testmoqs.MyWriter] struct { + Moq *MoqGenericInterfaceParam[W] +} + +// MoqGenericInterfaceParam_Usual_params holds the params of the +// GenericInterfaceParam type +type MoqGenericInterfaceParam_Usual_params[W testmoqs.MyWriter] struct{ W W } + +// MoqGenericInterfaceParam_Usual_paramsKey holds the map key params of the +// GenericInterfaceParam type +type MoqGenericInterfaceParam_Usual_paramsKey[W testmoqs.MyWriter] struct { + Params struct{} + Hashes struct{ W hash.Hash } +} + +// MoqGenericInterfaceParam_Usual_resultsByParams contains the results for a +// given set of parameters for the GenericInterfaceParam type +type MoqGenericInterfaceParam_Usual_resultsByParams[W testmoqs.MyWriter] struct { + AnyCount int + AnyParams uint64 + Results map[MoqGenericInterfaceParam_Usual_paramsKey[W]]*MoqGenericInterfaceParam_Usual_results[W] +} + +// MoqGenericInterfaceParam_Usual_doFn defines the type of function needed when +// calling AndDo for the GenericInterfaceParam type +type MoqGenericInterfaceParam_Usual_doFn[W testmoqs.MyWriter] func(w W) + +// MoqGenericInterfaceParam_Usual_doReturnFn defines the type of function +// needed when calling DoReturnResults for the GenericInterfaceParam type +type MoqGenericInterfaceParam_Usual_doReturnFn[W testmoqs.MyWriter] func(w W) (sResult string, err error) + +// MoqGenericInterfaceParam_Usual_results holds the results of the +// GenericInterfaceParam type +type MoqGenericInterfaceParam_Usual_results[W testmoqs.MyWriter] struct { + Params MoqGenericInterfaceParam_Usual_params[W] + Results []struct { + Values *struct { + SResult string + Err error + } + Sequence uint32 + DoFn MoqGenericInterfaceParam_Usual_doFn[W] + DoReturnFn MoqGenericInterfaceParam_Usual_doReturnFn[W] + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqGenericInterfaceParam_Usual_fnRecorder routes recorded function calls to +// the MoqGenericInterfaceParam moq +type MoqGenericInterfaceParam_Usual_fnRecorder[W testmoqs.MyWriter] struct { + Params MoqGenericInterfaceParam_Usual_params[W] + AnyParams uint64 + Sequence bool + Results *MoqGenericInterfaceParam_Usual_results[W] + Moq *MoqGenericInterfaceParam[W] +} + +// MoqGenericInterfaceParam_Usual_anyParams isolates the any params functions +// of the GenericInterfaceParam type +type MoqGenericInterfaceParam_Usual_anyParams[W testmoqs.MyWriter] struct { + Recorder *MoqGenericInterfaceParam_Usual_fnRecorder[W] +} + +// NewMoqGenericInterfaceParam creates a new moq of the GenericInterfaceParam +// type +func NewMoqGenericInterfaceParam[W testmoqs.MyWriter](scene *moq.Scene, config *moq.Config) *MoqGenericInterfaceParam[W] { + if config == nil { + config = &moq.Config{} + } + m := &MoqGenericInterfaceParam[W]{ + Scene: scene, + Config: *config, + Moq: &MoqGenericInterfaceParam_mock[W]{}, + + Runtime: struct { + ParameterIndexing struct { + Usual struct { + W moq.ParamIndexing + } + } + }{ParameterIndexing: struct { + Usual struct { + W moq.ParamIndexing + } + }{ + Usual: struct { + W moq.ParamIndexing + }{ + W: moq.ParamIndexByHash, + }, + }}, + } + m.Moq.Moq = m + + scene.AddMoq(m) + return m +} + +// Mock returns the mock implementation of the GenericInterfaceParam type +func (m *MoqGenericInterfaceParam[W]) Mock() *MoqGenericInterfaceParam_mock[W] { return m.Moq } + +func (m *MoqGenericInterfaceParam_mock[W]) Usual(w W) (sResult string, err error) { + m.Moq.Scene.T.Helper() + params := MoqGenericInterfaceParam_Usual_params[W]{ + W: w, + } + var results *MoqGenericInterfaceParam_Usual_results[W] + for _, resultsByParams := range m.Moq.ResultsByParams_Usual { + paramsKey := m.Moq.ParamsKey_Usual(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_Usual(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_Usual(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_Usual(params)) + } + } + + if result.DoFn != nil { + result.DoFn(w) + } + + if result.Values != nil { + sResult = result.Values.SResult + err = result.Values.Err + } + if result.DoReturnFn != nil { + sResult, err = result.DoReturnFn(w) + } + return +} + +// OnCall returns the recorder implementation of the GenericInterfaceParam type +func (m *MoqGenericInterfaceParam[W]) OnCall() *MoqGenericInterfaceParam_recorder[W] { + return &MoqGenericInterfaceParam_recorder[W]{ + Moq: m, + } +} + +func (m *MoqGenericInterfaceParam_recorder[W]) Usual(w W) *MoqGenericInterfaceParam_Usual_fnRecorder[W] { + return &MoqGenericInterfaceParam_Usual_fnRecorder[W]{ + Params: MoqGenericInterfaceParam_Usual_params[W]{ + W: w, }, Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, Moq: m.Moq, } } -func (r *MoqUsual_FnParam_fnRecorder) Any() *MoqUsual_FnParam_anyParams { +func (r *MoqGenericInterfaceParam_Usual_fnRecorder[W]) Any() *MoqGenericInterfaceParam_Usual_anyParams[W] { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_FnParam(r.Params)) + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) return nil } - return &MoqUsual_FnParam_anyParams{Recorder: r} + return &MoqGenericInterfaceParam_Usual_anyParams[W]{Recorder: r} } -func (a *MoqUsual_FnParam_anyParams) Fn() *MoqUsual_FnParam_fnRecorder { +func (a *MoqGenericInterfaceParam_Usual_anyParams[W]) W() *MoqGenericInterfaceParam_Usual_fnRecorder[W] { a.Recorder.AnyParams |= 1 << 0 return a.Recorder } -func (r *MoqUsual_FnParam_fnRecorder) Seq() *MoqUsual_FnParam_fnRecorder { +func (r *MoqGenericInterfaceParam_Usual_fnRecorder[W]) Seq() *MoqGenericInterfaceParam_Usual_fnRecorder[W] { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_FnParam(r.Params)) + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) return nil } r.Sequence = true return r } -func (r *MoqUsual_FnParam_fnRecorder) NoSeq() *MoqUsual_FnParam_fnRecorder { +func (r *MoqGenericInterfaceParam_Usual_fnRecorder[W]) NoSeq() *MoqGenericInterfaceParam_Usual_fnRecorder[W] { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_FnParam(r.Params)) + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) return nil } r.Sequence = false return r } -func (r *MoqUsual_FnParam_fnRecorder) ReturnResults() *MoqUsual_FnParam_fnRecorder { +func (r *MoqGenericInterfaceParam_Usual_fnRecorder[W]) ReturnResults(sResult string, err error) *MoqGenericInterfaceParam_Usual_fnRecorder[W] { r.Moq.Scene.T.Helper() r.FindResults() @@ -14691,18 +19773,27 @@ func (r *MoqUsual_FnParam_fnRecorder) ReturnResults() *MoqUsual_FnParam_fnRecord } r.Results.Results = append(r.Results.Results, struct { - Values *struct{} + Values *struct { + SResult string + Err error + } Sequence uint32 - DoFn MoqUsual_FnParam_doFn - DoReturnFn MoqUsual_FnParam_doReturnFn + DoFn MoqGenericInterfaceParam_Usual_doFn[W] + DoReturnFn MoqGenericInterfaceParam_Usual_doReturnFn[W] }{ - Values: &struct{}{}, + Values: &struct { + SResult string + Err error + }{ + SResult: sResult, + Err: err, + }, Sequence: sequence, }) return r } -func (r *MoqUsual_FnParam_fnRecorder) AndDo(fn MoqUsual_FnParam_doFn) *MoqUsual_FnParam_fnRecorder { +func (r *MoqGenericInterfaceParam_Usual_fnRecorder[W]) AndDo(fn MoqGenericInterfaceParam_Usual_doFn[W]) *MoqGenericInterfaceParam_Usual_fnRecorder[W] { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") @@ -14713,7 +19804,7 @@ func (r *MoqUsual_FnParam_fnRecorder) AndDo(fn MoqUsual_FnParam_doFn) *MoqUsual_ return r } -func (r *MoqUsual_FnParam_fnRecorder) DoReturnResults(fn MoqUsual_FnParam_doReturnFn) *MoqUsual_FnParam_fnRecorder { +func (r *MoqGenericInterfaceParam_Usual_fnRecorder[W]) DoReturnResults(fn MoqGenericInterfaceParam_Usual_doReturnFn[W]) *MoqGenericInterfaceParam_Usual_fnRecorder[W] { r.Moq.Scene.T.Helper() r.FindResults() @@ -14723,15 +19814,18 @@ func (r *MoqUsual_FnParam_fnRecorder) DoReturnResults(fn MoqUsual_FnParam_doRetu } r.Results.Results = append(r.Results.Results, struct { - Values *struct{} + Values *struct { + SResult string + Err error + } Sequence uint32 - DoFn MoqUsual_FnParam_doFn - DoReturnFn MoqUsual_FnParam_doReturnFn + DoFn MoqGenericInterfaceParam_Usual_doFn[W] + DoReturnFn MoqGenericInterfaceParam_Usual_doReturnFn[W] }{Sequence: sequence, DoReturnFn: fn}) return r } -func (r *MoqUsual_FnParam_fnRecorder) FindResults() { +func (r *MoqGenericInterfaceParam_Usual_fnRecorder[W]) FindResults() { r.Moq.Scene.T.Helper() if r.Results != nil { r.Results.Repeat.Increment(r.Moq.Scene.T) @@ -14740,8 +19834,8 @@ func (r *MoqUsual_FnParam_fnRecorder) FindResults() { anyCount := bits.OnesCount64(r.AnyParams) insertAt := -1 - var results *MoqUsual_FnParam_resultsByParams - for n, res := range r.Moq.ResultsByParams_FnParam { + var results *MoqGenericInterfaceParam_Usual_resultsByParams[W] + for n, res := range r.Moq.ResultsByParams_Usual { if res.AnyParams == r.AnyParams { results = &res break @@ -14751,24 +19845,24 @@ func (r *MoqUsual_FnParam_fnRecorder) FindResults() { } } if results == nil { - results = &MoqUsual_FnParam_resultsByParams{ + results = &MoqGenericInterfaceParam_Usual_resultsByParams[W]{ AnyCount: anyCount, AnyParams: r.AnyParams, - Results: map[MoqUsual_FnParam_paramsKey]*MoqUsual_FnParam_results{}, + Results: map[MoqGenericInterfaceParam_Usual_paramsKey[W]]*MoqGenericInterfaceParam_Usual_results[W]{}, } - r.Moq.ResultsByParams_FnParam = append(r.Moq.ResultsByParams_FnParam, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_FnParam) { - copy(r.Moq.ResultsByParams_FnParam[insertAt+1:], r.Moq.ResultsByParams_FnParam[insertAt:0]) - r.Moq.ResultsByParams_FnParam[insertAt] = *results + r.Moq.ResultsByParams_Usual = append(r.Moq.ResultsByParams_Usual, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_Usual) { + copy(r.Moq.ResultsByParams_Usual[insertAt+1:], r.Moq.ResultsByParams_Usual[insertAt:0]) + r.Moq.ResultsByParams_Usual[insertAt] = *results } } - paramsKey := r.Moq.ParamsKey_FnParam(r.Params, r.AnyParams) + paramsKey := r.Moq.ParamsKey_Usual(r.Params, r.AnyParams) var ok bool r.Results, ok = results.Results[paramsKey] if !ok { - r.Results = &MoqUsual_FnParam_results{ + r.Results = &MoqGenericInterfaceParam_Usual_results[W]{ Params: r.Params, Results: nil, Index: 0, @@ -14780,7 +19874,7 @@ func (r *MoqUsual_FnParam_fnRecorder) FindResults() { r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (r *MoqUsual_FnParam_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_FnParam_fnRecorder { +func (r *MoqGenericInterfaceParam_Usual_fnRecorder[W]) Repeat(repeaters ...moq.Repeater) *MoqGenericInterfaceParam_Usual_fnRecorder[W] { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") @@ -14791,10 +19885,13 @@ func (r *MoqUsual_FnParam_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsua for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { if r.Sequence { last = struct { - Values *struct{} + Values *struct { + SResult string + Err error + } Sequence uint32 - DoFn MoqUsual_FnParam_doFn - DoReturnFn MoqUsual_FnParam_doReturnFn + DoFn MoqGenericInterfaceParam_Usual_doFn[W] + DoReturnFn MoqGenericInterfaceParam_Usual_doReturnFn[W] }{ Values: last.Values, Sequence: r.Moq.Scene.NextRecorderSequence(), @@ -14805,72 +19902,299 @@ func (r *MoqUsual_FnParam_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsua return r } -func (m *MoqUsual) PrettyParams_FnParam(params MoqUsual_FnParam_params) string { - return fmt.Sprintf("FnParam(%#v)", moq.FnString(params.Fn)) +func (m *MoqGenericInterfaceParam[W]) PrettyParams_Usual(params MoqGenericInterfaceParam_Usual_params[W]) string { + return fmt.Sprintf("Usual(%#v)", params.W) } -func (m *MoqUsual) ParamsKey_FnParam(params MoqUsual_FnParam_params, anyParams uint64) MoqUsual_FnParam_paramsKey { +func (m *MoqGenericInterfaceParam[W]) ParamsKey_Usual(params MoqGenericInterfaceParam_Usual_params[W], anyParams uint64) MoqGenericInterfaceParam_Usual_paramsKey[W] { m.Scene.T.Helper() - var fnUsedHash hash.Hash + var wUsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.Runtime.ParameterIndexing.FnParam.Fn == moq.ParamIndexByValue { - m.Scene.T.Fatalf("The fn parameter of the FnParam function can't be indexed by value") + if m.Runtime.ParameterIndexing.Usual.W == moq.ParamIndexByValue { + m.Scene.T.Fatalf("The w parameter of the Usual function can't be indexed by value") } - fnUsedHash = hash.DeepHash(params.Fn) + wUsedHash = hash.DeepHash(params.W) } - return MoqUsual_FnParam_paramsKey{ + return MoqGenericInterfaceParam_Usual_paramsKey[W]{ Params: struct{}{}, - Hashes: struct{ Fn hash.Hash }{ - Fn: fnUsedHash, + Hashes: struct{ W hash.Hash }{ + W: wUsedHash, }, } } -func (m *MoqUsual_recorder) Other(param1 other.Params) *MoqUsual_Other_fnRecorder { - return &MoqUsual_Other_fnRecorder{ - Params: MoqUsual_Other_params{ - Param1: param1, +// Reset resets the state of the moq +func (m *MoqGenericInterfaceParam[W]) Reset() { m.ResultsByParams_Usual = nil } + +// AssertExpectationsMet asserts that all expectations have been met +func (m *MoqGenericInterfaceParam[W]) AssertExpectationsMet() { + m.Scene.T.Helper() + for _, res := range m.ResultsByParams_Usual { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_Usual(results.Params)) + } + } + } +} + +// The following type assertion assures that testmoqs.GenericInterfaceResult is +// mocked completely +var _ testmoqs.GenericInterfaceResult[testmoqs.MyReader] = (*MoqGenericInterfaceResult_mock[testmoqs.MyReader])(nil) + +// MoqGenericInterfaceResult holds the state of a moq of the +// GenericInterfaceResult type +type MoqGenericInterfaceResult[R testmoqs.MyReader] struct { + Scene *moq.Scene + Config moq.Config + Moq *MoqGenericInterfaceResult_mock[R] + + ResultsByParams_Usual []MoqGenericInterfaceResult_Usual_resultsByParams[R] + + Runtime struct { + ParameterIndexing struct { + Usual struct { + SParam moq.ParamIndexing + BParam moq.ParamIndexing + } + } + } + // MoqGenericInterfaceResult_mock isolates the mock interface of the +} + +// GenericInterfaceResult type +type MoqGenericInterfaceResult_mock[R testmoqs.MyReader] struct { + Moq *MoqGenericInterfaceResult[R] +} + +// MoqGenericInterfaceResult_recorder isolates the recorder interface of the +// GenericInterfaceResult type +type MoqGenericInterfaceResult_recorder[R testmoqs.MyReader] struct { + Moq *MoqGenericInterfaceResult[R] +} + +// MoqGenericInterfaceResult_Usual_params holds the params of the +// GenericInterfaceResult type +type MoqGenericInterfaceResult_Usual_params[R testmoqs.MyReader] struct { + SParam string + BParam bool +} + +// MoqGenericInterfaceResult_Usual_paramsKey holds the map key params of the +// GenericInterfaceResult type +type MoqGenericInterfaceResult_Usual_paramsKey[R testmoqs.MyReader] struct { + Params struct { + SParam string + BParam bool + } + Hashes struct { + SParam hash.Hash + BParam hash.Hash + } +} + +// MoqGenericInterfaceResult_Usual_resultsByParams contains the results for a +// given set of parameters for the GenericInterfaceResult type +type MoqGenericInterfaceResult_Usual_resultsByParams[R testmoqs.MyReader] struct { + AnyCount int + AnyParams uint64 + Results map[MoqGenericInterfaceResult_Usual_paramsKey[R]]*MoqGenericInterfaceResult_Usual_results[R] +} + +// MoqGenericInterfaceResult_Usual_doFn defines the type of function needed +// when calling AndDo for the GenericInterfaceResult type +type MoqGenericInterfaceResult_Usual_doFn[R testmoqs.MyReader] func(sParam string, bParam bool) + +// MoqGenericInterfaceResult_Usual_doReturnFn defines the type of function +// needed when calling DoReturnResults for the GenericInterfaceResult type +type MoqGenericInterfaceResult_Usual_doReturnFn[R testmoqs.MyReader] func(sParam string, bParam bool) (r R) + +// MoqGenericInterfaceResult_Usual_results holds the results of the +// GenericInterfaceResult type +type MoqGenericInterfaceResult_Usual_results[R testmoqs.MyReader] struct { + Params MoqGenericInterfaceResult_Usual_params[R] + Results []struct { + Values *struct{ Result1 R } + Sequence uint32 + DoFn MoqGenericInterfaceResult_Usual_doFn[R] + DoReturnFn MoqGenericInterfaceResult_Usual_doReturnFn[R] + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqGenericInterfaceResult_Usual_fnRecorder routes recorded function calls to +// the MoqGenericInterfaceResult moq +type MoqGenericInterfaceResult_Usual_fnRecorder[R testmoqs.MyReader] struct { + Params MoqGenericInterfaceResult_Usual_params[R] + AnyParams uint64 + Sequence bool + Results *MoqGenericInterfaceResult_Usual_results[R] + Moq *MoqGenericInterfaceResult[R] +} + +// MoqGenericInterfaceResult_Usual_anyParams isolates the any params functions +// of the GenericInterfaceResult type +type MoqGenericInterfaceResult_Usual_anyParams[R testmoqs.MyReader] struct { + Recorder *MoqGenericInterfaceResult_Usual_fnRecorder[R] +} + +// NewMoqGenericInterfaceResult creates a new moq of the GenericInterfaceResult +// type +func NewMoqGenericInterfaceResult[R testmoqs.MyReader](scene *moq.Scene, config *moq.Config) *MoqGenericInterfaceResult[R] { + if config == nil { + config = &moq.Config{} + } + m := &MoqGenericInterfaceResult[R]{ + Scene: scene, + Config: *config, + Moq: &MoqGenericInterfaceResult_mock[R]{}, + + Runtime: struct { + ParameterIndexing struct { + Usual struct { + SParam moq.ParamIndexing + BParam moq.ParamIndexing + } + } + }{ParameterIndexing: struct { + Usual struct { + SParam moq.ParamIndexing + BParam moq.ParamIndexing + } + }{ + Usual: struct { + SParam moq.ParamIndexing + BParam moq.ParamIndexing + }{ + SParam: moq.ParamIndexByValue, + BParam: moq.ParamIndexByValue, + }, + }}, + } + m.Moq.Moq = m + + scene.AddMoq(m) + return m +} + +// Mock returns the mock implementation of the GenericInterfaceResult type +func (m *MoqGenericInterfaceResult[R]) Mock() *MoqGenericInterfaceResult_mock[R] { return m.Moq } + +func (m *MoqGenericInterfaceResult_mock[R]) Usual(sParam string, bParam bool) (result1 R) { + m.Moq.Scene.T.Helper() + params := MoqGenericInterfaceResult_Usual_params[R]{ + SParam: sParam, + BParam: bParam, + } + var results *MoqGenericInterfaceResult_Usual_results[R] + for _, resultsByParams := range m.Moq.ResultsByParams_Usual { + paramsKey := m.Moq.ParamsKey_Usual(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_Usual(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_Usual(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_Usual(params)) + } + } + + if result.DoFn != nil { + result.DoFn(sParam, bParam) + } + + if result.Values != nil { + result1 = result.Values.Result1 + } + if result.DoReturnFn != nil { + result1 = result.DoReturnFn(sParam, bParam) + } + return +} + +// OnCall returns the recorder implementation of the GenericInterfaceResult +// type +func (m *MoqGenericInterfaceResult[R]) OnCall() *MoqGenericInterfaceResult_recorder[R] { + return &MoqGenericInterfaceResult_recorder[R]{ + Moq: m, + } +} + +func (m *MoqGenericInterfaceResult_recorder[R]) Usual(sParam string, bParam bool) *MoqGenericInterfaceResult_Usual_fnRecorder[R] { + return &MoqGenericInterfaceResult_Usual_fnRecorder[R]{ + Params: MoqGenericInterfaceResult_Usual_params[R]{ + SParam: sParam, + BParam: bParam, }, Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, Moq: m.Moq, } } -func (r *MoqUsual_Other_fnRecorder) Any() *MoqUsual_Other_anyParams { +func (r *MoqGenericInterfaceResult_Usual_fnRecorder[R]) Any() *MoqGenericInterfaceResult_Usual_anyParams[R] { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Other(r.Params)) + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) return nil } - return &MoqUsual_Other_anyParams{Recorder: r} + return &MoqGenericInterfaceResult_Usual_anyParams[R]{Recorder: r} } -func (a *MoqUsual_Other_anyParams) Param1() *MoqUsual_Other_fnRecorder { +func (a *MoqGenericInterfaceResult_Usual_anyParams[R]) SParam() *MoqGenericInterfaceResult_Usual_fnRecorder[R] { a.Recorder.AnyParams |= 1 << 0 return a.Recorder } -func (r *MoqUsual_Other_fnRecorder) Seq() *MoqUsual_Other_fnRecorder { +func (a *MoqGenericInterfaceResult_Usual_anyParams[R]) BParam() *MoqGenericInterfaceResult_Usual_fnRecorder[R] { + a.Recorder.AnyParams |= 1 << 1 + return a.Recorder +} + +func (r *MoqGenericInterfaceResult_Usual_fnRecorder[R]) Seq() *MoqGenericInterfaceResult_Usual_fnRecorder[R] { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Other(r.Params)) + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) return nil } r.Sequence = true return r } -func (r *MoqUsual_Other_fnRecorder) NoSeq() *MoqUsual_Other_fnRecorder { +func (r *MoqGenericInterfaceResult_Usual_fnRecorder[R]) NoSeq() *MoqGenericInterfaceResult_Usual_fnRecorder[R] { r.Moq.Scene.T.Helper() if r.Results != nil { - r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Other(r.Params)) + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_Usual(r.Params)) return nil } r.Sequence = false return r } -func (r *MoqUsual_Other_fnRecorder) ReturnResults(result1 other.Results) *MoqUsual_Other_fnRecorder { +func (r *MoqGenericInterfaceResult_Usual_fnRecorder[R]) ReturnResults(result1 R) *MoqGenericInterfaceResult_Usual_fnRecorder[R] { r.Moq.Scene.T.Helper() r.FindResults() @@ -14880,16 +20204,12 @@ func (r *MoqUsual_Other_fnRecorder) ReturnResults(result1 other.Results) *MoqUsu } r.Results.Results = append(r.Results.Results, struct { - Values *struct { - Result1 other.Results - } - Sequence uint32 - DoFn MoqUsual_Other_doFn - DoReturnFn MoqUsual_Other_doReturnFn - }{ - Values: &struct { - Result1 other.Results - }{ + Values *struct{ Result1 R } + Sequence uint32 + DoFn MoqGenericInterfaceResult_Usual_doFn[R] + DoReturnFn MoqGenericInterfaceResult_Usual_doReturnFn[R] + }{ + Values: &struct{ Result1 R }{ Result1: result1, }, Sequence: sequence, @@ -14897,7 +20217,7 @@ func (r *MoqUsual_Other_fnRecorder) ReturnResults(result1 other.Results) *MoqUsu return r } -func (r *MoqUsual_Other_fnRecorder) AndDo(fn MoqUsual_Other_doFn) *MoqUsual_Other_fnRecorder { +func (r *MoqGenericInterfaceResult_Usual_fnRecorder[R]) AndDo(fn MoqGenericInterfaceResult_Usual_doFn[R]) *MoqGenericInterfaceResult_Usual_fnRecorder[R] { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") @@ -14908,7 +20228,7 @@ func (r *MoqUsual_Other_fnRecorder) AndDo(fn MoqUsual_Other_doFn) *MoqUsual_Othe return r } -func (r *MoqUsual_Other_fnRecorder) DoReturnResults(fn MoqUsual_Other_doReturnFn) *MoqUsual_Other_fnRecorder { +func (r *MoqGenericInterfaceResult_Usual_fnRecorder[R]) DoReturnResults(fn MoqGenericInterfaceResult_Usual_doReturnFn[R]) *MoqGenericInterfaceResult_Usual_fnRecorder[R] { r.Moq.Scene.T.Helper() r.FindResults() @@ -14918,17 +20238,15 @@ func (r *MoqUsual_Other_fnRecorder) DoReturnResults(fn MoqUsual_Other_doReturnFn } r.Results.Results = append(r.Results.Results, struct { - Values *struct { - Result1 other.Results - } + Values *struct{ Result1 R } Sequence uint32 - DoFn MoqUsual_Other_doFn - DoReturnFn MoqUsual_Other_doReturnFn + DoFn MoqGenericInterfaceResult_Usual_doFn[R] + DoReturnFn MoqGenericInterfaceResult_Usual_doReturnFn[R] }{Sequence: sequence, DoReturnFn: fn}) return r } -func (r *MoqUsual_Other_fnRecorder) FindResults() { +func (r *MoqGenericInterfaceResult_Usual_fnRecorder[R]) FindResults() { r.Moq.Scene.T.Helper() if r.Results != nil { r.Results.Repeat.Increment(r.Moq.Scene.T) @@ -14937,8 +20255,8 @@ func (r *MoqUsual_Other_fnRecorder) FindResults() { anyCount := bits.OnesCount64(r.AnyParams) insertAt := -1 - var results *MoqUsual_Other_resultsByParams - for n, res := range r.Moq.ResultsByParams_Other { + var results *MoqGenericInterfaceResult_Usual_resultsByParams[R] + for n, res := range r.Moq.ResultsByParams_Usual { if res.AnyParams == r.AnyParams { results = &res break @@ -14948,24 +20266,24 @@ func (r *MoqUsual_Other_fnRecorder) FindResults() { } } if results == nil { - results = &MoqUsual_Other_resultsByParams{ + results = &MoqGenericInterfaceResult_Usual_resultsByParams[R]{ AnyCount: anyCount, AnyParams: r.AnyParams, - Results: map[MoqUsual_Other_paramsKey]*MoqUsual_Other_results{}, + Results: map[MoqGenericInterfaceResult_Usual_paramsKey[R]]*MoqGenericInterfaceResult_Usual_results[R]{}, } - r.Moq.ResultsByParams_Other = append(r.Moq.ResultsByParams_Other, *results) - if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_Other) { - copy(r.Moq.ResultsByParams_Other[insertAt+1:], r.Moq.ResultsByParams_Other[insertAt:0]) - r.Moq.ResultsByParams_Other[insertAt] = *results + r.Moq.ResultsByParams_Usual = append(r.Moq.ResultsByParams_Usual, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_Usual) { + copy(r.Moq.ResultsByParams_Usual[insertAt+1:], r.Moq.ResultsByParams_Usual[insertAt:0]) + r.Moq.ResultsByParams_Usual[insertAt] = *results } } - paramsKey := r.Moq.ParamsKey_Other(r.Params, r.AnyParams) + paramsKey := r.Moq.ParamsKey_Usual(r.Params, r.AnyParams) var ok bool r.Results, ok = results.Results[paramsKey] if !ok { - r.Results = &MoqUsual_Other_results{ + r.Results = &MoqGenericInterfaceResult_Usual_results[R]{ Params: r.Params, Results: nil, Index: 0, @@ -14977,7 +20295,7 @@ func (r *MoqUsual_Other_fnRecorder) FindResults() { r.Results.Repeat.Increment(r.Moq.Scene.T) } -func (r *MoqUsual_Other_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_Other_fnRecorder { +func (r *MoqGenericInterfaceResult_Usual_fnRecorder[R]) Repeat(repeaters ...moq.Repeater) *MoqGenericInterfaceResult_Usual_fnRecorder[R] { r.Moq.Scene.T.Helper() if r.Results == nil { r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") @@ -14988,12 +20306,10 @@ func (r *MoqUsual_Other_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_ for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { if r.Sequence { last = struct { - Values *struct { - Result1 other.Results - } + Values *struct{ Result1 R } Sequence uint32 - DoFn MoqUsual_Other_doFn - DoReturnFn MoqUsual_Other_doReturnFn + DoFn MoqGenericInterfaceResult_Usual_doFn[R] + DoReturnFn MoqGenericInterfaceResult_Usual_doReturnFn[R] }{ Values: last.Values, Sequence: r.Moq.Scene.NextRecorderSequence(), @@ -15004,58 +20320,53 @@ func (r *MoqUsual_Other_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqUsual_ return r } -func (m *MoqUsual) PrettyParams_Other(params MoqUsual_Other_params) string { - return fmt.Sprintf("Other(%#v)", params.Param1) +func (m *MoqGenericInterfaceResult[R]) PrettyParams_Usual(params MoqGenericInterfaceResult_Usual_params[R]) string { + return fmt.Sprintf("Usual(%#v, %#v)", params.SParam, params.BParam) } -func (m *MoqUsual) ParamsKey_Other(params MoqUsual_Other_params, anyParams uint64) MoqUsual_Other_paramsKey { +func (m *MoqGenericInterfaceResult[R]) ParamsKey_Usual(params MoqGenericInterfaceResult_Usual_params[R], anyParams uint64) MoqGenericInterfaceResult_Usual_paramsKey[R] { m.Scene.T.Helper() - var param1Used other.Params - var param1UsedHash hash.Hash + var sParamUsed string + var sParamUsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.Runtime.ParameterIndexing.Other.Param1 == moq.ParamIndexByValue { - param1Used = params.Param1 + if m.Runtime.ParameterIndexing.Usual.SParam == moq.ParamIndexByValue { + sParamUsed = params.SParam } else { - param1UsedHash = hash.DeepHash(params.Param1) + sParamUsedHash = hash.DeepHash(params.SParam) } } - return MoqUsual_Other_paramsKey{ - Params: struct{ Param1 other.Params }{ - Param1: param1Used, + var bParamUsed bool + var bParamUsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.Runtime.ParameterIndexing.Usual.BParam == moq.ParamIndexByValue { + bParamUsed = params.BParam + } else { + bParamUsedHash = hash.DeepHash(params.BParam) + } + } + return MoqGenericInterfaceResult_Usual_paramsKey[R]{ + Params: struct { + SParam string + BParam bool + }{ + SParam: sParamUsed, + BParam: bParamUsed, }, - Hashes: struct{ Param1 hash.Hash }{ - Param1: param1UsedHash, + Hashes: struct { + SParam hash.Hash + BParam hash.Hash + }{ + SParam: sParamUsedHash, + BParam: bParamUsedHash, }, } } // Reset resets the state of the moq -func (m *MoqUsual) Reset() { - m.ResultsByParams_Usual = nil - m.ResultsByParams_NoNames = nil - m.ResultsByParams_NoResults = nil - m.ResultsByParams_NoParams = nil - m.ResultsByParams_Nothing = nil - m.ResultsByParams_Variadic = nil - m.ResultsByParams_RepeatedIds = nil - m.ResultsByParams_Times = nil - m.ResultsByParams_DifficultParamNames = nil - m.ResultsByParams_DifficultResultNames = nil - m.ResultsByParams_PassByArray = nil - m.ResultsByParams_PassByChan = nil - m.ResultsByParams_PassByEllipsis = nil - m.ResultsByParams_PassByMap = nil - m.ResultsByParams_PassByReference = nil - m.ResultsByParams_PassBySlice = nil - m.ResultsByParams_PassByValue = nil - m.ResultsByParams_InterfaceParam = nil - m.ResultsByParams_InterfaceResult = nil - m.ResultsByParams_FnParam = nil - m.ResultsByParams_Other = nil -} +func (m *MoqGenericInterfaceResult[R]) Reset() { m.ResultsByParams_Usual = nil } // AssertExpectationsMet asserts that all expectations have been met -func (m *MoqUsual) AssertExpectationsMet() { +func (m *MoqGenericInterfaceResult[R]) AssertExpectationsMet() { m.Scene.T.Helper() for _, res := range m.ResultsByParams_Usual { for _, results := range res.Results { @@ -15065,164 +20376,4 @@ func (m *MoqUsual) AssertExpectationsMet() { } } } - for _, res := range m.ResultsByParams_NoNames { - for _, results := range res.Results { - missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) - if missing > 0 { - m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_NoNames(results.Params)) - } - } - } - for _, res := range m.ResultsByParams_NoResults { - for _, results := range res.Results { - missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) - if missing > 0 { - m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_NoResults(results.Params)) - } - } - } - for _, res := range m.ResultsByParams_NoParams { - for _, results := range res.Results { - missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) - if missing > 0 { - m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_NoParams(results.Params)) - } - } - } - for _, res := range m.ResultsByParams_Nothing { - for _, results := range res.Results { - missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) - if missing > 0 { - m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_Nothing(results.Params)) - } - } - } - for _, res := range m.ResultsByParams_Variadic { - for _, results := range res.Results { - missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) - if missing > 0 { - m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_Variadic(results.Params)) - } - } - } - for _, res := range m.ResultsByParams_RepeatedIds { - for _, results := range res.Results { - missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) - if missing > 0 { - m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_RepeatedIds(results.Params)) - } - } - } - for _, res := range m.ResultsByParams_Times { - for _, results := range res.Results { - missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) - if missing > 0 { - m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_Times(results.Params)) - } - } - } - for _, res := range m.ResultsByParams_DifficultParamNames { - for _, results := range res.Results { - missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) - if missing > 0 { - m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_DifficultParamNames(results.Params)) - } - } - } - for _, res := range m.ResultsByParams_DifficultResultNames { - for _, results := range res.Results { - missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) - if missing > 0 { - m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_DifficultResultNames(results.Params)) - } - } - } - for _, res := range m.ResultsByParams_PassByArray { - for _, results := range res.Results { - missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) - if missing > 0 { - m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_PassByArray(results.Params)) - } - } - } - for _, res := range m.ResultsByParams_PassByChan { - for _, results := range res.Results { - missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) - if missing > 0 { - m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_PassByChan(results.Params)) - } - } - } - for _, res := range m.ResultsByParams_PassByEllipsis { - for _, results := range res.Results { - missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) - if missing > 0 { - m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_PassByEllipsis(results.Params)) - } - } - } - for _, res := range m.ResultsByParams_PassByMap { - for _, results := range res.Results { - missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) - if missing > 0 { - m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_PassByMap(results.Params)) - } - } - } - for _, res := range m.ResultsByParams_PassByReference { - for _, results := range res.Results { - missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) - if missing > 0 { - m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_PassByReference(results.Params)) - } - } - } - for _, res := range m.ResultsByParams_PassBySlice { - for _, results := range res.Results { - missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) - if missing > 0 { - m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_PassBySlice(results.Params)) - } - } - } - for _, res := range m.ResultsByParams_PassByValue { - for _, results := range res.Results { - missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) - if missing > 0 { - m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_PassByValue(results.Params)) - } - } - } - for _, res := range m.ResultsByParams_InterfaceParam { - for _, results := range res.Results { - missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) - if missing > 0 { - m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_InterfaceParam(results.Params)) - } - } - } - for _, res := range m.ResultsByParams_InterfaceResult { - for _, results := range res.Results { - missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) - if missing > 0 { - m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_InterfaceResult(results.Params)) - } - } - } - for _, res := range m.ResultsByParams_FnParam { - for _, results := range res.Results { - missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) - if missing > 0 { - m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_FnParam(results.Params)) - } - } - } - for _, res := range m.ResultsByParams_Other { - for _, results := range res.Results { - missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) - if missing > 0 { - m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_Other(results.Params)) - } - } - } } diff --git a/generator/testmoqs/fnadaptors_test.go b/generator/testmoqs/fnadaptors_test.go index 20831ee..19389d6 100644 --- a/generator/testmoqs/fnadaptors_test.go +++ b/generator/testmoqs/fnadaptors_test.go @@ -1189,7 +1189,9 @@ func (a *exportedRepeatedIdsFnAdaptor) newRecorder(sParams []string, bParam bool return &exportedRepeatedIdsFnRecorder{r: a.m.OnCall(sParams[0], sParams[1], bParam)} } -func (a *exportedRepeatedIdsFnAdaptor) invokeMockAndExpectResults(t moq.T, sParams []string, bParam bool, res results) { +func (a *exportedRepeatedIdsFnAdaptor) invokeMockAndExpectResults( + t moq.T, sParams []string, bParam bool, res results, +) { sResult1, sResult2, err := a.m.Mock()(sParams[0], sParams[1], bParam) if sResult1 != res.sResults[0] { t.Errorf("wanted %#v, got %#v", res.sResults[0], sResult1) @@ -2535,3 +2537,843 @@ func (r *exportedInterfaceResultFnRecorder) repeat(repeaters ...moq.Repeater) { func (r *exportedInterfaceResultFnRecorder) isNil() bool { return r.r == nil } + +type genericParamsFnAdaptor[S, B any] struct { + //nolint:structcheck // definitely used + m *moqGenericParamsFn[S, B] +} + +func (a *genericParamsFnAdaptor[S, B]) config() adaptorConfig { return adaptorConfig{} } + +func (a *genericParamsFnAdaptor[S, B]) mock() interface{} { return a.m.mock() } + +func (a *genericParamsFnAdaptor[S, B]) newRecorder(sParams []S, bParam B) recorder { + return &genericParamsFnRecorder[S, B]{r: a.m.onCall(sParams[0], bParam)} +} + +func (a *genericParamsFnAdaptor[S, B]) invokeMockAndExpectResults(t moq.T, sParams []S, bParam B, res results) { + sResult, err := a.m.mock()(sParams[0], bParam) + if sResult != res.sResults[0] { + t.Errorf("wanted %#v, got %#v", res.sResults[0], sResult) + } + if err != res.err { + t.Errorf("wanted %#v, got %#v", res.err, err) + } +} + +func (a *genericParamsFnAdaptor[S, B]) prettyParams(sParams []S, bParam B) string { + return fmt.Sprintf("GenericParamsFn(%#v, %#v)", sParams[0], bParam) +} + +func (a *genericParamsFnAdaptor[S, B]) sceneMoq() moq.Moq { + return a.m +} + +type genericParamsFnRecorder[S, B any] struct { + //nolint:structcheck // definitely used + r *moqGenericParamsFn_fnRecorder[S, B] +} + +func (r *genericParamsFnRecorder[S, B]) anySParam() { + if a := r.r.any(); a == nil { + r.r = nil + } else { + r.r = a.param1() + } +} + +func (r *genericParamsFnRecorder[S, B]) anyBParam() { + if a := r.r.any(); a == nil { + r.r = nil + } else { + r.r = a.param2() + } +} + +func (r *genericParamsFnRecorder[S, B]) seq() { + r.r = r.r.seq() +} + +func (r *genericParamsFnRecorder[S, B]) noSeq() { + r.r = r.r.noSeq() +} + +func (r *genericParamsFnRecorder[S, B]) returnResults(sResults []string, err error) { + r.r = r.r.returnResults(sResults[0], err) +} + +func (r *genericParamsFnRecorder[S, B]) andDo(t moq.T, fn func(), expectedSParams []string, expectedBParam bool) { + r.r = r.r.andDo(func(sParam S, bParam B) { + fn() + if !reflect.DeepEqual(sParam, expectedSParams[0]) { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if !reflect.DeepEqual(bParam, expectedBParam) { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + }) +} + +func (r *genericParamsFnRecorder[S, B]) doReturnResults( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, sResults []string, err error, +) { + r.r = r.r.doReturnResults(func(sParam S, bParam B) (string, error) { + fn() + if !reflect.DeepEqual(sParam, expectedSParams[0]) { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if !reflect.DeepEqual(bParam, expectedBParam) { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + return sResults[0], err + }) +} + +func (r *genericParamsFnRecorder[S, B]) repeat(repeaters ...moq.Repeater) { + r.r = r.r.repeat(repeaters...) +} + +func (r *genericParamsFnRecorder[S, B]) isNil() bool { + return r.r == nil +} + +type exportedGenericParamsFnAdaptor[S, B any] struct { + //nolint:structcheck // definitely used + m *exported.MoqGenericParamsFn[S, B] +} + +func (a *exportedGenericParamsFnAdaptor[S, B]) config() adaptorConfig { + return adaptorConfig{exported: true} +} + +func (a *exportedGenericParamsFnAdaptor[S, B]) mock() interface{} { return a.m.Mock() } + +func (a *exportedGenericParamsFnAdaptor[S, B]) newRecorder(sParams []S, bParam B) recorder { + return &exportedGenericParamsFnRecorder[S, B]{r: a.m.OnCall(sParams[0], bParam)} +} + +func (a *exportedGenericParamsFnAdaptor[S, B]) invokeMockAndExpectResults( + t moq.T, sParams []S, bParam B, res results, +) { + sResult, err := a.m.Mock()(sParams[0], bParam) + if sResult != res.sResults[0] { + t.Errorf("wanted %#v, got %#v", res.sResults[0], sResult) + } + if err != res.err { + t.Errorf("wanted %#v, got %#v", res.err, err) + } +} + +func (a *exportedGenericParamsFnAdaptor[S, B]) prettyParams(sParams []S, bParam B) string { + return fmt.Sprintf("GenericParamsFn(%#v, %#v)", sParams[0], bParam) +} + +func (a *exportedGenericParamsFnAdaptor[S, B]) sceneMoq() moq.Moq { + return a.m +} + +type exportedGenericParamsFnRecorder[S, B any] struct { + //nolint:structcheck // definitely used + r *exported.MoqGenericParamsFn_fnRecorder[S, B] +} + +func (r *exportedGenericParamsFnRecorder[S, B]) anySParam() { + if a := r.r.Any(); a == nil { + r.r = nil + } else { + r.r = a.Param1() + } +} + +func (r *exportedGenericParamsFnRecorder[S, B]) anyBParam() { + if a := r.r.Any(); a == nil { + r.r = nil + } else { + r.r = a.Param2() + } +} + +func (r *exportedGenericParamsFnRecorder[S, B]) seq() { + r.r = r.r.Seq() +} + +func (r *exportedGenericParamsFnRecorder[S, B]) noSeq() { + r.r = r.r.NoSeq() +} + +func (r *exportedGenericParamsFnRecorder[S, B]) returnResults(sResults []string, err error) { + r.r = r.r.ReturnResults(sResults[0], err) +} + +func (r *exportedGenericParamsFnRecorder[S, B]) andDo( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, +) { + r.r = r.r.AndDo(func(sParam S, bParam B) { + fn() + if !reflect.DeepEqual(sParam, expectedSParams[0]) { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if !reflect.DeepEqual(bParam, expectedBParam) { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + }) +} + +func (r *exportedGenericParamsFnRecorder[S, B]) doReturnResults( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, sResults []string, err error, +) { + r.r = r.r.DoReturnResults(func(sParam S, bParam B) (string, error) { + fn() + if !reflect.DeepEqual(sParam, expectedSParams[0]) { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if !reflect.DeepEqual(bParam, expectedBParam) { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + return sResults[0], err + }) +} + +func (r *exportedGenericParamsFnRecorder[S, B]) repeat(repeaters ...moq.Repeater) { + r.r = r.r.Repeat(repeaters...) +} + +func (r *exportedGenericParamsFnRecorder[S, B]) isNil() bool { + return r.r == nil +} + +type partialGenericParamsFnAdaptor[S any] struct { + //nolint:structcheck // definitely used + m *moqPartialGenericParamsFn[S] +} + +func (a *partialGenericParamsFnAdaptor[S]) config() adaptorConfig { return adaptorConfig{} } + +func (a *partialGenericParamsFnAdaptor[S]) mock() interface{} { return a.m.mock() } + +func (a *partialGenericParamsFnAdaptor[S]) newRecorder(sParams []S, bParam bool) recorder { + return &partialGenericParamsFnRecorder[S]{r: a.m.onCall(sParams[0], bParam)} +} + +func (a *partialGenericParamsFnAdaptor[S]) invokeMockAndExpectResults( + t moq.T, sParams []S, bParam bool, res results, +) { + sResult, err := a.m.mock()(sParams[0], bParam) + if sResult != res.sResults[0] { + t.Errorf("wanted %#v, got %#v", res.sResults[0], sResult) + } + if err != res.err { + t.Errorf("wanted %#v, got %#v", res.err, err) + } +} + +func (a *partialGenericParamsFnAdaptor[S]) prettyParams(sParams []S, bParam bool) string { + return fmt.Sprintf("PartialGenericParamsFn(%#v, %#v)", sParams[0], bParam) +} + +func (a *partialGenericParamsFnAdaptor[S]) sceneMoq() moq.Moq { + return a.m +} + +type partialGenericParamsFnRecorder[S any] struct { + //nolint:structcheck // definitely used + r *moqPartialGenericParamsFn_fnRecorder[S] +} + +func (r *partialGenericParamsFnRecorder[S]) anySParam() { + if a := r.r.any(); a == nil { + r.r = nil + } else { + r.r = a.param1() + } +} + +func (r *partialGenericParamsFnRecorder[S]) anyBParam() { + if a := r.r.any(); a == nil { + r.r = nil + } else { + r.r = a.param2() + } +} + +func (r *partialGenericParamsFnRecorder[S]) seq() { + r.r = r.r.seq() +} + +func (r *partialGenericParamsFnRecorder[S]) noSeq() { + r.r = r.r.noSeq() +} + +func (r *partialGenericParamsFnRecorder[S]) returnResults(sResults []string, err error) { + r.r = r.r.returnResults(sResults[0], err) +} + +func (r *partialGenericParamsFnRecorder[S]) andDo(t moq.T, fn func(), expectedSParams []string, expectedBParam bool) { + r.r = r.r.andDo(func(sParam S, bParam bool) { + fn() + if !reflect.DeepEqual(sParam, expectedSParams[0]) { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + }) +} + +func (r *partialGenericParamsFnRecorder[S]) doReturnResults( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, sResults []string, err error, +) { + r.r = r.r.doReturnResults(func(sParam S, bParam bool) (string, error) { + fn() + if !reflect.DeepEqual(sParam, expectedSParams[0]) { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + return sResults[0], err + }) +} + +func (r *partialGenericParamsFnRecorder[S]) repeat(repeaters ...moq.Repeater) { + r.r = r.r.repeat(repeaters...) +} + +func (r *partialGenericParamsFnRecorder[S]) isNil() bool { + return r.r == nil +} + +type exportedPartialGenericParamsFnAdaptor[S any] struct { + //nolint:structcheck // definitely used + m *exported.MoqPartialGenericParamsFn[S] +} + +func (a *exportedPartialGenericParamsFnAdaptor[S]) config() adaptorConfig { + return adaptorConfig{exported: true} +} + +func (a *exportedPartialGenericParamsFnAdaptor[S]) mock() interface{} { return a.m.Mock() } + +func (a *exportedPartialGenericParamsFnAdaptor[S]) newRecorder(sParams []S, bParam bool) recorder { + return &exportedPartialGenericParamsFnRecorder[S]{r: a.m.OnCall(sParams[0], bParam)} +} + +func (a *exportedPartialGenericParamsFnAdaptor[S]) invokeMockAndExpectResults( + t moq.T, sParams []S, bParam bool, res results, +) { + sResult, err := a.m.Mock()(sParams[0], bParam) + if sResult != res.sResults[0] { + t.Errorf("wanted %#v, got %#v", res.sResults[0], sResult) + } + if err != res.err { + t.Errorf("wanted %#v, got %#v", res.err, err) + } +} + +func (a *exportedPartialGenericParamsFnAdaptor[S]) prettyParams(sParams []S, bParam bool) string { + return fmt.Sprintf("PartialGenericParamsFn(%#v, %#v)", sParams[0], bParam) +} + +func (a *exportedPartialGenericParamsFnAdaptor[S]) sceneMoq() moq.Moq { + return a.m +} + +type exportedPartialGenericParamsFnRecorder[S any] struct { + //nolint:structcheck // definitely used + r *exported.MoqPartialGenericParamsFn_fnRecorder[S] +} + +func (r *exportedPartialGenericParamsFnRecorder[S]) anySParam() { + if a := r.r.Any(); a == nil { + r.r = nil + } else { + r.r = a.Param1() + } +} + +func (r *exportedPartialGenericParamsFnRecorder[S]) anyBParam() { + if a := r.r.Any(); a == nil { + r.r = nil + } else { + r.r = a.Param2() + } +} + +func (r *exportedPartialGenericParamsFnRecorder[S]) seq() { + r.r = r.r.Seq() +} + +func (r *exportedPartialGenericParamsFnRecorder[S]) noSeq() { + r.r = r.r.NoSeq() +} + +func (r *exportedPartialGenericParamsFnRecorder[S]) returnResults(sResults []string, err error) { + r.r = r.r.ReturnResults(sResults[0], err) +} + +func (r *exportedPartialGenericParamsFnRecorder[S]) andDo( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, +) { + r.r = r.r.AndDo(func(sParam S, bParam bool) { + fn() + if !reflect.DeepEqual(sParam, expectedSParams[0]) { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + }) +} + +func (r *exportedPartialGenericParamsFnRecorder[S]) doReturnResults( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, sResults []string, err error, +) { + r.r = r.r.DoReturnResults(func(sParam S, bParam bool) (string, error) { + fn() + if !reflect.DeepEqual(sParam, expectedSParams[0]) { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + return sResults[0], err + }) +} + +func (r *exportedPartialGenericParamsFnRecorder[S]) repeat(repeaters ...moq.Repeater) { + r.r = r.r.Repeat(repeaters...) +} + +func (r *exportedPartialGenericParamsFnRecorder[S]) isNil() bool { + return r.r == nil +} + +type genericResultsFnAdaptor[S ~string, E error] struct { + //nolint:structcheck // definitely used + m *moqGenericResultsFn[S, E] +} + +func (a *genericResultsFnAdaptor[S, E]) config() adaptorConfig { return adaptorConfig{} } + +func (a *genericResultsFnAdaptor[S, E]) mock() interface{} { return a.m.mock() } + +func (a *genericResultsFnAdaptor[S, E]) newRecorder(sParams []string, bParam bool) recorder { + return &genericResultsFnRecorder[S, E]{r: a.m.onCall(sParams[0], bParam)} +} + +func (a *genericResultsFnAdaptor[S, E]) invokeMockAndExpectResults( + t moq.T, sParams []string, bParam bool, res results, +) { + sResult, err := a.m.mock()(sParams[0], bParam) + if !reflect.DeepEqual(sResult, res.sResults[0]) { + t.Errorf("wanted %#v, got %#v", res.sResults[0], sResult) + } + if !reflect.DeepEqual(err, res.err) { + t.Errorf("wanted %#v, got %#v", res.err, err) + } +} + +func (a *genericResultsFnAdaptor[S, E]) prettyParams(sParams []string, bParam bool) string { + return fmt.Sprintf("GenericResultsFn(%#v, %#v)", sParams[0], bParam) +} + +func (a *genericResultsFnAdaptor[S, E]) sceneMoq() moq.Moq { + return a.m +} + +type genericResultsFnRecorder[S ~string, E error] struct { + //nolint:structcheck // definitely used + r *moqGenericResultsFn_fnRecorder[S, E] +} + +func (r *genericResultsFnRecorder[S, E]) anySParam() { + if a := r.r.any(); a == nil { + r.r = nil + } else { + r.r = a.param1() + } +} + +func (r *genericResultsFnRecorder[S, E]) anyBParam() { + if a := r.r.any(); a == nil { + r.r = nil + } else { + r.r = a.param2() + } +} + +func (r *genericResultsFnRecorder[S, E]) seq() { + r.r = r.r.seq() +} + +func (r *genericResultsFnRecorder[S, E]) noSeq() { + r.r = r.r.noSeq() +} + +func (r *genericResultsFnRecorder[S, E]) returnResults(sResults []string, err error) { + var e E + if err != nil { + e = err.(E) + } + r.r = r.r.returnResults(S(sResults[0]), e) +} + +func (r *genericResultsFnRecorder[S, E]) andDo(t moq.T, fn func(), expectedSParams []string, expectedBParam bool) { + r.r = r.r.andDo(func(sParam string, bParam bool) { + fn() + if sParam != expectedSParams[0] { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + }) +} + +func (r *genericResultsFnRecorder[S, E]) doReturnResults( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, sResults []string, err error, +) { + r.r = r.r.doReturnResults(func(sParam string, bParam bool) (S, E) { + fn() + if sParam != expectedSParams[0] { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + var e E + if err != nil { + e = err.(E) + } + return S(sResults[0]), e + }) +} + +func (r *genericResultsFnRecorder[S, E]) repeat(repeaters ...moq.Repeater) { + r.r = r.r.repeat(repeaters...) +} + +func (r *genericResultsFnRecorder[S, E]) isNil() bool { + return r.r == nil +} + +type exportedGenericResultsFnAdaptor[S ~string, E error] struct { + //nolint:structcheck // definitely used + m *exported.MoqGenericResultsFn[S, E] +} + +func (a *exportedGenericResultsFnAdaptor[S, E]) config() adaptorConfig { + return adaptorConfig{exported: true} +} + +func (a *exportedGenericResultsFnAdaptor[S, E]) mock() interface{} { return a.m.Mock() } + +func (a *exportedGenericResultsFnAdaptor[S, E]) newRecorder(sParams []string, bParam bool) recorder { + return &exportedGenericResultsFnRecorder[S, E]{r: a.m.OnCall(sParams[0], bParam)} +} + +func (a *exportedGenericResultsFnAdaptor[S, E]) invokeMockAndExpectResults( + t moq.T, sParams []string, bParam bool, res results, +) { + sResult, err := a.m.Mock()(sParams[0], bParam) + if !reflect.DeepEqual(sResult, res.sResults[0]) { + t.Errorf("wanted %#v, got %#v", res.sResults[0], sResult) + } + if !reflect.DeepEqual(err, res.err) { + t.Errorf("wanted %#v, got %#v", res.err, err) + } +} + +func (a *exportedGenericResultsFnAdaptor[S, E]) prettyParams(sParams []string, bParam bool) string { + return fmt.Sprintf("GenericResultsFn(%#v, %#v)", sParams[0], bParam) +} + +func (a *exportedGenericResultsFnAdaptor[S, E]) sceneMoq() moq.Moq { + return a.m +} + +type exportedGenericResultsFnRecorder[S ~string, E error] struct { + //nolint:structcheck // definitely used + r *exported.MoqGenericResultsFn_fnRecorder[S, E] +} + +func (r *exportedGenericResultsFnRecorder[S, E]) anySParam() { + if a := r.r.Any(); a == nil { + r.r = nil + } else { + r.r = a.Param1() + } +} + +func (r *exportedGenericResultsFnRecorder[S, E]) anyBParam() { + if a := r.r.Any(); a == nil { + r.r = nil + } else { + r.r = a.Param2() + } +} + +func (r *exportedGenericResultsFnRecorder[S, E]) seq() { + r.r = r.r.Seq() +} + +func (r *exportedGenericResultsFnRecorder[S, E]) noSeq() { + r.r = r.r.NoSeq() +} + +func (r *exportedGenericResultsFnRecorder[S, E]) returnResults(sResults []string, err error) { + var e E + if err != nil { + e = err.(E) + } + r.r = r.r.ReturnResults(S(sResults[0]), e) +} + +func (r *exportedGenericResultsFnRecorder[S, E]) andDo( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, +) { + r.r = r.r.AndDo(func(sParam string, bParam bool) { + fn() + if sParam != expectedSParams[0] { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + }) +} + +func (r *exportedGenericResultsFnRecorder[S, E]) doReturnResults( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, sResults []string, err error, +) { + r.r = r.r.DoReturnResults(func(sParam string, bParam bool) (S, E) { + fn() + if sParam != expectedSParams[0] { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + var e E + if err != nil { + e = err.(E) + } + return S(sResults[0]), e + }) +} + +func (r *exportedGenericResultsFnRecorder[S, E]) repeat(repeaters ...moq.Repeater) { + r.r = r.r.Repeat(repeaters...) +} + +func (r *exportedGenericResultsFnRecorder[S, E]) isNil() bool { + return r.r == nil +} + +type partialGenericResultsFnAdaptor[S ~string] struct { + //nolint:structcheck // definitely used + m *moqPartialGenericResultsFn[S] +} + +func (a *partialGenericResultsFnAdaptor[S]) config() adaptorConfig { return adaptorConfig{} } + +func (a *partialGenericResultsFnAdaptor[S]) mock() interface{} { return a.m.mock() } + +func (a *partialGenericResultsFnAdaptor[S]) newRecorder(sParams []string, bParam bool) recorder { + return &partialGenericResultsFnRecorder[S]{r: a.m.onCall(sParams[0], bParam)} +} + +func (a *partialGenericResultsFnAdaptor[S]) invokeMockAndExpectResults( + t moq.T, sParams []string, bParam bool, res results, +) { + sResult, err := a.m.mock()(sParams[0], bParam) + if !reflect.DeepEqual(sResult, res.sResults[0]) { + t.Errorf("wanted %#v, got %#v", res.sResults[0], sResult) + } + if !reflect.DeepEqual(err, res.err) { + t.Errorf("wanted %#v, got %#v", res.err, err) + } +} + +func (a *partialGenericResultsFnAdaptor[S]) prettyParams(sParams []string, bParam bool) string { + return fmt.Sprintf("PartialGenericResultsFn(%#v, %#v)", sParams[0], bParam) +} + +func (a *partialGenericResultsFnAdaptor[S]) sceneMoq() moq.Moq { + return a.m +} + +type partialGenericResultsFnRecorder[S ~string] struct { + //nolint:structcheck // definitely used + r *moqPartialGenericResultsFn_fnRecorder[S] +} + +func (r *partialGenericResultsFnRecorder[S]) anySParam() { + if a := r.r.any(); a == nil { + r.r = nil + } else { + r.r = a.param1() + } +} + +func (r *partialGenericResultsFnRecorder[S]) anyBParam() { + if a := r.r.any(); a == nil { + r.r = nil + } else { + r.r = a.param2() + } +} + +func (r *partialGenericResultsFnRecorder[S]) seq() { + r.r = r.r.seq() +} + +func (r *partialGenericResultsFnRecorder[S]) noSeq() { + r.r = r.r.noSeq() +} + +func (r *partialGenericResultsFnRecorder[S]) returnResults(sResults []string, err error) { + r.r = r.r.returnResults(S(sResults[0]), err) +} + +func (r *partialGenericResultsFnRecorder[S]) andDo( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, +) { + r.r = r.r.andDo(func(sParam string, bParam bool) { + fn() + if sParam != expectedSParams[0] { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + }) +} + +func (r *partialGenericResultsFnRecorder[S]) doReturnResults( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, sResults []string, err error, +) { + r.r = r.r.doReturnResults(func(sParam string, bParam bool) (S, error) { + fn() + if sParam != expectedSParams[0] { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + return S(sResults[0]), err + }) +} + +func (r *partialGenericResultsFnRecorder[S]) repeat(repeaters ...moq.Repeater) { + r.r = r.r.repeat(repeaters...) +} + +func (r *partialGenericResultsFnRecorder[S]) isNil() bool { + return r.r == nil +} + +type exportedPartialGenericResultsFnAdaptor[S ~string] struct { + //nolint:structcheck // definitely used + m *exported.MoqPartialGenericResultsFn[S] +} + +func (a *exportedPartialGenericResultsFnAdaptor[S]) config() adaptorConfig { + return adaptorConfig{exported: true} +} + +func (a *exportedPartialGenericResultsFnAdaptor[S]) mock() interface{} { return a.m.Mock() } + +func (a *exportedPartialGenericResultsFnAdaptor[S]) newRecorder(sParams []string, bParam bool) recorder { + return &exportedPartialGenericResultsFnRecorder[S]{r: a.m.OnCall(sParams[0], bParam)} +} + +func (a *exportedPartialGenericResultsFnAdaptor[S]) invokeMockAndExpectResults( + t moq.T, sParams []string, bParam bool, res results, +) { + sResult, err := a.m.Mock()(sParams[0], bParam) + if !reflect.DeepEqual(sResult, res.sResults[0]) { + t.Errorf("wanted %#v, got %#v", res.sResults[0], sResult) + } + if !reflect.DeepEqual(err, res.err) { + t.Errorf("wanted %#v, got %#v", res.err, err) + } +} + +func (a *exportedPartialGenericResultsFnAdaptor[S]) prettyParams(sParams []string, bParam bool) string { + return fmt.Sprintf("PartialGenericResultsFn(%#v, %#v)", sParams[0], bParam) +} + +func (a *exportedPartialGenericResultsFnAdaptor[S]) sceneMoq() moq.Moq { + return a.m +} + +type exportedPartialGenericResultsFnRecorder[S ~string] struct { + //nolint:structcheck // definitely used + r *exported.MoqPartialGenericResultsFn_fnRecorder[S] +} + +func (r *exportedPartialGenericResultsFnRecorder[S]) anySParam() { + if a := r.r.Any(); a == nil { + r.r = nil + } else { + r.r = a.Param1() + } +} + +func (r *exportedPartialGenericResultsFnRecorder[S]) anyBParam() { + if a := r.r.Any(); a == nil { + r.r = nil + } else { + r.r = a.Param2() + } +} + +func (r *exportedPartialGenericResultsFnRecorder[S]) seq() { + r.r = r.r.Seq() +} + +func (r *exportedPartialGenericResultsFnRecorder[S]) noSeq() { + r.r = r.r.NoSeq() +} + +func (r *exportedPartialGenericResultsFnRecorder[S]) returnResults(sResults []string, err error) { + r.r = r.r.ReturnResults(S(sResults[0]), err) +} + +func (r *exportedPartialGenericResultsFnRecorder[S]) andDo( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, +) { + r.r = r.r.AndDo(func(sParam string, bParam bool) { + fn() + if sParam != expectedSParams[0] { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + }) +} + +func (r *exportedPartialGenericResultsFnRecorder[S]) doReturnResults( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, sResults []string, err error, +) { + r.r = r.r.DoReturnResults(func(sParam string, bParam bool) (S, error) { + fn() + if sParam != expectedSParams[0] { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + return S(sResults[0]), err + }) +} + +func (r *exportedPartialGenericResultsFnRecorder[S]) repeat(repeaters ...moq.Repeater) { + r.r = r.r.Repeat(repeaters...) +} + +func (r *exportedPartialGenericResultsFnRecorder[S]) isNil() bool { + return r.r == nil +} diff --git a/generator/testmoqs/moq_testmoqs_test.go b/generator/testmoqs/moq_testmoqs_test.go index 0689c9a..5f32092 100644 --- a/generator/testmoqs/moq_testmoqs_test.go +++ b/generator/testmoqs/moq_testmoqs_test.go @@ -7708,1683 +7708,5164 @@ func (m *moqInterfaceResultFn) AssertExpectationsMet() { } } -// The following type assertion assures that testmoqs.Usual is mocked -// completely -var _ testmoqs.Usual = (*moqUsual_mock)(nil) - -// moqUsual holds the state of a moq of the Usual type -type moqUsual struct { +// moqGenericParamsFn holds the state of a moq of the GenericParamsFn type +type moqGenericParamsFn[S, B any] struct { scene *moq.Scene config moq.Config - moq *moqUsual_mock + moq *moqGenericParamsFn_mock[S, B] - resultsByParams_Usual []moqUsual_Usual_resultsByParams - resultsByParams_NoNames []moqUsual_NoNames_resultsByParams - resultsByParams_NoResults []moqUsual_NoResults_resultsByParams - resultsByParams_NoParams []moqUsual_NoParams_resultsByParams - resultsByParams_Nothing []moqUsual_Nothing_resultsByParams - resultsByParams_Variadic []moqUsual_Variadic_resultsByParams - resultsByParams_RepeatedIds []moqUsual_RepeatedIds_resultsByParams - resultsByParams_Times []moqUsual_Times_resultsByParams - resultsByParams_DifficultParamNames []moqUsual_DifficultParamNames_resultsByParams - resultsByParams_DifficultResultNames []moqUsual_DifficultResultNames_resultsByParams - resultsByParams_PassByArray []moqUsual_PassByArray_resultsByParams - resultsByParams_PassByChan []moqUsual_PassByChan_resultsByParams - resultsByParams_PassByEllipsis []moqUsual_PassByEllipsis_resultsByParams - resultsByParams_PassByMap []moqUsual_PassByMap_resultsByParams - resultsByParams_PassByReference []moqUsual_PassByReference_resultsByParams - resultsByParams_PassBySlice []moqUsual_PassBySlice_resultsByParams - resultsByParams_PassByValue []moqUsual_PassByValue_resultsByParams - resultsByParams_InterfaceParam []moqUsual_InterfaceParam_resultsByParams - resultsByParams_InterfaceResult []moqUsual_InterfaceResult_resultsByParams - resultsByParams_FnParam []moqUsual_FnParam_resultsByParams - resultsByParams_Other []moqUsual_Other_resultsByParams + resultsByParams []moqGenericParamsFn_resultsByParams[S, B] runtime struct { parameterIndexing struct { - Usual struct { - sParam moq.ParamIndexing - bParam moq.ParamIndexing - } - NoNames struct { - param1 moq.ParamIndexing - param2 moq.ParamIndexing - } - NoResults struct { - sParam moq.ParamIndexing - bParam moq.ParamIndexing - } - NoParams struct{} - Nothing struct{} - Variadic struct { - other moq.ParamIndexing - args moq.ParamIndexing - } - RepeatedIds struct { - sParam1 moq.ParamIndexing - sParam2 moq.ParamIndexing - bParam moq.ParamIndexing - } - Times struct { - sParam moq.ParamIndexing - times moq.ParamIndexing - } - DifficultParamNames struct { - param1 moq.ParamIndexing - param2 moq.ParamIndexing - param3 moq.ParamIndexing - param moq.ParamIndexing - param5 moq.ParamIndexing - param6 moq.ParamIndexing - param7 moq.ParamIndexing - param8 moq.ParamIndexing - param9 moq.ParamIndexing - } - DifficultResultNames struct{} - PassByArray struct { - p moq.ParamIndexing - } - PassByChan struct { - p moq.ParamIndexing - } - PassByEllipsis struct { - p moq.ParamIndexing - } - PassByMap struct { - p moq.ParamIndexing - } - PassByReference struct { - p moq.ParamIndexing - } - PassBySlice struct { - p moq.ParamIndexing - } - PassByValue struct { - p moq.ParamIndexing - } - InterfaceParam struct { - w moq.ParamIndexing - } - InterfaceResult struct { - sParam moq.ParamIndexing - bParam moq.ParamIndexing - } - FnParam struct { - fn moq.ParamIndexing - } - Other struct { - param1 moq.ParamIndexing - } + param1 moq.ParamIndexing + param2 moq.ParamIndexing } } - // moqUsual_mock isolates the mock interface of the Usual type } -type moqUsual_mock struct { - moq *moqUsual -} - -// moqUsual_recorder isolates the recorder interface of the Usual type -type moqUsual_recorder struct { - moq *moqUsual +// moqGenericParamsFn_mock isolates the mock interface of the GenericParamsFn +// type +type moqGenericParamsFn_mock[S, B any] struct { + moq *moqGenericParamsFn[S, B] } -// moqUsual_Usual_params holds the params of the Usual type -type moqUsual_Usual_params struct { - sParam string - bParam bool +// moqGenericParamsFn_params holds the params of the GenericParamsFn type +type moqGenericParamsFn_params[S, B any] struct { + param1 S + param2 B } -// moqUsual_Usual_paramsKey holds the map key params of the Usual type -type moqUsual_Usual_paramsKey struct { - params struct { - sParam string - bParam bool - } +// moqGenericParamsFn_paramsKey holds the map key params of the GenericParamsFn +// type +type moqGenericParamsFn_paramsKey[S, B any] struct { + params struct{} hashes struct { - sParam hash.Hash - bParam hash.Hash + param1 hash.Hash + param2 hash.Hash } } -// moqUsual_Usual_resultsByParams contains the results for a given set of -// parameters for the Usual type -type moqUsual_Usual_resultsByParams struct { +// moqGenericParamsFn_resultsByParams contains the results for a given set of +// parameters for the GenericParamsFn type +type moqGenericParamsFn_resultsByParams[S, B any] struct { anyCount int anyParams uint64 - results map[moqUsual_Usual_paramsKey]*moqUsual_Usual_results + results map[moqGenericParamsFn_paramsKey[S, B]]*moqGenericParamsFn_results[S, B] } -// moqUsual_Usual_doFn defines the type of function needed when calling andDo -// for the Usual type -type moqUsual_Usual_doFn func(sParam string, bParam bool) +// moqGenericParamsFn_doFn defines the type of function needed when calling +// andDo for the GenericParamsFn type +type moqGenericParamsFn_doFn[S, B any] func(S, B) -// moqUsual_Usual_doReturnFn defines the type of function needed when calling -// doReturnResults for the Usual type -type moqUsual_Usual_doReturnFn func(sParam string, bParam bool) (sResult string, err error) +// moqGenericParamsFn_doReturnFn defines the type of function needed when +// calling doReturnResults for the GenericParamsFn type +type moqGenericParamsFn_doReturnFn[S, B any] func(S, B) (string, error) -// moqUsual_Usual_results holds the results of the Usual type -type moqUsual_Usual_results struct { - params moqUsual_Usual_params +// moqGenericParamsFn_results holds the results of the GenericParamsFn type +type moqGenericParamsFn_results[S, B any] struct { + params moqGenericParamsFn_params[S, B] results []struct { values *struct { - sResult string - err error + result1 string + result2 error } sequence uint32 - doFn moqUsual_Usual_doFn - doReturnFn moqUsual_Usual_doReturnFn + doFn moqGenericParamsFn_doFn[S, B] + doReturnFn moqGenericParamsFn_doReturnFn[S, B] } index uint32 repeat *moq.RepeatVal } -// moqUsual_Usual_fnRecorder routes recorded function calls to the moqUsual moq -type moqUsual_Usual_fnRecorder struct { - params moqUsual_Usual_params +// moqGenericParamsFn_fnRecorder routes recorded function calls to the +// moqGenericParamsFn moq +type moqGenericParamsFn_fnRecorder[S, B any] struct { + params moqGenericParamsFn_params[S, B] anyParams uint64 sequence bool - results *moqUsual_Usual_results - moq *moqUsual + results *moqGenericParamsFn_results[S, B] + moq *moqGenericParamsFn[S, B] } -// moqUsual_Usual_anyParams isolates the any params functions of the Usual type -type moqUsual_Usual_anyParams struct { - recorder *moqUsual_Usual_fnRecorder -} - -// moqUsual_NoNames_params holds the params of the Usual type -type moqUsual_NoNames_params struct { - param1 string - param2 bool +// moqGenericParamsFn_anyParams isolates the any params functions of the +// GenericParamsFn type +type moqGenericParamsFn_anyParams[S, B any] struct { + recorder *moqGenericParamsFn_fnRecorder[S, B] } -// moqUsual_NoNames_paramsKey holds the map key params of the Usual type -type moqUsual_NoNames_paramsKey struct { - params struct { - param1 string - param2 bool +// newMoqGenericParamsFn creates a new moq of the GenericParamsFn type +func newMoqGenericParamsFn[S, B any](scene *moq.Scene, config *moq.Config) *moqGenericParamsFn[S, B] { + if config == nil { + config = &moq.Config{} } - hashes struct { - param1 hash.Hash - param2 hash.Hash + m := &moqGenericParamsFn[S, B]{ + scene: scene, + config: *config, + moq: &moqGenericParamsFn_mock[S, B]{}, + + runtime: struct { + parameterIndexing struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } + }{parameterIndexing: struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + }{ + param1: moq.ParamIndexByHash, + param2: moq.ParamIndexByHash, + }}, } + m.moq.moq = m + + scene.AddMoq(m) + return m } -// moqUsual_NoNames_resultsByParams contains the results for a given set of -// parameters for the Usual type -type moqUsual_NoNames_resultsByParams struct { - anyCount int - anyParams uint64 - results map[moqUsual_NoNames_paramsKey]*moqUsual_NoNames_results +// mock returns the moq implementation of the GenericParamsFn type +func (m *moqGenericParamsFn[S, B]) mock() testmoqs.GenericParamsFn[S, B] { + return func(param1 S, param2 B) (string, error) { + m.scene.T.Helper() + moq := &moqGenericParamsFn_mock[S, B]{moq: m} + return moq.fn(param1, param2) + } } -// moqUsual_NoNames_doFn defines the type of function needed when calling andDo -// for the Usual type -type moqUsual_NoNames_doFn func(string, bool) +func (m *moqGenericParamsFn_mock[S, B]) fn(param1 S, param2 B) (result1 string, result2 error) { + m.moq.scene.T.Helper() + params := moqGenericParamsFn_params[S, B]{ + param1: param1, + param2: param2, + } + var results *moqGenericParamsFn_results[S, B] + for _, resultsByParams := range m.moq.resultsByParams { + paramsKey := m.moq.paramsKey(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams(params)) + } + return + } -// moqUsual_NoNames_doReturnFn defines the type of function needed when calling -// doReturnResults for the Usual type -type moqUsual_NoNames_doReturnFn func(string, bool) (string, error) + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } -// moqUsual_NoNames_results holds the results of the Usual type -type moqUsual_NoNames_results struct { - params moqUsual_NoNames_params - results []struct { - values *struct { - result1 string - result2 error + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams(params)) } - sequence uint32 - doFn moqUsual_NoNames_doFn - doReturnFn moqUsual_NoNames_doReturnFn } - index uint32 - repeat *moq.RepeatVal -} -// moqUsual_NoNames_fnRecorder routes recorded function calls to the moqUsual -// moq -type moqUsual_NoNames_fnRecorder struct { - params moqUsual_NoNames_params - anyParams uint64 - sequence bool - results *moqUsual_NoNames_results - moq *moqUsual -} - -// moqUsual_NoNames_anyParams isolates the any params functions of the Usual -// type -type moqUsual_NoNames_anyParams struct { - recorder *moqUsual_NoNames_fnRecorder -} - -// moqUsual_NoResults_params holds the params of the Usual type -type moqUsual_NoResults_params struct { - sParam string - bParam bool -} + if result.doFn != nil { + result.doFn(param1, param2) + } -// moqUsual_NoResults_paramsKey holds the map key params of the Usual type -type moqUsual_NoResults_paramsKey struct { - params struct { - sParam string - bParam bool + if result.values != nil { + result1 = result.values.result1 + result2 = result.values.result2 } - hashes struct { - sParam hash.Hash - bParam hash.Hash + if result.doReturnFn != nil { + result1, result2 = result.doReturnFn(param1, param2) } + return } -// moqUsual_NoResults_resultsByParams contains the results for a given set of -// parameters for the Usual type -type moqUsual_NoResults_resultsByParams struct { - anyCount int - anyParams uint64 - results map[moqUsual_NoResults_paramsKey]*moqUsual_NoResults_results +func (m *moqGenericParamsFn[S, B]) onCall(param1 S, param2 B) *moqGenericParamsFn_fnRecorder[S, B] { + return &moqGenericParamsFn_fnRecorder[S, B]{ + params: moqGenericParamsFn_params[S, B]{ + param1: param1, + param2: param2, + }, + sequence: m.config.Sequence == moq.SeqDefaultOn, + moq: m, + } } -// moqUsual_NoResults_doFn defines the type of function needed when calling -// andDo for the Usual type -type moqUsual_NoResults_doFn func(sParam string, bParam bool) - -// moqUsual_NoResults_doReturnFn defines the type of function needed when -// calling doReturnResults for the Usual type -type moqUsual_NoResults_doReturnFn func(sParam string, bParam bool) - -// moqUsual_NoResults_results holds the results of the Usual type -type moqUsual_NoResults_results struct { - params moqUsual_NoResults_params - results []struct { - values *struct{} - sequence uint32 - doFn moqUsual_NoResults_doFn - doReturnFn moqUsual_NoResults_doReturnFn +func (r *moqGenericParamsFn_fnRecorder[S, B]) any() *moqGenericParamsFn_anyParams[S, B] { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams(r.params)) + return nil } - index uint32 - repeat *moq.RepeatVal + return &moqGenericParamsFn_anyParams[S, B]{recorder: r} } -// moqUsual_NoResults_fnRecorder routes recorded function calls to the moqUsual -// moq -type moqUsual_NoResults_fnRecorder struct { - params moqUsual_NoResults_params - anyParams uint64 - sequence bool - results *moqUsual_NoResults_results - moq *moqUsual +func (a *moqGenericParamsFn_anyParams[S, B]) param1() *moqGenericParamsFn_fnRecorder[S, B] { + a.recorder.anyParams |= 1 << 0 + return a.recorder } -// moqUsual_NoResults_anyParams isolates the any params functions of the Usual -// type -type moqUsual_NoResults_anyParams struct { - recorder *moqUsual_NoResults_fnRecorder +func (a *moqGenericParamsFn_anyParams[S, B]) param2() *moqGenericParamsFn_fnRecorder[S, B] { + a.recorder.anyParams |= 1 << 1 + return a.recorder } -// moqUsual_NoParams_params holds the params of the Usual type -type moqUsual_NoParams_params struct{} - -// moqUsual_NoParams_paramsKey holds the map key params of the Usual type -type moqUsual_NoParams_paramsKey struct { - params struct{} - hashes struct{} +func (r *moqGenericParamsFn_fnRecorder[S, B]) seq() *moqGenericParamsFn_fnRecorder[S, B] { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams(r.params)) + return nil + } + r.sequence = true + return r } -// moqUsual_NoParams_resultsByParams contains the results for a given set of -// parameters for the Usual type -type moqUsual_NoParams_resultsByParams struct { - anyCount int - anyParams uint64 - results map[moqUsual_NoParams_paramsKey]*moqUsual_NoParams_results +func (r *moqGenericParamsFn_fnRecorder[S, B]) noSeq() *moqGenericParamsFn_fnRecorder[S, B] { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams(r.params)) + return nil + } + r.sequence = false + return r } -// moqUsual_NoParams_doFn defines the type of function needed when calling -// andDo for the Usual type -type moqUsual_NoParams_doFn func() +func (r *moqGenericParamsFn_fnRecorder[S, B]) returnResults(result1 string, result2 error) *moqGenericParamsFn_fnRecorder[S, B] { + r.moq.scene.T.Helper() + r.findResults() -// moqUsual_NoParams_doReturnFn defines the type of function needed when -// calling doReturnResults for the Usual type -type moqUsual_NoParams_doReturnFn func() (sResult string, err error) + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() + } -// moqUsual_NoParams_results holds the results of the Usual type -type moqUsual_NoParams_results struct { - params moqUsual_NoParams_params - results []struct { + r.results.results = append(r.results.results, struct { values *struct { - sResult string - err error + result1 string + result2 error } sequence uint32 - doFn moqUsual_NoParams_doFn - doReturnFn moqUsual_NoParams_doReturnFn - } - index uint32 - repeat *moq.RepeatVal + doFn moqGenericParamsFn_doFn[S, B] + doReturnFn moqGenericParamsFn_doReturnFn[S, B] + }{ + values: &struct { + result1 string + result2 error + }{ + result1: result1, + result2: result2, + }, + sequence: sequence, + }) + return r } -// moqUsual_NoParams_fnRecorder routes recorded function calls to the moqUsual -// moq -type moqUsual_NoParams_fnRecorder struct { - params moqUsual_NoParams_params - anyParams uint64 - sequence bool - results *moqUsual_NoParams_results - moq *moqUsual +func (r *moqGenericParamsFn_fnRecorder[S, B]) andDo(fn moqGenericParamsFn_doFn[S, B]) *moqGenericParamsFn_fnRecorder[S, B] { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") + return nil + } + last := &r.results.results[len(r.results.results)-1] + last.doFn = fn + return r } -// moqUsual_NoParams_anyParams isolates the any params functions of the Usual -// type -type moqUsual_NoParams_anyParams struct { - recorder *moqUsual_NoParams_fnRecorder -} +func (r *moqGenericParamsFn_fnRecorder[S, B]) doReturnResults(fn moqGenericParamsFn_doReturnFn[S, B]) *moqGenericParamsFn_fnRecorder[S, B] { + r.moq.scene.T.Helper() + r.findResults() -// moqUsual_Nothing_params holds the params of the Usual type -type moqUsual_Nothing_params struct{} + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() + } -// moqUsual_Nothing_paramsKey holds the map key params of the Usual type -type moqUsual_Nothing_paramsKey struct { - params struct{} - hashes struct{} + r.results.results = append(r.results.results, struct { + values *struct { + result1 string + result2 error + } + sequence uint32 + doFn moqGenericParamsFn_doFn[S, B] + doReturnFn moqGenericParamsFn_doReturnFn[S, B] + }{sequence: sequence, doReturnFn: fn}) + return r } -// moqUsual_Nothing_resultsByParams contains the results for a given set of -// parameters for the Usual type -type moqUsual_Nothing_resultsByParams struct { - anyCount int - anyParams uint64 - results map[moqUsual_Nothing_paramsKey]*moqUsual_Nothing_results -} +func (r *moqGenericParamsFn_fnRecorder[S, B]) findResults() { + r.moq.scene.T.Helper() + if r.results != nil { + r.results.repeat.Increment(r.moq.scene.T) + return + } -// moqUsual_Nothing_doFn defines the type of function needed when calling andDo -// for the Usual type -type moqUsual_Nothing_doFn func() + anyCount := bits.OnesCount64(r.anyParams) + insertAt := -1 + var results *moqGenericParamsFn_resultsByParams[S, B] + for n, res := range r.moq.resultsByParams { + if res.anyParams == r.anyParams { + results = &res + break + } + if res.anyCount > anyCount { + insertAt = n + } + } + if results == nil { + results = &moqGenericParamsFn_resultsByParams[S, B]{ + anyCount: anyCount, + anyParams: r.anyParams, + results: map[moqGenericParamsFn_paramsKey[S, B]]*moqGenericParamsFn_results[S, B]{}, + } + r.moq.resultsByParams = append(r.moq.resultsByParams, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams) { + copy(r.moq.resultsByParams[insertAt+1:], r.moq.resultsByParams[insertAt:0]) + r.moq.resultsByParams[insertAt] = *results + } + } -// moqUsual_Nothing_doReturnFn defines the type of function needed when calling -// doReturnResults for the Usual type -type moqUsual_Nothing_doReturnFn func() + paramsKey := r.moq.paramsKey(r.params, r.anyParams) -// moqUsual_Nothing_results holds the results of the Usual type -type moqUsual_Nothing_results struct { - params moqUsual_Nothing_params - results []struct { - values *struct{} - sequence uint32 - doFn moqUsual_Nothing_doFn - doReturnFn moqUsual_Nothing_doReturnFn + var ok bool + r.results, ok = results.results[paramsKey] + if !ok { + r.results = &moqGenericParamsFn_results[S, B]{ + params: r.params, + results: nil, + index: 0, + repeat: &moq.RepeatVal{}, + } + results.results[paramsKey] = r.results } - index uint32 - repeat *moq.RepeatVal -} -// moqUsual_Nothing_fnRecorder routes recorded function calls to the moqUsual -// moq -type moqUsual_Nothing_fnRecorder struct { - params moqUsual_Nothing_params - anyParams uint64 - sequence bool - results *moqUsual_Nothing_results - moq *moqUsual + r.results.repeat.Increment(r.moq.scene.T) } -// moqUsual_Nothing_anyParams isolates the any params functions of the Usual -// type -type moqUsual_Nothing_anyParams struct { - recorder *moqUsual_Nothing_fnRecorder +func (r *moqGenericParamsFn_fnRecorder[S, B]) repeat(repeaters ...moq.Repeater) *moqGenericParamsFn_fnRecorder[S, B] { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") + return nil + } + r.results.repeat.Repeat(r.moq.scene.T, repeaters) + last := r.results.results[len(r.results.results)-1] + for n := 0; n < r.results.repeat.ResultCount-1; n++ { + if r.sequence { + last = struct { + values *struct { + result1 string + result2 error + } + sequence uint32 + doFn moqGenericParamsFn_doFn[S, B] + doReturnFn moqGenericParamsFn_doReturnFn[S, B] + }{ + values: last.values, + sequence: r.moq.scene.NextRecorderSequence(), + } + } + r.results.results = append(r.results.results, last) + } + return r } -// moqUsual_Variadic_params holds the params of the Usual type -type moqUsual_Variadic_params struct { - other bool - args []string +func (m *moqGenericParamsFn[S, B]) prettyParams(params moqGenericParamsFn_params[S, B]) string { + return fmt.Sprintf("GenericParamsFn(%#v, %#v)", params.param1, params.param2) } -// moqUsual_Variadic_paramsKey holds the map key params of the Usual type -type moqUsual_Variadic_paramsKey struct { - params struct{ other bool } - hashes struct { - other hash.Hash - args hash.Hash +func (m *moqGenericParamsFn[S, B]) paramsKey(params moqGenericParamsFn_params[S, B], anyParams uint64) moqGenericParamsFn_paramsKey[S, B] { + m.scene.T.Helper() + var param1UsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.runtime.parameterIndexing.param1 == moq.ParamIndexByValue { + m.scene.T.Fatalf("The param1 parameter can't be indexed by value") + } + param1UsedHash = hash.DeepHash(params.param1) + } + var param2UsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.runtime.parameterIndexing.param2 == moq.ParamIndexByValue { + m.scene.T.Fatalf("The param2 parameter can't be indexed by value") + } + param2UsedHash = hash.DeepHash(params.param2) + } + return moqGenericParamsFn_paramsKey[S, B]{ + params: struct{}{}, + hashes: struct { + param1 hash.Hash + param2 hash.Hash + }{ + param1: param1UsedHash, + param2: param2UsedHash, + }, } } -// moqUsual_Variadic_resultsByParams contains the results for a given set of -// parameters for the Usual type -type moqUsual_Variadic_resultsByParams struct { - anyCount int - anyParams uint64 - results map[moqUsual_Variadic_paramsKey]*moqUsual_Variadic_results +// Reset resets the state of the moq +func (m *moqGenericParamsFn[S, B]) Reset() { m.resultsByParams = nil } + +// AssertExpectationsMet asserts that all expectations have been met +func (m *moqGenericParamsFn[S, B]) AssertExpectationsMet() { + m.scene.T.Helper() + for _, res := range m.resultsByParams { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams(results.params)) + } + } + } } -// moqUsual_Variadic_doFn defines the type of function needed when calling -// andDo for the Usual type -type moqUsual_Variadic_doFn func(other bool, args ...string) +// moqPartialGenericParamsFn holds the state of a moq of the +// PartialGenericParamsFn type +type moqPartialGenericParamsFn[S any] struct { + scene *moq.Scene + config moq.Config + moq *moqPartialGenericParamsFn_mock[S] -// moqUsual_Variadic_doReturnFn defines the type of function needed when -// calling doReturnResults for the Usual type -type moqUsual_Variadic_doReturnFn func(other bool, args ...string) (sResult string, err error) + resultsByParams []moqPartialGenericParamsFn_resultsByParams[S] -// moqUsual_Variadic_results holds the results of the Usual type -type moqUsual_Variadic_results struct { - params moqUsual_Variadic_params - results []struct { - values *struct { - sResult string - err error + runtime struct { + parameterIndexing struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing } - sequence uint32 - doFn moqUsual_Variadic_doFn - doReturnFn moqUsual_Variadic_doReturnFn } - index uint32 - repeat *moq.RepeatVal -} - -// moqUsual_Variadic_fnRecorder routes recorded function calls to the moqUsual -// moq -type moqUsual_Variadic_fnRecorder struct { - params moqUsual_Variadic_params - anyParams uint64 - sequence bool - results *moqUsual_Variadic_results - moq *moqUsual } -// moqUsual_Variadic_anyParams isolates the any params functions of the Usual -// type -type moqUsual_Variadic_anyParams struct { - recorder *moqUsual_Variadic_fnRecorder +// moqPartialGenericParamsFn_mock isolates the mock interface of the +// PartialGenericParamsFn type +type moqPartialGenericParamsFn_mock[S any] struct { + moq *moqPartialGenericParamsFn[S] } -// moqUsual_RepeatedIds_params holds the params of the Usual type -type moqUsual_RepeatedIds_params struct { - sParam1, sParam2 string - bParam bool +// moqPartialGenericParamsFn_params holds the params of the +// PartialGenericParamsFn type +type moqPartialGenericParamsFn_params[S any] struct { + param1 S + param2 bool } -// moqUsual_RepeatedIds_paramsKey holds the map key params of the Usual type -type moqUsual_RepeatedIds_paramsKey struct { - params struct { - sParam1, sParam2 string - bParam bool - } +// moqPartialGenericParamsFn_paramsKey holds the map key params of the +// PartialGenericParamsFn type +type moqPartialGenericParamsFn_paramsKey[S any] struct { + params struct{ param2 bool } hashes struct { - sParam1, sParam2 hash.Hash - bParam hash.Hash + param1 hash.Hash + param2 hash.Hash } } -// moqUsual_RepeatedIds_resultsByParams contains the results for a given set of -// parameters for the Usual type -type moqUsual_RepeatedIds_resultsByParams struct { +// moqPartialGenericParamsFn_resultsByParams contains the results for a given +// set of parameters for the PartialGenericParamsFn type +type moqPartialGenericParamsFn_resultsByParams[S any] struct { anyCount int anyParams uint64 - results map[moqUsual_RepeatedIds_paramsKey]*moqUsual_RepeatedIds_results + results map[moqPartialGenericParamsFn_paramsKey[S]]*moqPartialGenericParamsFn_results[S] } -// moqUsual_RepeatedIds_doFn defines the type of function needed when calling -// andDo for the Usual type -type moqUsual_RepeatedIds_doFn func(sParam1, sParam2 string, bParam bool) +// moqPartialGenericParamsFn_doFn defines the type of function needed when +// calling andDo for the PartialGenericParamsFn type +type moqPartialGenericParamsFn_doFn[S any] func(S, bool) -// moqUsual_RepeatedIds_doReturnFn defines the type of function needed when -// calling doReturnResults for the Usual type -type moqUsual_RepeatedIds_doReturnFn func(sParam1, sParam2 string, bParam bool) (sResult1, sResult2 string, err error) +// moqPartialGenericParamsFn_doReturnFn defines the type of function needed +// when calling doReturnResults for the PartialGenericParamsFn type +type moqPartialGenericParamsFn_doReturnFn[S any] func(S, bool) (string, error) -// moqUsual_RepeatedIds_results holds the results of the Usual type -type moqUsual_RepeatedIds_results struct { - params moqUsual_RepeatedIds_params +// moqPartialGenericParamsFn_results holds the results of the +// PartialGenericParamsFn type +type moqPartialGenericParamsFn_results[S any] struct { + params moqPartialGenericParamsFn_params[S] results []struct { values *struct { - sResult1, sResult2 string - err error + result1 string + result2 error } sequence uint32 - doFn moqUsual_RepeatedIds_doFn - doReturnFn moqUsual_RepeatedIds_doReturnFn + doFn moqPartialGenericParamsFn_doFn[S] + doReturnFn moqPartialGenericParamsFn_doReturnFn[S] } index uint32 repeat *moq.RepeatVal } -// moqUsual_RepeatedIds_fnRecorder routes recorded function calls to the -// moqUsual moq -type moqUsual_RepeatedIds_fnRecorder struct { - params moqUsual_RepeatedIds_params +// moqPartialGenericParamsFn_fnRecorder routes recorded function calls to the +// moqPartialGenericParamsFn moq +type moqPartialGenericParamsFn_fnRecorder[S any] struct { + params moqPartialGenericParamsFn_params[S] anyParams uint64 sequence bool - results *moqUsual_RepeatedIds_results - moq *moqUsual -} - -// moqUsual_RepeatedIds_anyParams isolates the any params functions of the -// Usual type -type moqUsual_RepeatedIds_anyParams struct { - recorder *moqUsual_RepeatedIds_fnRecorder + results *moqPartialGenericParamsFn_results[S] + moq *moqPartialGenericParamsFn[S] } -// moqUsual_Times_params holds the params of the Usual type -type moqUsual_Times_params struct { - sParam string - times bool +// moqPartialGenericParamsFn_anyParams isolates the any params functions of the +// PartialGenericParamsFn type +type moqPartialGenericParamsFn_anyParams[S any] struct { + recorder *moqPartialGenericParamsFn_fnRecorder[S] } -// moqUsual_Times_paramsKey holds the map key params of the Usual type -type moqUsual_Times_paramsKey struct { - params struct { - sParam string - times bool +// newMoqPartialGenericParamsFn creates a new moq of the PartialGenericParamsFn +// type +func newMoqPartialGenericParamsFn[S any](scene *moq.Scene, config *moq.Config) *moqPartialGenericParamsFn[S] { + if config == nil { + config = &moq.Config{} } - hashes struct { - sParam hash.Hash - times hash.Hash + m := &moqPartialGenericParamsFn[S]{ + scene: scene, + config: *config, + moq: &moqPartialGenericParamsFn_mock[S]{}, + + runtime: struct { + parameterIndexing struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } + }{parameterIndexing: struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + }{ + param1: moq.ParamIndexByHash, + param2: moq.ParamIndexByValue, + }}, } + m.moq.moq = m + + scene.AddMoq(m) + return m } -// moqUsual_Times_resultsByParams contains the results for a given set of -// parameters for the Usual type -type moqUsual_Times_resultsByParams struct { - anyCount int - anyParams uint64 - results map[moqUsual_Times_paramsKey]*moqUsual_Times_results +// mock returns the moq implementation of the PartialGenericParamsFn type +func (m *moqPartialGenericParamsFn[S]) mock() testmoqs.PartialGenericParamsFn[S] { + return func(param1 S, param2 bool) (string, error) { + m.scene.T.Helper() + moq := &moqPartialGenericParamsFn_mock[S]{moq: m} + return moq.fn(param1, param2) + } } -// moqUsual_Times_doFn defines the type of function needed when calling andDo -// for the Usual type -type moqUsual_Times_doFn func(sParam string, times bool) +func (m *moqPartialGenericParamsFn_mock[S]) fn(param1 S, param2 bool) (result1 string, result2 error) { + m.moq.scene.T.Helper() + params := moqPartialGenericParamsFn_params[S]{ + param1: param1, + param2: param2, + } + var results *moqPartialGenericParamsFn_results[S] + for _, resultsByParams := range m.moq.resultsByParams { + paramsKey := m.moq.paramsKey(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams(params)) + } + return + } -// moqUsual_Times_doReturnFn defines the type of function needed when calling -// doReturnResults for the Usual type -type moqUsual_Times_doReturnFn func(sParam string, times bool) (sResult string, err error) + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } -// moqUsual_Times_results holds the results of the Usual type -type moqUsual_Times_results struct { - params moqUsual_Times_params - results []struct { - values *struct { - sResult string - err error + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams(params)) } - sequence uint32 - doFn moqUsual_Times_doFn - doReturnFn moqUsual_Times_doReturnFn } - index uint32 - repeat *moq.RepeatVal -} -// moqUsual_Times_fnRecorder routes recorded function calls to the moqUsual moq -type moqUsual_Times_fnRecorder struct { - params moqUsual_Times_params - anyParams uint64 - sequence bool - results *moqUsual_Times_results - moq *moqUsual -} - -// moqUsual_Times_anyParams isolates the any params functions of the Usual type -type moqUsual_Times_anyParams struct { - recorder *moqUsual_Times_fnRecorder -} - -// moqUsual_DifficultParamNames_params holds the params of the Usual type -type moqUsual_DifficultParamNames_params struct { - param1, param2 bool - param3 string - param, param5, param6 int - param7, param8, param9 float32 -} + if result.doFn != nil { + result.doFn(param1, param2) + } -// moqUsual_DifficultParamNames_paramsKey holds the map key params of the Usual -// type -type moqUsual_DifficultParamNames_paramsKey struct { - params struct { - param1, param2 bool - param3 string - param, param5, param6 int - param7, param8, param9 float32 + if result.values != nil { + result1 = result.values.result1 + result2 = result.values.result2 } - hashes struct { - param1, param2 hash.Hash - param3 hash.Hash - param, param5, param6 hash.Hash - param7, param8, param9 hash.Hash + if result.doReturnFn != nil { + result1, result2 = result.doReturnFn(param1, param2) } + return } -// moqUsual_DifficultParamNames_resultsByParams contains the results for a -// given set of parameters for the Usual type -type moqUsual_DifficultParamNames_resultsByParams struct { - anyCount int - anyParams uint64 - results map[moqUsual_DifficultParamNames_paramsKey]*moqUsual_DifficultParamNames_results +func (m *moqPartialGenericParamsFn[S]) onCall(param1 S, param2 bool) *moqPartialGenericParamsFn_fnRecorder[S] { + return &moqPartialGenericParamsFn_fnRecorder[S]{ + params: moqPartialGenericParamsFn_params[S]{ + param1: param1, + param2: param2, + }, + sequence: m.config.Sequence == moq.SeqDefaultOn, + moq: m, + } } -// moqUsual_DifficultParamNames_doFn defines the type of function needed when -// calling andDo for the Usual type -type moqUsual_DifficultParamNames_doFn func(m, r bool, sequence string, param, params, i int, result, results, _ float32) - -// moqUsual_DifficultParamNames_doReturnFn defines the type of function needed -// when calling doReturnResults for the Usual type -type moqUsual_DifficultParamNames_doReturnFn func(m, r bool, sequence string, param, params, i int, result, results, _ float32) - -// moqUsual_DifficultParamNames_results holds the results of the Usual type -type moqUsual_DifficultParamNames_results struct { - params moqUsual_DifficultParamNames_params - results []struct { - values *struct{} - sequence uint32 - doFn moqUsual_DifficultParamNames_doFn - doReturnFn moqUsual_DifficultParamNames_doReturnFn +func (r *moqPartialGenericParamsFn_fnRecorder[S]) any() *moqPartialGenericParamsFn_anyParams[S] { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams(r.params)) + return nil } - index uint32 - repeat *moq.RepeatVal + return &moqPartialGenericParamsFn_anyParams[S]{recorder: r} } -// moqUsual_DifficultParamNames_fnRecorder routes recorded function calls to -// the moqUsual moq -type moqUsual_DifficultParamNames_fnRecorder struct { - params moqUsual_DifficultParamNames_params - anyParams uint64 - sequence bool - results *moqUsual_DifficultParamNames_results - moq *moqUsual +func (a *moqPartialGenericParamsFn_anyParams[S]) param1() *moqPartialGenericParamsFn_fnRecorder[S] { + a.recorder.anyParams |= 1 << 0 + return a.recorder } -// moqUsual_DifficultParamNames_anyParams isolates the any params functions of -// the Usual type -type moqUsual_DifficultParamNames_anyParams struct { - recorder *moqUsual_DifficultParamNames_fnRecorder +func (a *moqPartialGenericParamsFn_anyParams[S]) param2() *moqPartialGenericParamsFn_fnRecorder[S] { + a.recorder.anyParams |= 1 << 1 + return a.recorder } -// moqUsual_DifficultResultNames_params holds the params of the Usual type -type moqUsual_DifficultResultNames_params struct{} - -// moqUsual_DifficultResultNames_paramsKey holds the map key params of the -// Usual type -type moqUsual_DifficultResultNames_paramsKey struct { - params struct{} - hashes struct{} +func (r *moqPartialGenericParamsFn_fnRecorder[S]) seq() *moqPartialGenericParamsFn_fnRecorder[S] { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams(r.params)) + return nil + } + r.sequence = true + return r } -// moqUsual_DifficultResultNames_resultsByParams contains the results for a -// given set of parameters for the Usual type -type moqUsual_DifficultResultNames_resultsByParams struct { - anyCount int - anyParams uint64 - results map[moqUsual_DifficultResultNames_paramsKey]*moqUsual_DifficultResultNames_results +func (r *moqPartialGenericParamsFn_fnRecorder[S]) noSeq() *moqPartialGenericParamsFn_fnRecorder[S] { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams(r.params)) + return nil + } + r.sequence = false + return r } -// moqUsual_DifficultResultNames_doFn defines the type of function needed when -// calling andDo for the Usual type -type moqUsual_DifficultResultNames_doFn func() +func (r *moqPartialGenericParamsFn_fnRecorder[S]) returnResults(result1 string, result2 error) *moqPartialGenericParamsFn_fnRecorder[S] { + r.moq.scene.T.Helper() + r.findResults() -// moqUsual_DifficultResultNames_doReturnFn defines the type of function needed -// when calling doReturnResults for the Usual type -type moqUsual_DifficultResultNames_doReturnFn func() (m, r string, sequence error, param, params, i int, result, results, _ float32) + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() + } -// moqUsual_DifficultResultNames_results holds the results of the Usual type -type moqUsual_DifficultResultNames_results struct { - params moqUsual_DifficultResultNames_params - results []struct { + r.results.results = append(r.results.results, struct { values *struct { - result1, result2 string - result3 error - param, result5, result6 int - result7, result8, result9 float32 + result1 string + result2 error } sequence uint32 - doFn moqUsual_DifficultResultNames_doFn - doReturnFn moqUsual_DifficultResultNames_doReturnFn - } - index uint32 - repeat *moq.RepeatVal + doFn moqPartialGenericParamsFn_doFn[S] + doReturnFn moqPartialGenericParamsFn_doReturnFn[S] + }{ + values: &struct { + result1 string + result2 error + }{ + result1: result1, + result2: result2, + }, + sequence: sequence, + }) + return r } -// moqUsual_DifficultResultNames_fnRecorder routes recorded function calls to -// the moqUsual moq -type moqUsual_DifficultResultNames_fnRecorder struct { - params moqUsual_DifficultResultNames_params - anyParams uint64 - sequence bool - results *moqUsual_DifficultResultNames_results - moq *moqUsual +func (r *moqPartialGenericParamsFn_fnRecorder[S]) andDo(fn moqPartialGenericParamsFn_doFn[S]) *moqPartialGenericParamsFn_fnRecorder[S] { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") + return nil + } + last := &r.results.results[len(r.results.results)-1] + last.doFn = fn + return r } -// moqUsual_DifficultResultNames_anyParams isolates the any params functions of -// the Usual type -type moqUsual_DifficultResultNames_anyParams struct { - recorder *moqUsual_DifficultResultNames_fnRecorder -} +func (r *moqPartialGenericParamsFn_fnRecorder[S]) doReturnResults(fn moqPartialGenericParamsFn_doReturnFn[S]) *moqPartialGenericParamsFn_fnRecorder[S] { + r.moq.scene.T.Helper() + r.findResults() -// moqUsual_PassByArray_params holds the params of the Usual type -type moqUsual_PassByArray_params struct{ p [3]testmoqs.Params } + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() + } -// moqUsual_PassByArray_paramsKey holds the map key params of the Usual type -type moqUsual_PassByArray_paramsKey struct { - params struct{ p [3]testmoqs.Params } - hashes struct{ p hash.Hash } + r.results.results = append(r.results.results, struct { + values *struct { + result1 string + result2 error + } + sequence uint32 + doFn moqPartialGenericParamsFn_doFn[S] + doReturnFn moqPartialGenericParamsFn_doReturnFn[S] + }{sequence: sequence, doReturnFn: fn}) + return r } -// moqUsual_PassByArray_resultsByParams contains the results for a given set of -// parameters for the Usual type -type moqUsual_PassByArray_resultsByParams struct { - anyCount int - anyParams uint64 - results map[moqUsual_PassByArray_paramsKey]*moqUsual_PassByArray_results -} +func (r *moqPartialGenericParamsFn_fnRecorder[S]) findResults() { + r.moq.scene.T.Helper() + if r.results != nil { + r.results.repeat.Increment(r.moq.scene.T) + return + } -// moqUsual_PassByArray_doFn defines the type of function needed when calling -// andDo for the Usual type -type moqUsual_PassByArray_doFn func(p [3]testmoqs.Params) + anyCount := bits.OnesCount64(r.anyParams) + insertAt := -1 + var results *moqPartialGenericParamsFn_resultsByParams[S] + for n, res := range r.moq.resultsByParams { + if res.anyParams == r.anyParams { + results = &res + break + } + if res.anyCount > anyCount { + insertAt = n + } + } + if results == nil { + results = &moqPartialGenericParamsFn_resultsByParams[S]{ + anyCount: anyCount, + anyParams: r.anyParams, + results: map[moqPartialGenericParamsFn_paramsKey[S]]*moqPartialGenericParamsFn_results[S]{}, + } + r.moq.resultsByParams = append(r.moq.resultsByParams, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams) { + copy(r.moq.resultsByParams[insertAt+1:], r.moq.resultsByParams[insertAt:0]) + r.moq.resultsByParams[insertAt] = *results + } + } -// moqUsual_PassByArray_doReturnFn defines the type of function needed when -// calling doReturnResults for the Usual type -type moqUsual_PassByArray_doReturnFn func(p [3]testmoqs.Params) [3]testmoqs.Results + paramsKey := r.moq.paramsKey(r.params, r.anyParams) -// moqUsual_PassByArray_results holds the results of the Usual type -type moqUsual_PassByArray_results struct { - params moqUsual_PassByArray_params - results []struct { - values *struct { - result1 [3]testmoqs.Results + var ok bool + r.results, ok = results.results[paramsKey] + if !ok { + r.results = &moqPartialGenericParamsFn_results[S]{ + params: r.params, + results: nil, + index: 0, + repeat: &moq.RepeatVal{}, } - sequence uint32 - doFn moqUsual_PassByArray_doFn - doReturnFn moqUsual_PassByArray_doReturnFn + results.results[paramsKey] = r.results } - index uint32 - repeat *moq.RepeatVal -} -// moqUsual_PassByArray_fnRecorder routes recorded function calls to the -// moqUsual moq -type moqUsual_PassByArray_fnRecorder struct { - params moqUsual_PassByArray_params - anyParams uint64 - sequence bool - results *moqUsual_PassByArray_results - moq *moqUsual + r.results.repeat.Increment(r.moq.scene.T) } -// moqUsual_PassByArray_anyParams isolates the any params functions of the -// Usual type -type moqUsual_PassByArray_anyParams struct { - recorder *moqUsual_PassByArray_fnRecorder +func (r *moqPartialGenericParamsFn_fnRecorder[S]) repeat(repeaters ...moq.Repeater) *moqPartialGenericParamsFn_fnRecorder[S] { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") + return nil + } + r.results.repeat.Repeat(r.moq.scene.T, repeaters) + last := r.results.results[len(r.results.results)-1] + for n := 0; n < r.results.repeat.ResultCount-1; n++ { + if r.sequence { + last = struct { + values *struct { + result1 string + result2 error + } + sequence uint32 + doFn moqPartialGenericParamsFn_doFn[S] + doReturnFn moqPartialGenericParamsFn_doReturnFn[S] + }{ + values: last.values, + sequence: r.moq.scene.NextRecorderSequence(), + } + } + r.results.results = append(r.results.results, last) + } + return r } -// moqUsual_PassByChan_params holds the params of the Usual type -type moqUsual_PassByChan_params struct{ p chan testmoqs.Params } - -// moqUsual_PassByChan_paramsKey holds the map key params of the Usual type -type moqUsual_PassByChan_paramsKey struct { - params struct{ p chan testmoqs.Params } - hashes struct{ p hash.Hash } +func (m *moqPartialGenericParamsFn[S]) prettyParams(params moqPartialGenericParamsFn_params[S]) string { + return fmt.Sprintf("PartialGenericParamsFn(%#v, %#v)", params.param1, params.param2) } -// moqUsual_PassByChan_resultsByParams contains the results for a given set of -// parameters for the Usual type -type moqUsual_PassByChan_resultsByParams struct { - anyCount int - anyParams uint64 - results map[moqUsual_PassByChan_paramsKey]*moqUsual_PassByChan_results +func (m *moqPartialGenericParamsFn[S]) paramsKey(params moqPartialGenericParamsFn_params[S], anyParams uint64) moqPartialGenericParamsFn_paramsKey[S] { + m.scene.T.Helper() + var param1UsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.runtime.parameterIndexing.param1 == moq.ParamIndexByValue { + m.scene.T.Fatalf("The param1 parameter can't be indexed by value") + } + param1UsedHash = hash.DeepHash(params.param1) + } + var param2Used bool + var param2UsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.runtime.parameterIndexing.param2 == moq.ParamIndexByValue { + param2Used = params.param2 + } else { + param2UsedHash = hash.DeepHash(params.param2) + } + } + return moqPartialGenericParamsFn_paramsKey[S]{ + params: struct{ param2 bool }{ + param2: param2Used, + }, + hashes: struct { + param1 hash.Hash + param2 hash.Hash + }{ + param1: param1UsedHash, + param2: param2UsedHash, + }, + } } -// moqUsual_PassByChan_doFn defines the type of function needed when calling -// andDo for the Usual type -type moqUsual_PassByChan_doFn func(p chan testmoqs.Params) - -// moqUsual_PassByChan_doReturnFn defines the type of function needed when -// calling doReturnResults for the Usual type -type moqUsual_PassByChan_doReturnFn func(p chan testmoqs.Params) chan testmoqs.Results +// Reset resets the state of the moq +func (m *moqPartialGenericParamsFn[S]) Reset() { m.resultsByParams = nil } -// moqUsual_PassByChan_results holds the results of the Usual type -type moqUsual_PassByChan_results struct { - params moqUsual_PassByChan_params - results []struct { - values *struct { - result1 chan testmoqs.Results +// AssertExpectationsMet asserts that all expectations have been met +func (m *moqPartialGenericParamsFn[S]) AssertExpectationsMet() { + m.scene.T.Helper() + for _, res := range m.resultsByParams { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams(results.params)) + } } - sequence uint32 - doFn moqUsual_PassByChan_doFn - doReturnFn moqUsual_PassByChan_doReturnFn } - index uint32 - repeat *moq.RepeatVal } -// moqUsual_PassByChan_fnRecorder routes recorded function calls to the -// moqUsual moq -type moqUsual_PassByChan_fnRecorder struct { - params moqUsual_PassByChan_params - anyParams uint64 - sequence bool - results *moqUsual_PassByChan_results - moq *moqUsual +// moqGenericResultsFn holds the state of a moq of the GenericResultsFn type +type moqGenericResultsFn[S ~string, E error] struct { + scene *moq.Scene + config moq.Config + moq *moqGenericResultsFn_mock[S, E] + + resultsByParams []moqGenericResultsFn_resultsByParams[S, E] + + runtime struct { + parameterIndexing struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } + } } -// moqUsual_PassByChan_anyParams isolates the any params functions of the Usual +// moqGenericResultsFn_mock isolates the mock interface of the GenericResultsFn // type -type moqUsual_PassByChan_anyParams struct { - recorder *moqUsual_PassByChan_fnRecorder +type moqGenericResultsFn_mock[S ~string, E error] struct { + moq *moqGenericResultsFn[S, E] } -// moqUsual_PassByEllipsis_params holds the params of the Usual type -type moqUsual_PassByEllipsis_params struct{ p []testmoqs.Params } +// moqGenericResultsFn_params holds the params of the GenericResultsFn type +type moqGenericResultsFn_params[S ~string, E error] struct { + param1 string + param2 bool +} -// moqUsual_PassByEllipsis_paramsKey holds the map key params of the Usual type -type moqUsual_PassByEllipsis_paramsKey struct { - params struct{} - hashes struct{ p hash.Hash } +// moqGenericResultsFn_paramsKey holds the map key params of the +// GenericResultsFn type +type moqGenericResultsFn_paramsKey[S ~string, E error] struct { + params struct { + param1 string + param2 bool + } + hashes struct { + param1 hash.Hash + param2 hash.Hash + } } -// moqUsual_PassByEllipsis_resultsByParams contains the results for a given set -// of parameters for the Usual type -type moqUsual_PassByEllipsis_resultsByParams struct { +// moqGenericResultsFn_resultsByParams contains the results for a given set of +// parameters for the GenericResultsFn type +type moqGenericResultsFn_resultsByParams[S ~string, E error] struct { anyCount int anyParams uint64 - results map[moqUsual_PassByEllipsis_paramsKey]*moqUsual_PassByEllipsis_results + results map[moqGenericResultsFn_paramsKey[S, E]]*moqGenericResultsFn_results[S, E] } -// moqUsual_PassByEllipsis_doFn defines the type of function needed when -// calling andDo for the Usual type -type moqUsual_PassByEllipsis_doFn func(p ...testmoqs.Params) +// moqGenericResultsFn_doFn defines the type of function needed when calling +// andDo for the GenericResultsFn type +type moqGenericResultsFn_doFn[S ~string, E error] func(string, bool) -// moqUsual_PassByEllipsis_doReturnFn defines the type of function needed when -// calling doReturnResults for the Usual type -type moqUsual_PassByEllipsis_doReturnFn func(p ...testmoqs.Params) (string, error) +// moqGenericResultsFn_doReturnFn defines the type of function needed when +// calling doReturnResults for the GenericResultsFn type +type moqGenericResultsFn_doReturnFn[S ~string, E error] func(string, bool) (S, E) -// moqUsual_PassByEllipsis_results holds the results of the Usual type -type moqUsual_PassByEllipsis_results struct { - params moqUsual_PassByEllipsis_params +// moqGenericResultsFn_results holds the results of the GenericResultsFn type +type moqGenericResultsFn_results[S ~string, E error] struct { + params moqGenericResultsFn_params[S, E] results []struct { values *struct { - result1 string - result2 error + result1 S + result2 E } sequence uint32 - doFn moqUsual_PassByEllipsis_doFn - doReturnFn moqUsual_PassByEllipsis_doReturnFn + doFn moqGenericResultsFn_doFn[S, E] + doReturnFn moqGenericResultsFn_doReturnFn[S, E] } index uint32 repeat *moq.RepeatVal } -// moqUsual_PassByEllipsis_fnRecorder routes recorded function calls to the -// moqUsual moq -type moqUsual_PassByEllipsis_fnRecorder struct { - params moqUsual_PassByEllipsis_params +// moqGenericResultsFn_fnRecorder routes recorded function calls to the +// moqGenericResultsFn moq +type moqGenericResultsFn_fnRecorder[S ~string, E error] struct { + params moqGenericResultsFn_params[S, E] anyParams uint64 sequence bool - results *moqUsual_PassByEllipsis_results - moq *moqUsual + results *moqGenericResultsFn_results[S, E] + moq *moqGenericResultsFn[S, E] } -// moqUsual_PassByEllipsis_anyParams isolates the any params functions of the -// Usual type -type moqUsual_PassByEllipsis_anyParams struct { - recorder *moqUsual_PassByEllipsis_fnRecorder +// moqGenericResultsFn_anyParams isolates the any params functions of the +// GenericResultsFn type +type moqGenericResultsFn_anyParams[S ~string, E error] struct { + recorder *moqGenericResultsFn_fnRecorder[S, E] } -// moqUsual_PassByMap_params holds the params of the Usual type -type moqUsual_PassByMap_params struct{ p map[string]testmoqs.Params } +// newMoqGenericResultsFn creates a new moq of the GenericResultsFn type +func newMoqGenericResultsFn[S ~string, E error](scene *moq.Scene, config *moq.Config) *moqGenericResultsFn[S, E] { + if config == nil { + config = &moq.Config{} + } + m := &moqGenericResultsFn[S, E]{ + scene: scene, + config: *config, + moq: &moqGenericResultsFn_mock[S, E]{}, -// moqUsual_PassByMap_paramsKey holds the map key params of the Usual type -type moqUsual_PassByMap_paramsKey struct { - params struct{} - hashes struct{ p hash.Hash } + runtime: struct { + parameterIndexing struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } + }{parameterIndexing: struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + }{ + param1: moq.ParamIndexByValue, + param2: moq.ParamIndexByValue, + }}, + } + m.moq.moq = m + + scene.AddMoq(m) + return m } -// moqUsual_PassByMap_resultsByParams contains the results for a given set of -// parameters for the Usual type -type moqUsual_PassByMap_resultsByParams struct { - anyCount int - anyParams uint64 - results map[moqUsual_PassByMap_paramsKey]*moqUsual_PassByMap_results +// mock returns the moq implementation of the GenericResultsFn type +func (m *moqGenericResultsFn[S, E]) mock() testmoqs.GenericResultsFn[S, E] { + return func(param1 string, param2 bool) (S, E) { + m.scene.T.Helper() + moq := &moqGenericResultsFn_mock[S, E]{moq: m} + return moq.fn(param1, param2) + } } -// moqUsual_PassByMap_doFn defines the type of function needed when calling -// andDo for the Usual type -type moqUsual_PassByMap_doFn func(p map[string]testmoqs.Params) +func (m *moqGenericResultsFn_mock[S, E]) fn(param1 string, param2 bool) (result1 S, result2 E) { + m.moq.scene.T.Helper() + params := moqGenericResultsFn_params[S, E]{ + param1: param1, + param2: param2, + } + var results *moqGenericResultsFn_results[S, E] + for _, resultsByParams := range m.moq.resultsByParams { + paramsKey := m.moq.paramsKey(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams(params)) + } + return + } -// moqUsual_PassByMap_doReturnFn defines the type of function needed when -// calling doReturnResults for the Usual type -type moqUsual_PassByMap_doReturnFn func(p map[string]testmoqs.Params) map[string]testmoqs.Results + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } -// moqUsual_PassByMap_results holds the results of the Usual type -type moqUsual_PassByMap_results struct { - params moqUsual_PassByMap_params - results []struct { - values *struct { - result1 map[string]testmoqs.Results + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams(params)) } - sequence uint32 - doFn moqUsual_PassByMap_doFn - doReturnFn moqUsual_PassByMap_doReturnFn } - index uint32 - repeat *moq.RepeatVal -} -// moqUsual_PassByMap_fnRecorder routes recorded function calls to the moqUsual -// moq -type moqUsual_PassByMap_fnRecorder struct { - params moqUsual_PassByMap_params - anyParams uint64 - sequence bool - results *moqUsual_PassByMap_results - moq *moqUsual -} - -// moqUsual_PassByMap_anyParams isolates the any params functions of the Usual -// type -type moqUsual_PassByMap_anyParams struct { - recorder *moqUsual_PassByMap_fnRecorder -} - -// moqUsual_PassByReference_params holds the params of the Usual type -type moqUsual_PassByReference_params struct{ p *testmoqs.Params } + if result.doFn != nil { + result.doFn(param1, param2) + } -// moqUsual_PassByReference_paramsKey holds the map key params of the Usual -// type -type moqUsual_PassByReference_paramsKey struct { - params struct{ p *testmoqs.Params } - hashes struct{ p hash.Hash } + if result.values != nil { + result1 = result.values.result1 + result2 = result.values.result2 + } + if result.doReturnFn != nil { + result1, result2 = result.doReturnFn(param1, param2) + } + return } -// moqUsual_PassByReference_resultsByParams contains the results for a given -// set of parameters for the Usual type -type moqUsual_PassByReference_resultsByParams struct { - anyCount int - anyParams uint64 - results map[moqUsual_PassByReference_paramsKey]*moqUsual_PassByReference_results +func (m *moqGenericResultsFn[S, E]) onCall(param1 string, param2 bool) *moqGenericResultsFn_fnRecorder[S, E] { + return &moqGenericResultsFn_fnRecorder[S, E]{ + params: moqGenericResultsFn_params[S, E]{ + param1: param1, + param2: param2, + }, + sequence: m.config.Sequence == moq.SeqDefaultOn, + moq: m, + } } -// moqUsual_PassByReference_doFn defines the type of function needed when -// calling andDo for the Usual type -type moqUsual_PassByReference_doFn func(p *testmoqs.Params) - -// moqUsual_PassByReference_doReturnFn defines the type of function needed when -// calling doReturnResults for the Usual type -type moqUsual_PassByReference_doReturnFn func(p *testmoqs.Params) *testmoqs.Results - -// moqUsual_PassByReference_results holds the results of the Usual type -type moqUsual_PassByReference_results struct { - params moqUsual_PassByReference_params - results []struct { - values *struct { - result1 *testmoqs.Results - } - sequence uint32 - doFn moqUsual_PassByReference_doFn - doReturnFn moqUsual_PassByReference_doReturnFn +func (r *moqGenericResultsFn_fnRecorder[S, E]) any() *moqGenericResultsFn_anyParams[S, E] { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams(r.params)) + return nil } - index uint32 - repeat *moq.RepeatVal + return &moqGenericResultsFn_anyParams[S, E]{recorder: r} } -// moqUsual_PassByReference_fnRecorder routes recorded function calls to the -// moqUsual moq -type moqUsual_PassByReference_fnRecorder struct { - params moqUsual_PassByReference_params - anyParams uint64 - sequence bool - results *moqUsual_PassByReference_results - moq *moqUsual +func (a *moqGenericResultsFn_anyParams[S, E]) param1() *moqGenericResultsFn_fnRecorder[S, E] { + a.recorder.anyParams |= 1 << 0 + return a.recorder } -// moqUsual_PassByReference_anyParams isolates the any params functions of the -// Usual type -type moqUsual_PassByReference_anyParams struct { - recorder *moqUsual_PassByReference_fnRecorder +func (a *moqGenericResultsFn_anyParams[S, E]) param2() *moqGenericResultsFn_fnRecorder[S, E] { + a.recorder.anyParams |= 1 << 1 + return a.recorder } -// moqUsual_PassBySlice_params holds the params of the Usual type -type moqUsual_PassBySlice_params struct{ p []testmoqs.Params } - -// moqUsual_PassBySlice_paramsKey holds the map key params of the Usual type -type moqUsual_PassBySlice_paramsKey struct { - params struct{} - hashes struct{ p hash.Hash } +func (r *moqGenericResultsFn_fnRecorder[S, E]) seq() *moqGenericResultsFn_fnRecorder[S, E] { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams(r.params)) + return nil + } + r.sequence = true + return r } -// moqUsual_PassBySlice_resultsByParams contains the results for a given set of -// parameters for the Usual type -type moqUsual_PassBySlice_resultsByParams struct { - anyCount int - anyParams uint64 - results map[moqUsual_PassBySlice_paramsKey]*moqUsual_PassBySlice_results +func (r *moqGenericResultsFn_fnRecorder[S, E]) noSeq() *moqGenericResultsFn_fnRecorder[S, E] { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams(r.params)) + return nil + } + r.sequence = false + return r } -// moqUsual_PassBySlice_doFn defines the type of function needed when calling -// andDo for the Usual type -type moqUsual_PassBySlice_doFn func(p []testmoqs.Params) +func (r *moqGenericResultsFn_fnRecorder[S, E]) returnResults(result1 S, result2 E) *moqGenericResultsFn_fnRecorder[S, E] { + r.moq.scene.T.Helper() + r.findResults() -// moqUsual_PassBySlice_doReturnFn defines the type of function needed when -// calling doReturnResults for the Usual type -type moqUsual_PassBySlice_doReturnFn func(p []testmoqs.Params) []testmoqs.Results + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() + } -// moqUsual_PassBySlice_results holds the results of the Usual type -type moqUsual_PassBySlice_results struct { - params moqUsual_PassBySlice_params - results []struct { + r.results.results = append(r.results.results, struct { values *struct { - result1 []testmoqs.Results + result1 S + result2 E } sequence uint32 - doFn moqUsual_PassBySlice_doFn - doReturnFn moqUsual_PassBySlice_doReturnFn - } - index uint32 - repeat *moq.RepeatVal + doFn moqGenericResultsFn_doFn[S, E] + doReturnFn moqGenericResultsFn_doReturnFn[S, E] + }{ + values: &struct { + result1 S + result2 E + }{ + result1: result1, + result2: result2, + }, + sequence: sequence, + }) + return r } -// moqUsual_PassBySlice_fnRecorder routes recorded function calls to the -// moqUsual moq -type moqUsual_PassBySlice_fnRecorder struct { - params moqUsual_PassBySlice_params - anyParams uint64 - sequence bool - results *moqUsual_PassBySlice_results - moq *moqUsual +func (r *moqGenericResultsFn_fnRecorder[S, E]) andDo(fn moqGenericResultsFn_doFn[S, E]) *moqGenericResultsFn_fnRecorder[S, E] { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") + return nil + } + last := &r.results.results[len(r.results.results)-1] + last.doFn = fn + return r } -// moqUsual_PassBySlice_anyParams isolates the any params functions of the -// Usual type -type moqUsual_PassBySlice_anyParams struct { - recorder *moqUsual_PassBySlice_fnRecorder -} +func (r *moqGenericResultsFn_fnRecorder[S, E]) doReturnResults(fn moqGenericResultsFn_doReturnFn[S, E]) *moqGenericResultsFn_fnRecorder[S, E] { + r.moq.scene.T.Helper() + r.findResults() -// moqUsual_PassByValue_params holds the params of the Usual type -type moqUsual_PassByValue_params struct{ p testmoqs.Params } + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() + } -// moqUsual_PassByValue_paramsKey holds the map key params of the Usual type -type moqUsual_PassByValue_paramsKey struct { - params struct{ p testmoqs.Params } - hashes struct{ p hash.Hash } + r.results.results = append(r.results.results, struct { + values *struct { + result1 S + result2 E + } + sequence uint32 + doFn moqGenericResultsFn_doFn[S, E] + doReturnFn moqGenericResultsFn_doReturnFn[S, E] + }{sequence: sequence, doReturnFn: fn}) + return r } -// moqUsual_PassByValue_resultsByParams contains the results for a given set of -// parameters for the Usual type -type moqUsual_PassByValue_resultsByParams struct { - anyCount int - anyParams uint64 - results map[moqUsual_PassByValue_paramsKey]*moqUsual_PassByValue_results -} +func (r *moqGenericResultsFn_fnRecorder[S, E]) findResults() { + r.moq.scene.T.Helper() + if r.results != nil { + r.results.repeat.Increment(r.moq.scene.T) + return + } -// moqUsual_PassByValue_doFn defines the type of function needed when calling -// andDo for the Usual type -type moqUsual_PassByValue_doFn func(p testmoqs.Params) + anyCount := bits.OnesCount64(r.anyParams) + insertAt := -1 + var results *moqGenericResultsFn_resultsByParams[S, E] + for n, res := range r.moq.resultsByParams { + if res.anyParams == r.anyParams { + results = &res + break + } + if res.anyCount > anyCount { + insertAt = n + } + } + if results == nil { + results = &moqGenericResultsFn_resultsByParams[S, E]{ + anyCount: anyCount, + anyParams: r.anyParams, + results: map[moqGenericResultsFn_paramsKey[S, E]]*moqGenericResultsFn_results[S, E]{}, + } + r.moq.resultsByParams = append(r.moq.resultsByParams, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams) { + copy(r.moq.resultsByParams[insertAt+1:], r.moq.resultsByParams[insertAt:0]) + r.moq.resultsByParams[insertAt] = *results + } + } -// moqUsual_PassByValue_doReturnFn defines the type of function needed when -// calling doReturnResults for the Usual type -type moqUsual_PassByValue_doReturnFn func(p testmoqs.Params) testmoqs.Results + paramsKey := r.moq.paramsKey(r.params, r.anyParams) -// moqUsual_PassByValue_results holds the results of the Usual type -type moqUsual_PassByValue_results struct { - params moqUsual_PassByValue_params - results []struct { - values *struct { - result1 testmoqs.Results + var ok bool + r.results, ok = results.results[paramsKey] + if !ok { + r.results = &moqGenericResultsFn_results[S, E]{ + params: r.params, + results: nil, + index: 0, + repeat: &moq.RepeatVal{}, } - sequence uint32 - doFn moqUsual_PassByValue_doFn - doReturnFn moqUsual_PassByValue_doReturnFn + results.results[paramsKey] = r.results } - index uint32 - repeat *moq.RepeatVal -} -// moqUsual_PassByValue_fnRecorder routes recorded function calls to the -// moqUsual moq -type moqUsual_PassByValue_fnRecorder struct { - params moqUsual_PassByValue_params - anyParams uint64 - sequence bool - results *moqUsual_PassByValue_results - moq *moqUsual + r.results.repeat.Increment(r.moq.scene.T) } -// moqUsual_PassByValue_anyParams isolates the any params functions of the -// Usual type -type moqUsual_PassByValue_anyParams struct { - recorder *moqUsual_PassByValue_fnRecorder -} - -// moqUsual_InterfaceParam_params holds the params of the Usual type -type moqUsual_InterfaceParam_params struct{ w io.Writer } - -// moqUsual_InterfaceParam_paramsKey holds the map key params of the Usual type -type moqUsual_InterfaceParam_paramsKey struct { - params struct{ w io.Writer } - hashes struct{ w hash.Hash } +func (r *moqGenericResultsFn_fnRecorder[S, E]) repeat(repeaters ...moq.Repeater) *moqGenericResultsFn_fnRecorder[S, E] { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") + return nil + } + r.results.repeat.Repeat(r.moq.scene.T, repeaters) + last := r.results.results[len(r.results.results)-1] + for n := 0; n < r.results.repeat.ResultCount-1; n++ { + if r.sequence { + last = struct { + values *struct { + result1 S + result2 E + } + sequence uint32 + doFn moqGenericResultsFn_doFn[S, E] + doReturnFn moqGenericResultsFn_doReturnFn[S, E] + }{ + values: last.values, + sequence: r.moq.scene.NextRecorderSequence(), + } + } + r.results.results = append(r.results.results, last) + } + return r } -// moqUsual_InterfaceParam_resultsByParams contains the results for a given set -// of parameters for the Usual type -type moqUsual_InterfaceParam_resultsByParams struct { - anyCount int - anyParams uint64 - results map[moqUsual_InterfaceParam_paramsKey]*moqUsual_InterfaceParam_results +func (m *moqGenericResultsFn[S, E]) prettyParams(params moqGenericResultsFn_params[S, E]) string { + return fmt.Sprintf("GenericResultsFn(%#v, %#v)", params.param1, params.param2) } -// moqUsual_InterfaceParam_doFn defines the type of function needed when -// calling andDo for the Usual type -type moqUsual_InterfaceParam_doFn func(w io.Writer) +func (m *moqGenericResultsFn[S, E]) paramsKey(params moqGenericResultsFn_params[S, E], anyParams uint64) moqGenericResultsFn_paramsKey[S, E] { + m.scene.T.Helper() + var param1Used string + var param1UsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.runtime.parameterIndexing.param1 == moq.ParamIndexByValue { + param1Used = params.param1 + } else { + param1UsedHash = hash.DeepHash(params.param1) + } + } + var param2Used bool + var param2UsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.runtime.parameterIndexing.param2 == moq.ParamIndexByValue { + param2Used = params.param2 + } else { + param2UsedHash = hash.DeepHash(params.param2) + } + } + return moqGenericResultsFn_paramsKey[S, E]{ + params: struct { + param1 string + param2 bool + }{ + param1: param1Used, + param2: param2Used, + }, + hashes: struct { + param1 hash.Hash + param2 hash.Hash + }{ + param1: param1UsedHash, + param2: param2UsedHash, + }, + } +} -// moqUsual_InterfaceParam_doReturnFn defines the type of function needed when -// calling doReturnResults for the Usual type -type moqUsual_InterfaceParam_doReturnFn func(w io.Writer) (sResult string, err error) +// Reset resets the state of the moq +func (m *moqGenericResultsFn[S, E]) Reset() { m.resultsByParams = nil } -// moqUsual_InterfaceParam_results holds the results of the Usual type -type moqUsual_InterfaceParam_results struct { - params moqUsual_InterfaceParam_params - results []struct { - values *struct { - sResult string - err error +// AssertExpectationsMet asserts that all expectations have been met +func (m *moqGenericResultsFn[S, E]) AssertExpectationsMet() { + m.scene.T.Helper() + for _, res := range m.resultsByParams { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams(results.params)) + } } - sequence uint32 - doFn moqUsual_InterfaceParam_doFn - doReturnFn moqUsual_InterfaceParam_doReturnFn } - index uint32 - repeat *moq.RepeatVal } -// moqUsual_InterfaceParam_fnRecorder routes recorded function calls to the -// moqUsual moq -type moqUsual_InterfaceParam_fnRecorder struct { - params moqUsual_InterfaceParam_params - anyParams uint64 - sequence bool - results *moqUsual_InterfaceParam_results - moq *moqUsual +// moqPartialGenericResultsFn holds the state of a moq of the +// PartialGenericResultsFn type +type moqPartialGenericResultsFn[S ~string] struct { + scene *moq.Scene + config moq.Config + moq *moqPartialGenericResultsFn_mock[S] + + resultsByParams []moqPartialGenericResultsFn_resultsByParams[S] + + runtime struct { + parameterIndexing struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } + } } -// moqUsual_InterfaceParam_anyParams isolates the any params functions of the -// Usual type -type moqUsual_InterfaceParam_anyParams struct { - recorder *moqUsual_InterfaceParam_fnRecorder +// moqPartialGenericResultsFn_mock isolates the mock interface of the +// PartialGenericResultsFn type +type moqPartialGenericResultsFn_mock[S ~string] struct { + moq *moqPartialGenericResultsFn[S] } -// moqUsual_InterfaceResult_params holds the params of the Usual type -type moqUsual_InterfaceResult_params struct { - sParam string - bParam bool +// moqPartialGenericResultsFn_params holds the params of the +// PartialGenericResultsFn type +type moqPartialGenericResultsFn_params[S ~string] struct { + param1 string + param2 bool } -// moqUsual_InterfaceResult_paramsKey holds the map key params of the Usual -// type -type moqUsual_InterfaceResult_paramsKey struct { +// moqPartialGenericResultsFn_paramsKey holds the map key params of the +// PartialGenericResultsFn type +type moqPartialGenericResultsFn_paramsKey[S ~string] struct { params struct { - sParam string - bParam bool + param1 string + param2 bool } hashes struct { - sParam hash.Hash - bParam hash.Hash + param1 hash.Hash + param2 hash.Hash } } -// moqUsual_InterfaceResult_resultsByParams contains the results for a given -// set of parameters for the Usual type -type moqUsual_InterfaceResult_resultsByParams struct { +// moqPartialGenericResultsFn_resultsByParams contains the results for a given +// set of parameters for the PartialGenericResultsFn type +type moqPartialGenericResultsFn_resultsByParams[S ~string] struct { anyCount int anyParams uint64 - results map[moqUsual_InterfaceResult_paramsKey]*moqUsual_InterfaceResult_results + results map[moqPartialGenericResultsFn_paramsKey[S]]*moqPartialGenericResultsFn_results[S] } -// moqUsual_InterfaceResult_doFn defines the type of function needed when -// calling andDo for the Usual type -type moqUsual_InterfaceResult_doFn func(sParam string, bParam bool) +// moqPartialGenericResultsFn_doFn defines the type of function needed when +// calling andDo for the PartialGenericResultsFn type +type moqPartialGenericResultsFn_doFn[S ~string] func(string, bool) -// moqUsual_InterfaceResult_doReturnFn defines the type of function needed when -// calling doReturnResults for the Usual type -type moqUsual_InterfaceResult_doReturnFn func(sParam string, bParam bool) (r io.Reader) +// moqPartialGenericResultsFn_doReturnFn defines the type of function needed +// when calling doReturnResults for the PartialGenericResultsFn type +type moqPartialGenericResultsFn_doReturnFn[S ~string] func(string, bool) (S, error) -// moqUsual_InterfaceResult_results holds the results of the Usual type -type moqUsual_InterfaceResult_results struct { - params moqUsual_InterfaceResult_params +// moqPartialGenericResultsFn_results holds the results of the +// PartialGenericResultsFn type +type moqPartialGenericResultsFn_results[S ~string] struct { + params moqPartialGenericResultsFn_params[S] results []struct { - values *struct{ result1 io.Reader } + values *struct { + result1 S + result2 error + } sequence uint32 - doFn moqUsual_InterfaceResult_doFn - doReturnFn moqUsual_InterfaceResult_doReturnFn + doFn moqPartialGenericResultsFn_doFn[S] + doReturnFn moqPartialGenericResultsFn_doReturnFn[S] } index uint32 repeat *moq.RepeatVal } -// moqUsual_InterfaceResult_fnRecorder routes recorded function calls to the -// moqUsual moq -type moqUsual_InterfaceResult_fnRecorder struct { - params moqUsual_InterfaceResult_params +// moqPartialGenericResultsFn_fnRecorder routes recorded function calls to the +// moqPartialGenericResultsFn moq +type moqPartialGenericResultsFn_fnRecorder[S ~string] struct { + params moqPartialGenericResultsFn_params[S] anyParams uint64 sequence bool - results *moqUsual_InterfaceResult_results - moq *moqUsual + results *moqPartialGenericResultsFn_results[S] + moq *moqPartialGenericResultsFn[S] } -// moqUsual_InterfaceResult_anyParams isolates the any params functions of the -// Usual type -type moqUsual_InterfaceResult_anyParams struct { - recorder *moqUsual_InterfaceResult_fnRecorder +// moqPartialGenericResultsFn_anyParams isolates the any params functions of +// the PartialGenericResultsFn type +type moqPartialGenericResultsFn_anyParams[S ~string] struct { + recorder *moqPartialGenericResultsFn_fnRecorder[S] } -// moqUsual_FnParam_params holds the params of the Usual type -type moqUsual_FnParam_params struct{ fn func() } +// newMoqPartialGenericResultsFn creates a new moq of the +// PartialGenericResultsFn type +func newMoqPartialGenericResultsFn[S ~string](scene *moq.Scene, config *moq.Config) *moqPartialGenericResultsFn[S] { + if config == nil { + config = &moq.Config{} + } + m := &moqPartialGenericResultsFn[S]{ + scene: scene, + config: *config, + moq: &moqPartialGenericResultsFn_mock[S]{}, -// moqUsual_FnParam_paramsKey holds the map key params of the Usual type -type moqUsual_FnParam_paramsKey struct { - params struct{} - hashes struct{ fn hash.Hash } + runtime: struct { + parameterIndexing struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } + }{parameterIndexing: struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + }{ + param1: moq.ParamIndexByValue, + param2: moq.ParamIndexByValue, + }}, + } + m.moq.moq = m + + scene.AddMoq(m) + return m } -// moqUsual_FnParam_resultsByParams contains the results for a given set of -// parameters for the Usual type -type moqUsual_FnParam_resultsByParams struct { - anyCount int - anyParams uint64 - results map[moqUsual_FnParam_paramsKey]*moqUsual_FnParam_results +// mock returns the moq implementation of the PartialGenericResultsFn type +func (m *moqPartialGenericResultsFn[S]) mock() testmoqs.PartialGenericResultsFn[S] { + return func(param1 string, param2 bool) (S, error) { + m.scene.T.Helper() + moq := &moqPartialGenericResultsFn_mock[S]{moq: m} + return moq.fn(param1, param2) + } } -// moqUsual_FnParam_doFn defines the type of function needed when calling andDo -// for the Usual type -type moqUsual_FnParam_doFn func(fn func()) +func (m *moqPartialGenericResultsFn_mock[S]) fn(param1 string, param2 bool) (result1 S, result2 error) { + m.moq.scene.T.Helper() + params := moqPartialGenericResultsFn_params[S]{ + param1: param1, + param2: param2, + } + var results *moqPartialGenericResultsFn_results[S] + for _, resultsByParams := range m.moq.resultsByParams { + paramsKey := m.moq.paramsKey(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams(params)) + } + return + } -// moqUsual_FnParam_doReturnFn defines the type of function needed when calling -// doReturnResults for the Usual type -type moqUsual_FnParam_doReturnFn func(fn func()) + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } -// moqUsual_FnParam_results holds the results of the Usual type -type moqUsual_FnParam_results struct { - params moqUsual_FnParam_params - results []struct { - values *struct{} - sequence uint32 - doFn moqUsual_FnParam_doFn - doReturnFn moqUsual_FnParam_doReturnFn + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams(params)) + } } - index uint32 - repeat *moq.RepeatVal -} -// moqUsual_FnParam_fnRecorder routes recorded function calls to the moqUsual -// moq -type moqUsual_FnParam_fnRecorder struct { - params moqUsual_FnParam_params - anyParams uint64 - sequence bool - results *moqUsual_FnParam_results - moq *moqUsual + if result.doFn != nil { + result.doFn(param1, param2) + } + + if result.values != nil { + result1 = result.values.result1 + result2 = result.values.result2 + } + if result.doReturnFn != nil { + result1, result2 = result.doReturnFn(param1, param2) + } + return } -// moqUsual_FnParam_anyParams isolates the any params functions of the Usual -// type -type moqUsual_FnParam_anyParams struct { - recorder *moqUsual_FnParam_fnRecorder +func (m *moqPartialGenericResultsFn[S]) onCall(param1 string, param2 bool) *moqPartialGenericResultsFn_fnRecorder[S] { + return &moqPartialGenericResultsFn_fnRecorder[S]{ + params: moqPartialGenericResultsFn_params[S]{ + param1: param1, + param2: param2, + }, + sequence: m.config.Sequence == moq.SeqDefaultOn, + moq: m, + } } -// moqUsual_Other_params holds the params of the Usual type -type moqUsual_Other_params struct{ param1 other.Params } +func (r *moqPartialGenericResultsFn_fnRecorder[S]) any() *moqPartialGenericResultsFn_anyParams[S] { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams(r.params)) + return nil + } + return &moqPartialGenericResultsFn_anyParams[S]{recorder: r} +} -// moqUsual_Other_paramsKey holds the map key params of the Usual type -type moqUsual_Other_paramsKey struct { - params struct{ param1 other.Params } - hashes struct{ param1 hash.Hash } +func (a *moqPartialGenericResultsFn_anyParams[S]) param1() *moqPartialGenericResultsFn_fnRecorder[S] { + a.recorder.anyParams |= 1 << 0 + return a.recorder } -// moqUsual_Other_resultsByParams contains the results for a given set of -// parameters for the Usual type -type moqUsual_Other_resultsByParams struct { - anyCount int - anyParams uint64 - results map[moqUsual_Other_paramsKey]*moqUsual_Other_results +func (a *moqPartialGenericResultsFn_anyParams[S]) param2() *moqPartialGenericResultsFn_fnRecorder[S] { + a.recorder.anyParams |= 1 << 1 + return a.recorder } -// moqUsual_Other_doFn defines the type of function needed when calling andDo -// for the Usual type -type moqUsual_Other_doFn func(other.Params) +func (r *moqPartialGenericResultsFn_fnRecorder[S]) seq() *moqPartialGenericResultsFn_fnRecorder[S] { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams(r.params)) + return nil + } + r.sequence = true + return r +} -// moqUsual_Other_doReturnFn defines the type of function needed when calling -// doReturnResults for the Usual type -type moqUsual_Other_doReturnFn func(other.Params) other.Results +func (r *moqPartialGenericResultsFn_fnRecorder[S]) noSeq() *moqPartialGenericResultsFn_fnRecorder[S] { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams(r.params)) + return nil + } + r.sequence = false + return r +} -// moqUsual_Other_results holds the results of the Usual type -type moqUsual_Other_results struct { - params moqUsual_Other_params - results []struct { +func (r *moqPartialGenericResultsFn_fnRecorder[S]) returnResults(result1 S, result2 error) *moqPartialGenericResultsFn_fnRecorder[S] { + r.moq.scene.T.Helper() + r.findResults() + + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() + } + + r.results.results = append(r.results.results, struct { values *struct { - result1 other.Results + result1 S + result2 error } sequence uint32 - doFn moqUsual_Other_doFn - doReturnFn moqUsual_Other_doReturnFn - } - index uint32 - repeat *moq.RepeatVal + doFn moqPartialGenericResultsFn_doFn[S] + doReturnFn moqPartialGenericResultsFn_doReturnFn[S] + }{ + values: &struct { + result1 S + result2 error + }{ + result1: result1, + result2: result2, + }, + sequence: sequence, + }) + return r } -// moqUsual_Other_fnRecorder routes recorded function calls to the moqUsual moq -type moqUsual_Other_fnRecorder struct { - params moqUsual_Other_params - anyParams uint64 - sequence bool - results *moqUsual_Other_results - moq *moqUsual +func (r *moqPartialGenericResultsFn_fnRecorder[S]) andDo(fn moqPartialGenericResultsFn_doFn[S]) *moqPartialGenericResultsFn_fnRecorder[S] { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") + return nil + } + last := &r.results.results[len(r.results.results)-1] + last.doFn = fn + return r } -// moqUsual_Other_anyParams isolates the any params functions of the Usual type -type moqUsual_Other_anyParams struct { - recorder *moqUsual_Other_fnRecorder +func (r *moqPartialGenericResultsFn_fnRecorder[S]) doReturnResults(fn moqPartialGenericResultsFn_doReturnFn[S]) *moqPartialGenericResultsFn_fnRecorder[S] { + r.moq.scene.T.Helper() + r.findResults() + + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() + } + + r.results.results = append(r.results.results, struct { + values *struct { + result1 S + result2 error + } + sequence uint32 + doFn moqPartialGenericResultsFn_doFn[S] + doReturnFn moqPartialGenericResultsFn_doReturnFn[S] + }{sequence: sequence, doReturnFn: fn}) + return r } -// newMoqUsual creates a new moq of the Usual type -func newMoqUsual(scene *moq.Scene, config *moq.Config) *moqUsual { - if config == nil { - config = &moq.Config{} +func (r *moqPartialGenericResultsFn_fnRecorder[S]) findResults() { + r.moq.scene.T.Helper() + if r.results != nil { + r.results.repeat.Increment(r.moq.scene.T) + return } - m := &moqUsual{ - scene: scene, - config: *config, - moq: &moqUsual_mock{}, - runtime: struct { - parameterIndexing struct { - Usual struct { - sParam moq.ParamIndexing - bParam moq.ParamIndexing - } - NoNames struct { - param1 moq.ParamIndexing - param2 moq.ParamIndexing - } - NoResults struct { - sParam moq.ParamIndexing - bParam moq.ParamIndexing - } - NoParams struct{} - Nothing struct{} - Variadic struct { - other moq.ParamIndexing - args moq.ParamIndexing - } - RepeatedIds struct { - sParam1 moq.ParamIndexing - sParam2 moq.ParamIndexing - bParam moq.ParamIndexing - } - Times struct { - sParam moq.ParamIndexing - times moq.ParamIndexing - } - DifficultParamNames struct { - param1 moq.ParamIndexing - param2 moq.ParamIndexing - param3 moq.ParamIndexing - param moq.ParamIndexing - param5 moq.ParamIndexing - param6 moq.ParamIndexing - param7 moq.ParamIndexing - param8 moq.ParamIndexing - param9 moq.ParamIndexing - } - DifficultResultNames struct{} - PassByArray struct { - p moq.ParamIndexing - } - PassByChan struct { - p moq.ParamIndexing - } - PassByEllipsis struct { - p moq.ParamIndexing - } - PassByMap struct { - p moq.ParamIndexing - } - PassByReference struct { - p moq.ParamIndexing - } - PassBySlice struct { - p moq.ParamIndexing + anyCount := bits.OnesCount64(r.anyParams) + insertAt := -1 + var results *moqPartialGenericResultsFn_resultsByParams[S] + for n, res := range r.moq.resultsByParams { + if res.anyParams == r.anyParams { + results = &res + break + } + if res.anyCount > anyCount { + insertAt = n + } + } + if results == nil { + results = &moqPartialGenericResultsFn_resultsByParams[S]{ + anyCount: anyCount, + anyParams: r.anyParams, + results: map[moqPartialGenericResultsFn_paramsKey[S]]*moqPartialGenericResultsFn_results[S]{}, + } + r.moq.resultsByParams = append(r.moq.resultsByParams, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams) { + copy(r.moq.resultsByParams[insertAt+1:], r.moq.resultsByParams[insertAt:0]) + r.moq.resultsByParams[insertAt] = *results + } + } + + paramsKey := r.moq.paramsKey(r.params, r.anyParams) + + var ok bool + r.results, ok = results.results[paramsKey] + if !ok { + r.results = &moqPartialGenericResultsFn_results[S]{ + params: r.params, + results: nil, + index: 0, + repeat: &moq.RepeatVal{}, + } + results.results[paramsKey] = r.results + } + + r.results.repeat.Increment(r.moq.scene.T) +} + +func (r *moqPartialGenericResultsFn_fnRecorder[S]) repeat(repeaters ...moq.Repeater) *moqPartialGenericResultsFn_fnRecorder[S] { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") + return nil + } + r.results.repeat.Repeat(r.moq.scene.T, repeaters) + last := r.results.results[len(r.results.results)-1] + for n := 0; n < r.results.repeat.ResultCount-1; n++ { + if r.sequence { + last = struct { + values *struct { + result1 S + result2 error } - PassByValue struct { - p moq.ParamIndexing - } - InterfaceParam struct { - w moq.ParamIndexing - } - InterfaceResult struct { - sParam moq.ParamIndexing - bParam moq.ParamIndexing - } - FnParam struct { - fn moq.ParamIndexing - } - Other struct { - param1 moq.ParamIndexing - } - } - }{parameterIndexing: struct { - Usual struct { - sParam moq.ParamIndexing - bParam moq.ParamIndexing - } - NoNames struct { - param1 moq.ParamIndexing - param2 moq.ParamIndexing - } - NoResults struct { - sParam moq.ParamIndexing - bParam moq.ParamIndexing - } - NoParams struct{} - Nothing struct{} - Variadic struct { - other moq.ParamIndexing - args moq.ParamIndexing - } - RepeatedIds struct { - sParam1 moq.ParamIndexing - sParam2 moq.ParamIndexing - bParam moq.ParamIndexing - } - Times struct { - sParam moq.ParamIndexing - times moq.ParamIndexing - } - DifficultParamNames struct { - param1 moq.ParamIndexing - param2 moq.ParamIndexing - param3 moq.ParamIndexing - param moq.ParamIndexing - param5 moq.ParamIndexing - param6 moq.ParamIndexing - param7 moq.ParamIndexing - param8 moq.ParamIndexing - param9 moq.ParamIndexing - } - DifficultResultNames struct{} - PassByArray struct { - p moq.ParamIndexing - } - PassByChan struct { - p moq.ParamIndexing - } - PassByEllipsis struct { - p moq.ParamIndexing - } - PassByMap struct { - p moq.ParamIndexing - } - PassByReference struct { - p moq.ParamIndexing - } - PassBySlice struct { - p moq.ParamIndexing + sequence uint32 + doFn moqPartialGenericResultsFn_doFn[S] + doReturnFn moqPartialGenericResultsFn_doReturnFn[S] + }{ + values: last.values, + sequence: r.moq.scene.NextRecorderSequence(), } - PassByValue struct { - p moq.ParamIndexing + } + r.results.results = append(r.results.results, last) + } + return r +} + +func (m *moqPartialGenericResultsFn[S]) prettyParams(params moqPartialGenericResultsFn_params[S]) string { + return fmt.Sprintf("PartialGenericResultsFn(%#v, %#v)", params.param1, params.param2) +} + +func (m *moqPartialGenericResultsFn[S]) paramsKey(params moqPartialGenericResultsFn_params[S], anyParams uint64) moqPartialGenericResultsFn_paramsKey[S] { + m.scene.T.Helper() + var param1Used string + var param1UsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.runtime.parameterIndexing.param1 == moq.ParamIndexByValue { + param1Used = params.param1 + } else { + param1UsedHash = hash.DeepHash(params.param1) + } + } + var param2Used bool + var param2UsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.runtime.parameterIndexing.param2 == moq.ParamIndexByValue { + param2Used = params.param2 + } else { + param2UsedHash = hash.DeepHash(params.param2) + } + } + return moqPartialGenericResultsFn_paramsKey[S]{ + params: struct { + param1 string + param2 bool + }{ + param1: param1Used, + param2: param2Used, + }, + hashes: struct { + param1 hash.Hash + param2 hash.Hash + }{ + param1: param1UsedHash, + param2: param2UsedHash, + }, + } +} + +// Reset resets the state of the moq +func (m *moqPartialGenericResultsFn[S]) Reset() { m.resultsByParams = nil } + +// AssertExpectationsMet asserts that all expectations have been met +func (m *moqPartialGenericResultsFn[S]) AssertExpectationsMet() { + m.scene.T.Helper() + for _, res := range m.resultsByParams { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams(results.params)) } - InterfaceParam struct { + } + } +} + +// moqGenericInterfaceParamFn holds the state of a moq of the +// GenericInterfaceParamFn type +type moqGenericInterfaceParamFn[W testmoqs.MyWriter] struct { + scene *moq.Scene + config moq.Config + moq *moqGenericInterfaceParamFn_mock[W] + + resultsByParams []moqGenericInterfaceParamFn_resultsByParams[W] + + runtime struct { + parameterIndexing struct { + w moq.ParamIndexing + } + } +} + +// moqGenericInterfaceParamFn_mock isolates the mock interface of the +// GenericInterfaceParamFn type +type moqGenericInterfaceParamFn_mock[W testmoqs.MyWriter] struct { + moq *moqGenericInterfaceParamFn[W] +} + +// moqGenericInterfaceParamFn_params holds the params of the +// GenericInterfaceParamFn type +type moqGenericInterfaceParamFn_params[W testmoqs.MyWriter] struct{ w W } + +// moqGenericInterfaceParamFn_paramsKey holds the map key params of the +// GenericInterfaceParamFn type +type moqGenericInterfaceParamFn_paramsKey[W testmoqs.MyWriter] struct { + params struct{} + hashes struct{ w hash.Hash } +} + +// moqGenericInterfaceParamFn_resultsByParams contains the results for a given +// set of parameters for the GenericInterfaceParamFn type +type moqGenericInterfaceParamFn_resultsByParams[W testmoqs.MyWriter] struct { + anyCount int + anyParams uint64 + results map[moqGenericInterfaceParamFn_paramsKey[W]]*moqGenericInterfaceParamFn_results[W] +} + +// moqGenericInterfaceParamFn_doFn defines the type of function needed when +// calling andDo for the GenericInterfaceParamFn type +type moqGenericInterfaceParamFn_doFn[W testmoqs.MyWriter] func(w W) + +// moqGenericInterfaceParamFn_doReturnFn defines the type of function needed +// when calling doReturnResults for the GenericInterfaceParamFn type +type moqGenericInterfaceParamFn_doReturnFn[W testmoqs.MyWriter] func(w W) (sResult string, err error) + +// moqGenericInterfaceParamFn_results holds the results of the +// GenericInterfaceParamFn type +type moqGenericInterfaceParamFn_results[W testmoqs.MyWriter] struct { + params moqGenericInterfaceParamFn_params[W] + results []struct { + values *struct { + sResult string + err error + } + sequence uint32 + doFn moqGenericInterfaceParamFn_doFn[W] + doReturnFn moqGenericInterfaceParamFn_doReturnFn[W] + } + index uint32 + repeat *moq.RepeatVal +} + +// moqGenericInterfaceParamFn_fnRecorder routes recorded function calls to the +// moqGenericInterfaceParamFn moq +type moqGenericInterfaceParamFn_fnRecorder[W testmoqs.MyWriter] struct { + params moqGenericInterfaceParamFn_params[W] + anyParams uint64 + sequence bool + results *moqGenericInterfaceParamFn_results[W] + moq *moqGenericInterfaceParamFn[W] +} + +// moqGenericInterfaceParamFn_anyParams isolates the any params functions of +// the GenericInterfaceParamFn type +type moqGenericInterfaceParamFn_anyParams[W testmoqs.MyWriter] struct { + recorder *moqGenericInterfaceParamFn_fnRecorder[W] +} + +// newMoqGenericInterfaceParamFn creates a new moq of the +// GenericInterfaceParamFn type +func newMoqGenericInterfaceParamFn[W testmoqs.MyWriter](scene *moq.Scene, config *moq.Config) *moqGenericInterfaceParamFn[W] { + if config == nil { + config = &moq.Config{} + } + m := &moqGenericInterfaceParamFn[W]{ + scene: scene, + config: *config, + moq: &moqGenericInterfaceParamFn_mock[W]{}, + + runtime: struct { + parameterIndexing struct { w moq.ParamIndexing } - InterfaceResult struct { - sParam moq.ParamIndexing - bParam moq.ParamIndexing - } - FnParam struct { - fn moq.ParamIndexing - } - Other struct { - param1 moq.ParamIndexing - } + }{parameterIndexing: struct { + w moq.ParamIndexing }{ - Usual: struct { - sParam moq.ParamIndexing - bParam moq.ParamIndexing - }{ - sParam: moq.ParamIndexByValue, - bParam: moq.ParamIndexByValue, - }, - NoNames: struct { - param1 moq.ParamIndexing - param2 moq.ParamIndexing - }{ - param1: moq.ParamIndexByValue, - param2: moq.ParamIndexByValue, - }, - NoResults: struct { - sParam moq.ParamIndexing - bParam moq.ParamIndexing - }{ - sParam: moq.ParamIndexByValue, - bParam: moq.ParamIndexByValue, - }, - NoParams: struct{}{}, - Nothing: struct{}{}, - Variadic: struct { - other moq.ParamIndexing - args moq.ParamIndexing - }{ - other: moq.ParamIndexByValue, - args: moq.ParamIndexByHash, - }, - RepeatedIds: struct { - sParam1 moq.ParamIndexing - sParam2 moq.ParamIndexing - bParam moq.ParamIndexing - }{ - sParam1: moq.ParamIndexByValue, - sParam2: moq.ParamIndexByValue, - bParam: moq.ParamIndexByValue, - }, - Times: struct { - sParam moq.ParamIndexing - times moq.ParamIndexing - }{ - sParam: moq.ParamIndexByValue, - times: moq.ParamIndexByValue, - }, - DifficultParamNames: struct { - param1 moq.ParamIndexing - param2 moq.ParamIndexing - param3 moq.ParamIndexing - param moq.ParamIndexing - param5 moq.ParamIndexing - param6 moq.ParamIndexing - param7 moq.ParamIndexing - param8 moq.ParamIndexing - param9 moq.ParamIndexing - }{ - param1: moq.ParamIndexByValue, - param2: moq.ParamIndexByValue, - param3: moq.ParamIndexByValue, - param: moq.ParamIndexByValue, - param5: moq.ParamIndexByValue, - param6: moq.ParamIndexByValue, - param7: moq.ParamIndexByValue, - param8: moq.ParamIndexByValue, - param9: moq.ParamIndexByValue, - }, - DifficultResultNames: struct{}{}, - PassByArray: struct { - p moq.ParamIndexing - }{ - p: moq.ParamIndexByValue, - }, - PassByChan: struct { - p moq.ParamIndexing - }{ - p: moq.ParamIndexByValue, - }, - PassByEllipsis: struct { - p moq.ParamIndexing - }{ - p: moq.ParamIndexByHash, - }, - PassByMap: struct { - p moq.ParamIndexing - }{ - p: moq.ParamIndexByHash, - }, - PassByReference: struct { - p moq.ParamIndexing - }{ - p: moq.ParamIndexByHash, - }, - PassBySlice: struct { - p moq.ParamIndexing - }{ - p: moq.ParamIndexByHash, - }, - PassByValue: struct { - p moq.ParamIndexing - }{ - p: moq.ParamIndexByValue, - }, - InterfaceParam: struct { - w moq.ParamIndexing - }{ - w: moq.ParamIndexByHash, - }, - InterfaceResult: struct { - sParam moq.ParamIndexing - bParam moq.ParamIndexing - }{ - sParam: moq.ParamIndexByValue, - bParam: moq.ParamIndexByValue, - }, - FnParam: struct { - fn moq.ParamIndexing - }{ - fn: moq.ParamIndexByHash, - }, - Other: struct { - param1 moq.ParamIndexing - }{ - param1: moq.ParamIndexByValue, - }, + w: moq.ParamIndexByHash, }}, } - m.moq.moq = m - - scene.AddMoq(m) - return m + m.moq.moq = m + + scene.AddMoq(m) + return m +} + +// mock returns the moq implementation of the GenericInterfaceParamFn type +func (m *moqGenericInterfaceParamFn[W]) mock() testmoqs.GenericInterfaceParamFn[W] { + return func(w W) (_ string, _ error) { + m.scene.T.Helper() + moq := &moqGenericInterfaceParamFn_mock[W]{moq: m} + return moq.fn(w) + } +} + +func (m *moqGenericInterfaceParamFn_mock[W]) fn(w W) (sResult string, err error) { + m.moq.scene.T.Helper() + params := moqGenericInterfaceParamFn_params[W]{ + w: w, + } + var results *moqGenericInterfaceParamFn_results[W] + for _, resultsByParams := range m.moq.resultsByParams { + paramsKey := m.moq.paramsKey(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams(params)) + } + } + + if result.doFn != nil { + result.doFn(w) + } + + if result.values != nil { + sResult = result.values.sResult + err = result.values.err + } + if result.doReturnFn != nil { + sResult, err = result.doReturnFn(w) + } + return +} + +func (m *moqGenericInterfaceParamFn[W]) onCall(w W) *moqGenericInterfaceParamFn_fnRecorder[W] { + return &moqGenericInterfaceParamFn_fnRecorder[W]{ + params: moqGenericInterfaceParamFn_params[W]{ + w: w, + }, + sequence: m.config.Sequence == moq.SeqDefaultOn, + moq: m, + } +} + +func (r *moqGenericInterfaceParamFn_fnRecorder[W]) any() *moqGenericInterfaceParamFn_anyParams[W] { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams(r.params)) + return nil + } + return &moqGenericInterfaceParamFn_anyParams[W]{recorder: r} +} + +func (a *moqGenericInterfaceParamFn_anyParams[W]) w() *moqGenericInterfaceParamFn_fnRecorder[W] { + a.recorder.anyParams |= 1 << 0 + return a.recorder +} + +func (r *moqGenericInterfaceParamFn_fnRecorder[W]) seq() *moqGenericInterfaceParamFn_fnRecorder[W] { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams(r.params)) + return nil + } + r.sequence = true + return r +} + +func (r *moqGenericInterfaceParamFn_fnRecorder[W]) noSeq() *moqGenericInterfaceParamFn_fnRecorder[W] { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams(r.params)) + return nil + } + r.sequence = false + return r +} + +func (r *moqGenericInterfaceParamFn_fnRecorder[W]) returnResults(sResult string, err error) *moqGenericInterfaceParamFn_fnRecorder[W] { + r.moq.scene.T.Helper() + r.findResults() + + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() + } + + r.results.results = append(r.results.results, struct { + values *struct { + sResult string + err error + } + sequence uint32 + doFn moqGenericInterfaceParamFn_doFn[W] + doReturnFn moqGenericInterfaceParamFn_doReturnFn[W] + }{ + values: &struct { + sResult string + err error + }{ + sResult: sResult, + err: err, + }, + sequence: sequence, + }) + return r +} + +func (r *moqGenericInterfaceParamFn_fnRecorder[W]) andDo(fn moqGenericInterfaceParamFn_doFn[W]) *moqGenericInterfaceParamFn_fnRecorder[W] { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") + return nil + } + last := &r.results.results[len(r.results.results)-1] + last.doFn = fn + return r +} + +func (r *moqGenericInterfaceParamFn_fnRecorder[W]) doReturnResults(fn moqGenericInterfaceParamFn_doReturnFn[W]) *moqGenericInterfaceParamFn_fnRecorder[W] { + r.moq.scene.T.Helper() + r.findResults() + + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() + } + + r.results.results = append(r.results.results, struct { + values *struct { + sResult string + err error + } + sequence uint32 + doFn moqGenericInterfaceParamFn_doFn[W] + doReturnFn moqGenericInterfaceParamFn_doReturnFn[W] + }{sequence: sequence, doReturnFn: fn}) + return r +} + +func (r *moqGenericInterfaceParamFn_fnRecorder[W]) findResults() { + r.moq.scene.T.Helper() + if r.results != nil { + r.results.repeat.Increment(r.moq.scene.T) + return + } + + anyCount := bits.OnesCount64(r.anyParams) + insertAt := -1 + var results *moqGenericInterfaceParamFn_resultsByParams[W] + for n, res := range r.moq.resultsByParams { + if res.anyParams == r.anyParams { + results = &res + break + } + if res.anyCount > anyCount { + insertAt = n + } + } + if results == nil { + results = &moqGenericInterfaceParamFn_resultsByParams[W]{ + anyCount: anyCount, + anyParams: r.anyParams, + results: map[moqGenericInterfaceParamFn_paramsKey[W]]*moqGenericInterfaceParamFn_results[W]{}, + } + r.moq.resultsByParams = append(r.moq.resultsByParams, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams) { + copy(r.moq.resultsByParams[insertAt+1:], r.moq.resultsByParams[insertAt:0]) + r.moq.resultsByParams[insertAt] = *results + } + } + + paramsKey := r.moq.paramsKey(r.params, r.anyParams) + + var ok bool + r.results, ok = results.results[paramsKey] + if !ok { + r.results = &moqGenericInterfaceParamFn_results[W]{ + params: r.params, + results: nil, + index: 0, + repeat: &moq.RepeatVal{}, + } + results.results[paramsKey] = r.results + } + + r.results.repeat.Increment(r.moq.scene.T) +} + +func (r *moqGenericInterfaceParamFn_fnRecorder[W]) repeat(repeaters ...moq.Repeater) *moqGenericInterfaceParamFn_fnRecorder[W] { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") + return nil + } + r.results.repeat.Repeat(r.moq.scene.T, repeaters) + last := r.results.results[len(r.results.results)-1] + for n := 0; n < r.results.repeat.ResultCount-1; n++ { + if r.sequence { + last = struct { + values *struct { + sResult string + err error + } + sequence uint32 + doFn moqGenericInterfaceParamFn_doFn[W] + doReturnFn moqGenericInterfaceParamFn_doReturnFn[W] + }{ + values: last.values, + sequence: r.moq.scene.NextRecorderSequence(), + } + } + r.results.results = append(r.results.results, last) + } + return r +} + +func (m *moqGenericInterfaceParamFn[W]) prettyParams(params moqGenericInterfaceParamFn_params[W]) string { + return fmt.Sprintf("GenericInterfaceParamFn(%#v)", params.w) +} + +func (m *moqGenericInterfaceParamFn[W]) paramsKey(params moqGenericInterfaceParamFn_params[W], anyParams uint64) moqGenericInterfaceParamFn_paramsKey[W] { + m.scene.T.Helper() + var wUsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.runtime.parameterIndexing.w == moq.ParamIndexByValue { + m.scene.T.Fatalf("The w parameter can't be indexed by value") + } + wUsedHash = hash.DeepHash(params.w) + } + return moqGenericInterfaceParamFn_paramsKey[W]{ + params: struct{}{}, + hashes: struct{ w hash.Hash }{ + w: wUsedHash, + }, + } +} + +// Reset resets the state of the moq +func (m *moqGenericInterfaceParamFn[W]) Reset() { m.resultsByParams = nil } + +// AssertExpectationsMet asserts that all expectations have been met +func (m *moqGenericInterfaceParamFn[W]) AssertExpectationsMet() { + m.scene.T.Helper() + for _, res := range m.resultsByParams { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams(results.params)) + } + } + } +} + +// moqGenericInterfaceResultFn holds the state of a moq of the +// GenericInterfaceResultFn type +type moqGenericInterfaceResultFn[R testmoqs.MyReader] struct { + scene *moq.Scene + config moq.Config + moq *moqGenericInterfaceResultFn_mock[R] + + resultsByParams []moqGenericInterfaceResultFn_resultsByParams[R] + + runtime struct { + parameterIndexing struct { + sParam moq.ParamIndexing + bParam moq.ParamIndexing + } + } +} + +// moqGenericInterfaceResultFn_mock isolates the mock interface of the +// GenericInterfaceResultFn type +type moqGenericInterfaceResultFn_mock[R testmoqs.MyReader] struct { + moq *moqGenericInterfaceResultFn[R] +} + +// moqGenericInterfaceResultFn_params holds the params of the +// GenericInterfaceResultFn type +type moqGenericInterfaceResultFn_params[R testmoqs.MyReader] struct { + sParam string + bParam bool +} + +// moqGenericInterfaceResultFn_paramsKey holds the map key params of the +// GenericInterfaceResultFn type +type moqGenericInterfaceResultFn_paramsKey[R testmoqs.MyReader] struct { + params struct { + sParam string + bParam bool + } + hashes struct { + sParam hash.Hash + bParam hash.Hash + } +} + +// moqGenericInterfaceResultFn_resultsByParams contains the results for a given +// set of parameters for the GenericInterfaceResultFn type +type moqGenericInterfaceResultFn_resultsByParams[R testmoqs.MyReader] struct { + anyCount int + anyParams uint64 + results map[moqGenericInterfaceResultFn_paramsKey[R]]*moqGenericInterfaceResultFn_results[R] +} + +// moqGenericInterfaceResultFn_doFn defines the type of function needed when +// calling andDo for the GenericInterfaceResultFn type +type moqGenericInterfaceResultFn_doFn[R testmoqs.MyReader] func(sParam string, bParam bool) + +// moqGenericInterfaceResultFn_doReturnFn defines the type of function needed +// when calling doReturnResults for the GenericInterfaceResultFn type +type moqGenericInterfaceResultFn_doReturnFn[R testmoqs.MyReader] func(sParam string, bParam bool) (r R) + +// moqGenericInterfaceResultFn_results holds the results of the +// GenericInterfaceResultFn type +type moqGenericInterfaceResultFn_results[R testmoqs.MyReader] struct { + params moqGenericInterfaceResultFn_params[R] + results []struct { + values *struct{ result1 R } + sequence uint32 + doFn moqGenericInterfaceResultFn_doFn[R] + doReturnFn moqGenericInterfaceResultFn_doReturnFn[R] + } + index uint32 + repeat *moq.RepeatVal +} + +// moqGenericInterfaceResultFn_fnRecorder routes recorded function calls to the +// moqGenericInterfaceResultFn moq +type moqGenericInterfaceResultFn_fnRecorder[R testmoqs.MyReader] struct { + params moqGenericInterfaceResultFn_params[R] + anyParams uint64 + sequence bool + results *moqGenericInterfaceResultFn_results[R] + moq *moqGenericInterfaceResultFn[R] +} + +// moqGenericInterfaceResultFn_anyParams isolates the any params functions of +// the GenericInterfaceResultFn type +type moqGenericInterfaceResultFn_anyParams[R testmoqs.MyReader] struct { + recorder *moqGenericInterfaceResultFn_fnRecorder[R] +} + +// newMoqGenericInterfaceResultFn creates a new moq of the +// GenericInterfaceResultFn type +func newMoqGenericInterfaceResultFn[R testmoqs.MyReader](scene *moq.Scene, config *moq.Config) *moqGenericInterfaceResultFn[R] { + if config == nil { + config = &moq.Config{} + } + m := &moqGenericInterfaceResultFn[R]{ + scene: scene, + config: *config, + moq: &moqGenericInterfaceResultFn_mock[R]{}, + + runtime: struct { + parameterIndexing struct { + sParam moq.ParamIndexing + bParam moq.ParamIndexing + } + }{parameterIndexing: struct { + sParam moq.ParamIndexing + bParam moq.ParamIndexing + }{ + sParam: moq.ParamIndexByValue, + bParam: moq.ParamIndexByValue, + }}, + } + m.moq.moq = m + + scene.AddMoq(m) + return m +} + +// mock returns the moq implementation of the GenericInterfaceResultFn type +func (m *moqGenericInterfaceResultFn[R]) mock() testmoqs.GenericInterfaceResultFn[R] { + return func(sParam string, bParam bool) (_ R) { + m.scene.T.Helper() + moq := &moqGenericInterfaceResultFn_mock[R]{moq: m} + return moq.fn(sParam, bParam) + } +} + +func (m *moqGenericInterfaceResultFn_mock[R]) fn(sParam string, bParam bool) (result1 R) { + m.moq.scene.T.Helper() + params := moqGenericInterfaceResultFn_params[R]{ + sParam: sParam, + bParam: bParam, + } + var results *moqGenericInterfaceResultFn_results[R] + for _, resultsByParams := range m.moq.resultsByParams { + paramsKey := m.moq.paramsKey(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams(params)) + } + } + + if result.doFn != nil { + result.doFn(sParam, bParam) + } + + if result.values != nil { + result1 = result.values.result1 + } + if result.doReturnFn != nil { + result1 = result.doReturnFn(sParam, bParam) + } + return +} + +func (m *moqGenericInterfaceResultFn[R]) onCall(sParam string, bParam bool) *moqGenericInterfaceResultFn_fnRecorder[R] { + return &moqGenericInterfaceResultFn_fnRecorder[R]{ + params: moqGenericInterfaceResultFn_params[R]{ + sParam: sParam, + bParam: bParam, + }, + sequence: m.config.Sequence == moq.SeqDefaultOn, + moq: m, + } +} + +func (r *moqGenericInterfaceResultFn_fnRecorder[R]) any() *moqGenericInterfaceResultFn_anyParams[R] { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams(r.params)) + return nil + } + return &moqGenericInterfaceResultFn_anyParams[R]{recorder: r} +} + +func (a *moqGenericInterfaceResultFn_anyParams[R]) sParam() *moqGenericInterfaceResultFn_fnRecorder[R] { + a.recorder.anyParams |= 1 << 0 + return a.recorder +} + +func (a *moqGenericInterfaceResultFn_anyParams[R]) bParam() *moqGenericInterfaceResultFn_fnRecorder[R] { + a.recorder.anyParams |= 1 << 1 + return a.recorder +} + +func (r *moqGenericInterfaceResultFn_fnRecorder[R]) seq() *moqGenericInterfaceResultFn_fnRecorder[R] { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams(r.params)) + return nil + } + r.sequence = true + return r +} + +func (r *moqGenericInterfaceResultFn_fnRecorder[R]) noSeq() *moqGenericInterfaceResultFn_fnRecorder[R] { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams(r.params)) + return nil + } + r.sequence = false + return r +} + +func (r *moqGenericInterfaceResultFn_fnRecorder[R]) returnResults(result1 R) *moqGenericInterfaceResultFn_fnRecorder[R] { + r.moq.scene.T.Helper() + r.findResults() + + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() + } + + r.results.results = append(r.results.results, struct { + values *struct{ result1 R } + sequence uint32 + doFn moqGenericInterfaceResultFn_doFn[R] + doReturnFn moqGenericInterfaceResultFn_doReturnFn[R] + }{ + values: &struct{ result1 R }{ + result1: result1, + }, + sequence: sequence, + }) + return r +} + +func (r *moqGenericInterfaceResultFn_fnRecorder[R]) andDo(fn moqGenericInterfaceResultFn_doFn[R]) *moqGenericInterfaceResultFn_fnRecorder[R] { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") + return nil + } + last := &r.results.results[len(r.results.results)-1] + last.doFn = fn + return r +} + +func (r *moqGenericInterfaceResultFn_fnRecorder[R]) doReturnResults(fn moqGenericInterfaceResultFn_doReturnFn[R]) *moqGenericInterfaceResultFn_fnRecorder[R] { + r.moq.scene.T.Helper() + r.findResults() + + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() + } + + r.results.results = append(r.results.results, struct { + values *struct{ result1 R } + sequence uint32 + doFn moqGenericInterfaceResultFn_doFn[R] + doReturnFn moqGenericInterfaceResultFn_doReturnFn[R] + }{sequence: sequence, doReturnFn: fn}) + return r +} + +func (r *moqGenericInterfaceResultFn_fnRecorder[R]) findResults() { + r.moq.scene.T.Helper() + if r.results != nil { + r.results.repeat.Increment(r.moq.scene.T) + return + } + + anyCount := bits.OnesCount64(r.anyParams) + insertAt := -1 + var results *moqGenericInterfaceResultFn_resultsByParams[R] + for n, res := range r.moq.resultsByParams { + if res.anyParams == r.anyParams { + results = &res + break + } + if res.anyCount > anyCount { + insertAt = n + } + } + if results == nil { + results = &moqGenericInterfaceResultFn_resultsByParams[R]{ + anyCount: anyCount, + anyParams: r.anyParams, + results: map[moqGenericInterfaceResultFn_paramsKey[R]]*moqGenericInterfaceResultFn_results[R]{}, + } + r.moq.resultsByParams = append(r.moq.resultsByParams, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams) { + copy(r.moq.resultsByParams[insertAt+1:], r.moq.resultsByParams[insertAt:0]) + r.moq.resultsByParams[insertAt] = *results + } + } + + paramsKey := r.moq.paramsKey(r.params, r.anyParams) + + var ok bool + r.results, ok = results.results[paramsKey] + if !ok { + r.results = &moqGenericInterfaceResultFn_results[R]{ + params: r.params, + results: nil, + index: 0, + repeat: &moq.RepeatVal{}, + } + results.results[paramsKey] = r.results + } + + r.results.repeat.Increment(r.moq.scene.T) +} + +func (r *moqGenericInterfaceResultFn_fnRecorder[R]) repeat(repeaters ...moq.Repeater) *moqGenericInterfaceResultFn_fnRecorder[R] { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") + return nil + } + r.results.repeat.Repeat(r.moq.scene.T, repeaters) + last := r.results.results[len(r.results.results)-1] + for n := 0; n < r.results.repeat.ResultCount-1; n++ { + if r.sequence { + last = struct { + values *struct{ result1 R } + sequence uint32 + doFn moqGenericInterfaceResultFn_doFn[R] + doReturnFn moqGenericInterfaceResultFn_doReturnFn[R] + }{ + values: last.values, + sequence: r.moq.scene.NextRecorderSequence(), + } + } + r.results.results = append(r.results.results, last) + } + return r +} + +func (m *moqGenericInterfaceResultFn[R]) prettyParams(params moqGenericInterfaceResultFn_params[R]) string { + return fmt.Sprintf("GenericInterfaceResultFn(%#v, %#v)", params.sParam, params.bParam) +} + +func (m *moqGenericInterfaceResultFn[R]) paramsKey(params moqGenericInterfaceResultFn_params[R], anyParams uint64) moqGenericInterfaceResultFn_paramsKey[R] { + m.scene.T.Helper() + var sParamUsed string + var sParamUsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.runtime.parameterIndexing.sParam == moq.ParamIndexByValue { + sParamUsed = params.sParam + } else { + sParamUsedHash = hash.DeepHash(params.sParam) + } + } + var bParamUsed bool + var bParamUsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.runtime.parameterIndexing.bParam == moq.ParamIndexByValue { + bParamUsed = params.bParam + } else { + bParamUsedHash = hash.DeepHash(params.bParam) + } + } + return moqGenericInterfaceResultFn_paramsKey[R]{ + params: struct { + sParam string + bParam bool + }{ + sParam: sParamUsed, + bParam: bParamUsed, + }, + hashes: struct { + sParam hash.Hash + bParam hash.Hash + }{ + sParam: sParamUsedHash, + bParam: bParamUsedHash, + }, + } +} + +// Reset resets the state of the moq +func (m *moqGenericInterfaceResultFn[R]) Reset() { m.resultsByParams = nil } + +// AssertExpectationsMet asserts that all expectations have been met +func (m *moqGenericInterfaceResultFn[R]) AssertExpectationsMet() { + m.scene.T.Helper() + for _, res := range m.resultsByParams { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams(results.params)) + } + } + } +} + +// The following type assertion assures that testmoqs.Usual is mocked +// completely +var _ testmoqs.Usual = (*moqUsual_mock)(nil) + +// moqUsual holds the state of a moq of the Usual type +type moqUsual struct { + scene *moq.Scene + config moq.Config + moq *moqUsual_mock + + resultsByParams_Usual []moqUsual_Usual_resultsByParams + resultsByParams_NoNames []moqUsual_NoNames_resultsByParams + resultsByParams_NoResults []moqUsual_NoResults_resultsByParams + resultsByParams_NoParams []moqUsual_NoParams_resultsByParams + resultsByParams_Nothing []moqUsual_Nothing_resultsByParams + resultsByParams_Variadic []moqUsual_Variadic_resultsByParams + resultsByParams_RepeatedIds []moqUsual_RepeatedIds_resultsByParams + resultsByParams_Times []moqUsual_Times_resultsByParams + resultsByParams_DifficultParamNames []moqUsual_DifficultParamNames_resultsByParams + resultsByParams_DifficultResultNames []moqUsual_DifficultResultNames_resultsByParams + resultsByParams_PassByArray []moqUsual_PassByArray_resultsByParams + resultsByParams_PassByChan []moqUsual_PassByChan_resultsByParams + resultsByParams_PassByEllipsis []moqUsual_PassByEllipsis_resultsByParams + resultsByParams_PassByMap []moqUsual_PassByMap_resultsByParams + resultsByParams_PassByReference []moqUsual_PassByReference_resultsByParams + resultsByParams_PassBySlice []moqUsual_PassBySlice_resultsByParams + resultsByParams_PassByValue []moqUsual_PassByValue_resultsByParams + resultsByParams_InterfaceParam []moqUsual_InterfaceParam_resultsByParams + resultsByParams_InterfaceResult []moqUsual_InterfaceResult_resultsByParams + resultsByParams_FnParam []moqUsual_FnParam_resultsByParams + resultsByParams_Other []moqUsual_Other_resultsByParams + + runtime struct { + parameterIndexing struct { + Usual struct { + sParam moq.ParamIndexing + bParam moq.ParamIndexing + } + NoNames struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } + NoResults struct { + sParam moq.ParamIndexing + bParam moq.ParamIndexing + } + NoParams struct{} + Nothing struct{} + Variadic struct { + other moq.ParamIndexing + args moq.ParamIndexing + } + RepeatedIds struct { + sParam1 moq.ParamIndexing + sParam2 moq.ParamIndexing + bParam moq.ParamIndexing + } + Times struct { + sParam moq.ParamIndexing + times moq.ParamIndexing + } + DifficultParamNames struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + param3 moq.ParamIndexing + param moq.ParamIndexing + param5 moq.ParamIndexing + param6 moq.ParamIndexing + param7 moq.ParamIndexing + param8 moq.ParamIndexing + param9 moq.ParamIndexing + } + DifficultResultNames struct{} + PassByArray struct { + p moq.ParamIndexing + } + PassByChan struct { + p moq.ParamIndexing + } + PassByEllipsis struct { + p moq.ParamIndexing + } + PassByMap struct { + p moq.ParamIndexing + } + PassByReference struct { + p moq.ParamIndexing + } + PassBySlice struct { + p moq.ParamIndexing + } + PassByValue struct { + p moq.ParamIndexing + } + InterfaceParam struct { + w moq.ParamIndexing + } + InterfaceResult struct { + sParam moq.ParamIndexing + bParam moq.ParamIndexing + } + FnParam struct { + fn moq.ParamIndexing + } + Other struct { + param1 moq.ParamIndexing + } + } + } + // moqUsual_mock isolates the mock interface of the Usual type +} + +type moqUsual_mock struct { + moq *moqUsual +} + +// moqUsual_recorder isolates the recorder interface of the Usual type +type moqUsual_recorder struct { + moq *moqUsual +} + +// moqUsual_Usual_params holds the params of the Usual type +type moqUsual_Usual_params struct { + sParam string + bParam bool +} + +// moqUsual_Usual_paramsKey holds the map key params of the Usual type +type moqUsual_Usual_paramsKey struct { + params struct { + sParam string + bParam bool + } + hashes struct { + sParam hash.Hash + bParam hash.Hash + } +} + +// moqUsual_Usual_resultsByParams contains the results for a given set of +// parameters for the Usual type +type moqUsual_Usual_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_Usual_paramsKey]*moqUsual_Usual_results +} + +// moqUsual_Usual_doFn defines the type of function needed when calling andDo +// for the Usual type +type moqUsual_Usual_doFn func(sParam string, bParam bool) + +// moqUsual_Usual_doReturnFn defines the type of function needed when calling +// doReturnResults for the Usual type +type moqUsual_Usual_doReturnFn func(sParam string, bParam bool) (sResult string, err error) + +// moqUsual_Usual_results holds the results of the Usual type +type moqUsual_Usual_results struct { + params moqUsual_Usual_params + results []struct { + values *struct { + sResult string + err error + } + sequence uint32 + doFn moqUsual_Usual_doFn + doReturnFn moqUsual_Usual_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_Usual_fnRecorder routes recorded function calls to the moqUsual moq +type moqUsual_Usual_fnRecorder struct { + params moqUsual_Usual_params + anyParams uint64 + sequence bool + results *moqUsual_Usual_results + moq *moqUsual +} + +// moqUsual_Usual_anyParams isolates the any params functions of the Usual type +type moqUsual_Usual_anyParams struct { + recorder *moqUsual_Usual_fnRecorder +} + +// moqUsual_NoNames_params holds the params of the Usual type +type moqUsual_NoNames_params struct { + param1 string + param2 bool +} + +// moqUsual_NoNames_paramsKey holds the map key params of the Usual type +type moqUsual_NoNames_paramsKey struct { + params struct { + param1 string + param2 bool + } + hashes struct { + param1 hash.Hash + param2 hash.Hash + } +} + +// moqUsual_NoNames_resultsByParams contains the results for a given set of +// parameters for the Usual type +type moqUsual_NoNames_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_NoNames_paramsKey]*moqUsual_NoNames_results +} + +// moqUsual_NoNames_doFn defines the type of function needed when calling andDo +// for the Usual type +type moqUsual_NoNames_doFn func(string, bool) + +// moqUsual_NoNames_doReturnFn defines the type of function needed when calling +// doReturnResults for the Usual type +type moqUsual_NoNames_doReturnFn func(string, bool) (string, error) + +// moqUsual_NoNames_results holds the results of the Usual type +type moqUsual_NoNames_results struct { + params moqUsual_NoNames_params + results []struct { + values *struct { + result1 string + result2 error + } + sequence uint32 + doFn moqUsual_NoNames_doFn + doReturnFn moqUsual_NoNames_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_NoNames_fnRecorder routes recorded function calls to the moqUsual +// moq +type moqUsual_NoNames_fnRecorder struct { + params moqUsual_NoNames_params + anyParams uint64 + sequence bool + results *moqUsual_NoNames_results + moq *moqUsual +} + +// moqUsual_NoNames_anyParams isolates the any params functions of the Usual +// type +type moqUsual_NoNames_anyParams struct { + recorder *moqUsual_NoNames_fnRecorder +} + +// moqUsual_NoResults_params holds the params of the Usual type +type moqUsual_NoResults_params struct { + sParam string + bParam bool +} + +// moqUsual_NoResults_paramsKey holds the map key params of the Usual type +type moqUsual_NoResults_paramsKey struct { + params struct { + sParam string + bParam bool + } + hashes struct { + sParam hash.Hash + bParam hash.Hash + } +} + +// moqUsual_NoResults_resultsByParams contains the results for a given set of +// parameters for the Usual type +type moqUsual_NoResults_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_NoResults_paramsKey]*moqUsual_NoResults_results +} + +// moqUsual_NoResults_doFn defines the type of function needed when calling +// andDo for the Usual type +type moqUsual_NoResults_doFn func(sParam string, bParam bool) + +// moqUsual_NoResults_doReturnFn defines the type of function needed when +// calling doReturnResults for the Usual type +type moqUsual_NoResults_doReturnFn func(sParam string, bParam bool) + +// moqUsual_NoResults_results holds the results of the Usual type +type moqUsual_NoResults_results struct { + params moqUsual_NoResults_params + results []struct { + values *struct{} + sequence uint32 + doFn moqUsual_NoResults_doFn + doReturnFn moqUsual_NoResults_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_NoResults_fnRecorder routes recorded function calls to the moqUsual +// moq +type moqUsual_NoResults_fnRecorder struct { + params moqUsual_NoResults_params + anyParams uint64 + sequence bool + results *moqUsual_NoResults_results + moq *moqUsual +} + +// moqUsual_NoResults_anyParams isolates the any params functions of the Usual +// type +type moqUsual_NoResults_anyParams struct { + recorder *moqUsual_NoResults_fnRecorder +} + +// moqUsual_NoParams_params holds the params of the Usual type +type moqUsual_NoParams_params struct{} + +// moqUsual_NoParams_paramsKey holds the map key params of the Usual type +type moqUsual_NoParams_paramsKey struct { + params struct{} + hashes struct{} +} + +// moqUsual_NoParams_resultsByParams contains the results for a given set of +// parameters for the Usual type +type moqUsual_NoParams_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_NoParams_paramsKey]*moqUsual_NoParams_results +} + +// moqUsual_NoParams_doFn defines the type of function needed when calling +// andDo for the Usual type +type moqUsual_NoParams_doFn func() + +// moqUsual_NoParams_doReturnFn defines the type of function needed when +// calling doReturnResults for the Usual type +type moqUsual_NoParams_doReturnFn func() (sResult string, err error) + +// moqUsual_NoParams_results holds the results of the Usual type +type moqUsual_NoParams_results struct { + params moqUsual_NoParams_params + results []struct { + values *struct { + sResult string + err error + } + sequence uint32 + doFn moqUsual_NoParams_doFn + doReturnFn moqUsual_NoParams_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_NoParams_fnRecorder routes recorded function calls to the moqUsual +// moq +type moqUsual_NoParams_fnRecorder struct { + params moqUsual_NoParams_params + anyParams uint64 + sequence bool + results *moqUsual_NoParams_results + moq *moqUsual +} + +// moqUsual_NoParams_anyParams isolates the any params functions of the Usual +// type +type moqUsual_NoParams_anyParams struct { + recorder *moqUsual_NoParams_fnRecorder +} + +// moqUsual_Nothing_params holds the params of the Usual type +type moqUsual_Nothing_params struct{} + +// moqUsual_Nothing_paramsKey holds the map key params of the Usual type +type moqUsual_Nothing_paramsKey struct { + params struct{} + hashes struct{} +} + +// moqUsual_Nothing_resultsByParams contains the results for a given set of +// parameters for the Usual type +type moqUsual_Nothing_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_Nothing_paramsKey]*moqUsual_Nothing_results +} + +// moqUsual_Nothing_doFn defines the type of function needed when calling andDo +// for the Usual type +type moqUsual_Nothing_doFn func() + +// moqUsual_Nothing_doReturnFn defines the type of function needed when calling +// doReturnResults for the Usual type +type moqUsual_Nothing_doReturnFn func() + +// moqUsual_Nothing_results holds the results of the Usual type +type moqUsual_Nothing_results struct { + params moqUsual_Nothing_params + results []struct { + values *struct{} + sequence uint32 + doFn moqUsual_Nothing_doFn + doReturnFn moqUsual_Nothing_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_Nothing_fnRecorder routes recorded function calls to the moqUsual +// moq +type moqUsual_Nothing_fnRecorder struct { + params moqUsual_Nothing_params + anyParams uint64 + sequence bool + results *moqUsual_Nothing_results + moq *moqUsual +} + +// moqUsual_Nothing_anyParams isolates the any params functions of the Usual +// type +type moqUsual_Nothing_anyParams struct { + recorder *moqUsual_Nothing_fnRecorder +} + +// moqUsual_Variadic_params holds the params of the Usual type +type moqUsual_Variadic_params struct { + other bool + args []string +} + +// moqUsual_Variadic_paramsKey holds the map key params of the Usual type +type moqUsual_Variadic_paramsKey struct { + params struct{ other bool } + hashes struct { + other hash.Hash + args hash.Hash + } +} + +// moqUsual_Variadic_resultsByParams contains the results for a given set of +// parameters for the Usual type +type moqUsual_Variadic_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_Variadic_paramsKey]*moqUsual_Variadic_results +} + +// moqUsual_Variadic_doFn defines the type of function needed when calling +// andDo for the Usual type +type moqUsual_Variadic_doFn func(other bool, args ...string) + +// moqUsual_Variadic_doReturnFn defines the type of function needed when +// calling doReturnResults for the Usual type +type moqUsual_Variadic_doReturnFn func(other bool, args ...string) (sResult string, err error) + +// moqUsual_Variadic_results holds the results of the Usual type +type moqUsual_Variadic_results struct { + params moqUsual_Variadic_params + results []struct { + values *struct { + sResult string + err error + } + sequence uint32 + doFn moqUsual_Variadic_doFn + doReturnFn moqUsual_Variadic_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_Variadic_fnRecorder routes recorded function calls to the moqUsual +// moq +type moqUsual_Variadic_fnRecorder struct { + params moqUsual_Variadic_params + anyParams uint64 + sequence bool + results *moqUsual_Variadic_results + moq *moqUsual +} + +// moqUsual_Variadic_anyParams isolates the any params functions of the Usual +// type +type moqUsual_Variadic_anyParams struct { + recorder *moqUsual_Variadic_fnRecorder +} + +// moqUsual_RepeatedIds_params holds the params of the Usual type +type moqUsual_RepeatedIds_params struct { + sParam1, sParam2 string + bParam bool +} + +// moqUsual_RepeatedIds_paramsKey holds the map key params of the Usual type +type moqUsual_RepeatedIds_paramsKey struct { + params struct { + sParam1, sParam2 string + bParam bool + } + hashes struct { + sParam1, sParam2 hash.Hash + bParam hash.Hash + } +} + +// moqUsual_RepeatedIds_resultsByParams contains the results for a given set of +// parameters for the Usual type +type moqUsual_RepeatedIds_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_RepeatedIds_paramsKey]*moqUsual_RepeatedIds_results +} + +// moqUsual_RepeatedIds_doFn defines the type of function needed when calling +// andDo for the Usual type +type moqUsual_RepeatedIds_doFn func(sParam1, sParam2 string, bParam bool) + +// moqUsual_RepeatedIds_doReturnFn defines the type of function needed when +// calling doReturnResults for the Usual type +type moqUsual_RepeatedIds_doReturnFn func(sParam1, sParam2 string, bParam bool) (sResult1, sResult2 string, err error) + +// moqUsual_RepeatedIds_results holds the results of the Usual type +type moqUsual_RepeatedIds_results struct { + params moqUsual_RepeatedIds_params + results []struct { + values *struct { + sResult1, sResult2 string + err error + } + sequence uint32 + doFn moqUsual_RepeatedIds_doFn + doReturnFn moqUsual_RepeatedIds_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_RepeatedIds_fnRecorder routes recorded function calls to the +// moqUsual moq +type moqUsual_RepeatedIds_fnRecorder struct { + params moqUsual_RepeatedIds_params + anyParams uint64 + sequence bool + results *moqUsual_RepeatedIds_results + moq *moqUsual +} + +// moqUsual_RepeatedIds_anyParams isolates the any params functions of the +// Usual type +type moqUsual_RepeatedIds_anyParams struct { + recorder *moqUsual_RepeatedIds_fnRecorder +} + +// moqUsual_Times_params holds the params of the Usual type +type moqUsual_Times_params struct { + sParam string + times bool +} + +// moqUsual_Times_paramsKey holds the map key params of the Usual type +type moqUsual_Times_paramsKey struct { + params struct { + sParam string + times bool + } + hashes struct { + sParam hash.Hash + times hash.Hash + } +} + +// moqUsual_Times_resultsByParams contains the results for a given set of +// parameters for the Usual type +type moqUsual_Times_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_Times_paramsKey]*moqUsual_Times_results +} + +// moqUsual_Times_doFn defines the type of function needed when calling andDo +// for the Usual type +type moqUsual_Times_doFn func(sParam string, times bool) + +// moqUsual_Times_doReturnFn defines the type of function needed when calling +// doReturnResults for the Usual type +type moqUsual_Times_doReturnFn func(sParam string, times bool) (sResult string, err error) + +// moqUsual_Times_results holds the results of the Usual type +type moqUsual_Times_results struct { + params moqUsual_Times_params + results []struct { + values *struct { + sResult string + err error + } + sequence uint32 + doFn moqUsual_Times_doFn + doReturnFn moqUsual_Times_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_Times_fnRecorder routes recorded function calls to the moqUsual moq +type moqUsual_Times_fnRecorder struct { + params moqUsual_Times_params + anyParams uint64 + sequence bool + results *moqUsual_Times_results + moq *moqUsual +} + +// moqUsual_Times_anyParams isolates the any params functions of the Usual type +type moqUsual_Times_anyParams struct { + recorder *moqUsual_Times_fnRecorder +} + +// moqUsual_DifficultParamNames_params holds the params of the Usual type +type moqUsual_DifficultParamNames_params struct { + param1, param2 bool + param3 string + param, param5, param6 int + param7, param8, param9 float32 +} + +// moqUsual_DifficultParamNames_paramsKey holds the map key params of the Usual +// type +type moqUsual_DifficultParamNames_paramsKey struct { + params struct { + param1, param2 bool + param3 string + param, param5, param6 int + param7, param8, param9 float32 + } + hashes struct { + param1, param2 hash.Hash + param3 hash.Hash + param, param5, param6 hash.Hash + param7, param8, param9 hash.Hash + } +} + +// moqUsual_DifficultParamNames_resultsByParams contains the results for a +// given set of parameters for the Usual type +type moqUsual_DifficultParamNames_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_DifficultParamNames_paramsKey]*moqUsual_DifficultParamNames_results +} + +// moqUsual_DifficultParamNames_doFn defines the type of function needed when +// calling andDo for the Usual type +type moqUsual_DifficultParamNames_doFn func(m, r bool, sequence string, param, params, i int, result, results, _ float32) + +// moqUsual_DifficultParamNames_doReturnFn defines the type of function needed +// when calling doReturnResults for the Usual type +type moqUsual_DifficultParamNames_doReturnFn func(m, r bool, sequence string, param, params, i int, result, results, _ float32) + +// moqUsual_DifficultParamNames_results holds the results of the Usual type +type moqUsual_DifficultParamNames_results struct { + params moqUsual_DifficultParamNames_params + results []struct { + values *struct{} + sequence uint32 + doFn moqUsual_DifficultParamNames_doFn + doReturnFn moqUsual_DifficultParamNames_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_DifficultParamNames_fnRecorder routes recorded function calls to +// the moqUsual moq +type moqUsual_DifficultParamNames_fnRecorder struct { + params moqUsual_DifficultParamNames_params + anyParams uint64 + sequence bool + results *moqUsual_DifficultParamNames_results + moq *moqUsual +} + +// moqUsual_DifficultParamNames_anyParams isolates the any params functions of +// the Usual type +type moqUsual_DifficultParamNames_anyParams struct { + recorder *moqUsual_DifficultParamNames_fnRecorder +} + +// moqUsual_DifficultResultNames_params holds the params of the Usual type +type moqUsual_DifficultResultNames_params struct{} + +// moqUsual_DifficultResultNames_paramsKey holds the map key params of the +// Usual type +type moqUsual_DifficultResultNames_paramsKey struct { + params struct{} + hashes struct{} +} + +// moqUsual_DifficultResultNames_resultsByParams contains the results for a +// given set of parameters for the Usual type +type moqUsual_DifficultResultNames_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_DifficultResultNames_paramsKey]*moqUsual_DifficultResultNames_results +} + +// moqUsual_DifficultResultNames_doFn defines the type of function needed when +// calling andDo for the Usual type +type moqUsual_DifficultResultNames_doFn func() + +// moqUsual_DifficultResultNames_doReturnFn defines the type of function needed +// when calling doReturnResults for the Usual type +type moqUsual_DifficultResultNames_doReturnFn func() (m, r string, sequence error, param, params, i int, result, results, _ float32) + +// moqUsual_DifficultResultNames_results holds the results of the Usual type +type moqUsual_DifficultResultNames_results struct { + params moqUsual_DifficultResultNames_params + results []struct { + values *struct { + result1, result2 string + result3 error + param, result5, result6 int + result7, result8, result9 float32 + } + sequence uint32 + doFn moqUsual_DifficultResultNames_doFn + doReturnFn moqUsual_DifficultResultNames_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_DifficultResultNames_fnRecorder routes recorded function calls to +// the moqUsual moq +type moqUsual_DifficultResultNames_fnRecorder struct { + params moqUsual_DifficultResultNames_params + anyParams uint64 + sequence bool + results *moqUsual_DifficultResultNames_results + moq *moqUsual +} + +// moqUsual_DifficultResultNames_anyParams isolates the any params functions of +// the Usual type +type moqUsual_DifficultResultNames_anyParams struct { + recorder *moqUsual_DifficultResultNames_fnRecorder +} + +// moqUsual_PassByArray_params holds the params of the Usual type +type moqUsual_PassByArray_params struct{ p [3]testmoqs.Params } + +// moqUsual_PassByArray_paramsKey holds the map key params of the Usual type +type moqUsual_PassByArray_paramsKey struct { + params struct{ p [3]testmoqs.Params } + hashes struct{ p hash.Hash } +} + +// moqUsual_PassByArray_resultsByParams contains the results for a given set of +// parameters for the Usual type +type moqUsual_PassByArray_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_PassByArray_paramsKey]*moqUsual_PassByArray_results +} + +// moqUsual_PassByArray_doFn defines the type of function needed when calling +// andDo for the Usual type +type moqUsual_PassByArray_doFn func(p [3]testmoqs.Params) + +// moqUsual_PassByArray_doReturnFn defines the type of function needed when +// calling doReturnResults for the Usual type +type moqUsual_PassByArray_doReturnFn func(p [3]testmoqs.Params) [3]testmoqs.Results + +// moqUsual_PassByArray_results holds the results of the Usual type +type moqUsual_PassByArray_results struct { + params moqUsual_PassByArray_params + results []struct { + values *struct { + result1 [3]testmoqs.Results + } + sequence uint32 + doFn moqUsual_PassByArray_doFn + doReturnFn moqUsual_PassByArray_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_PassByArray_fnRecorder routes recorded function calls to the +// moqUsual moq +type moqUsual_PassByArray_fnRecorder struct { + params moqUsual_PassByArray_params + anyParams uint64 + sequence bool + results *moqUsual_PassByArray_results + moq *moqUsual +} + +// moqUsual_PassByArray_anyParams isolates the any params functions of the +// Usual type +type moqUsual_PassByArray_anyParams struct { + recorder *moqUsual_PassByArray_fnRecorder +} + +// moqUsual_PassByChan_params holds the params of the Usual type +type moqUsual_PassByChan_params struct{ p chan testmoqs.Params } + +// moqUsual_PassByChan_paramsKey holds the map key params of the Usual type +type moqUsual_PassByChan_paramsKey struct { + params struct{ p chan testmoqs.Params } + hashes struct{ p hash.Hash } +} + +// moqUsual_PassByChan_resultsByParams contains the results for a given set of +// parameters for the Usual type +type moqUsual_PassByChan_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_PassByChan_paramsKey]*moqUsual_PassByChan_results +} + +// moqUsual_PassByChan_doFn defines the type of function needed when calling +// andDo for the Usual type +type moqUsual_PassByChan_doFn func(p chan testmoqs.Params) + +// moqUsual_PassByChan_doReturnFn defines the type of function needed when +// calling doReturnResults for the Usual type +type moqUsual_PassByChan_doReturnFn func(p chan testmoqs.Params) chan testmoqs.Results + +// moqUsual_PassByChan_results holds the results of the Usual type +type moqUsual_PassByChan_results struct { + params moqUsual_PassByChan_params + results []struct { + values *struct { + result1 chan testmoqs.Results + } + sequence uint32 + doFn moqUsual_PassByChan_doFn + doReturnFn moqUsual_PassByChan_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_PassByChan_fnRecorder routes recorded function calls to the +// moqUsual moq +type moqUsual_PassByChan_fnRecorder struct { + params moqUsual_PassByChan_params + anyParams uint64 + sequence bool + results *moqUsual_PassByChan_results + moq *moqUsual +} + +// moqUsual_PassByChan_anyParams isolates the any params functions of the Usual +// type +type moqUsual_PassByChan_anyParams struct { + recorder *moqUsual_PassByChan_fnRecorder +} + +// moqUsual_PassByEllipsis_params holds the params of the Usual type +type moqUsual_PassByEllipsis_params struct{ p []testmoqs.Params } + +// moqUsual_PassByEllipsis_paramsKey holds the map key params of the Usual type +type moqUsual_PassByEllipsis_paramsKey struct { + params struct{} + hashes struct{ p hash.Hash } +} + +// moqUsual_PassByEllipsis_resultsByParams contains the results for a given set +// of parameters for the Usual type +type moqUsual_PassByEllipsis_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_PassByEllipsis_paramsKey]*moqUsual_PassByEllipsis_results +} + +// moqUsual_PassByEllipsis_doFn defines the type of function needed when +// calling andDo for the Usual type +type moqUsual_PassByEllipsis_doFn func(p ...testmoqs.Params) + +// moqUsual_PassByEllipsis_doReturnFn defines the type of function needed when +// calling doReturnResults for the Usual type +type moqUsual_PassByEllipsis_doReturnFn func(p ...testmoqs.Params) (string, error) + +// moqUsual_PassByEllipsis_results holds the results of the Usual type +type moqUsual_PassByEllipsis_results struct { + params moqUsual_PassByEllipsis_params + results []struct { + values *struct { + result1 string + result2 error + } + sequence uint32 + doFn moqUsual_PassByEllipsis_doFn + doReturnFn moqUsual_PassByEllipsis_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_PassByEllipsis_fnRecorder routes recorded function calls to the +// moqUsual moq +type moqUsual_PassByEllipsis_fnRecorder struct { + params moqUsual_PassByEllipsis_params + anyParams uint64 + sequence bool + results *moqUsual_PassByEllipsis_results + moq *moqUsual +} + +// moqUsual_PassByEllipsis_anyParams isolates the any params functions of the +// Usual type +type moqUsual_PassByEllipsis_anyParams struct { + recorder *moqUsual_PassByEllipsis_fnRecorder +} + +// moqUsual_PassByMap_params holds the params of the Usual type +type moqUsual_PassByMap_params struct{ p map[string]testmoqs.Params } + +// moqUsual_PassByMap_paramsKey holds the map key params of the Usual type +type moqUsual_PassByMap_paramsKey struct { + params struct{} + hashes struct{ p hash.Hash } +} + +// moqUsual_PassByMap_resultsByParams contains the results for a given set of +// parameters for the Usual type +type moqUsual_PassByMap_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_PassByMap_paramsKey]*moqUsual_PassByMap_results +} + +// moqUsual_PassByMap_doFn defines the type of function needed when calling +// andDo for the Usual type +type moqUsual_PassByMap_doFn func(p map[string]testmoqs.Params) + +// moqUsual_PassByMap_doReturnFn defines the type of function needed when +// calling doReturnResults for the Usual type +type moqUsual_PassByMap_doReturnFn func(p map[string]testmoqs.Params) map[string]testmoqs.Results + +// moqUsual_PassByMap_results holds the results of the Usual type +type moqUsual_PassByMap_results struct { + params moqUsual_PassByMap_params + results []struct { + values *struct { + result1 map[string]testmoqs.Results + } + sequence uint32 + doFn moqUsual_PassByMap_doFn + doReturnFn moqUsual_PassByMap_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_PassByMap_fnRecorder routes recorded function calls to the moqUsual +// moq +type moqUsual_PassByMap_fnRecorder struct { + params moqUsual_PassByMap_params + anyParams uint64 + sequence bool + results *moqUsual_PassByMap_results + moq *moqUsual +} + +// moqUsual_PassByMap_anyParams isolates the any params functions of the Usual +// type +type moqUsual_PassByMap_anyParams struct { + recorder *moqUsual_PassByMap_fnRecorder +} + +// moqUsual_PassByReference_params holds the params of the Usual type +type moqUsual_PassByReference_params struct{ p *testmoqs.Params } + +// moqUsual_PassByReference_paramsKey holds the map key params of the Usual +// type +type moqUsual_PassByReference_paramsKey struct { + params struct{ p *testmoqs.Params } + hashes struct{ p hash.Hash } +} + +// moqUsual_PassByReference_resultsByParams contains the results for a given +// set of parameters for the Usual type +type moqUsual_PassByReference_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_PassByReference_paramsKey]*moqUsual_PassByReference_results +} + +// moqUsual_PassByReference_doFn defines the type of function needed when +// calling andDo for the Usual type +type moqUsual_PassByReference_doFn func(p *testmoqs.Params) + +// moqUsual_PassByReference_doReturnFn defines the type of function needed when +// calling doReturnResults for the Usual type +type moqUsual_PassByReference_doReturnFn func(p *testmoqs.Params) *testmoqs.Results + +// moqUsual_PassByReference_results holds the results of the Usual type +type moqUsual_PassByReference_results struct { + params moqUsual_PassByReference_params + results []struct { + values *struct { + result1 *testmoqs.Results + } + sequence uint32 + doFn moqUsual_PassByReference_doFn + doReturnFn moqUsual_PassByReference_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_PassByReference_fnRecorder routes recorded function calls to the +// moqUsual moq +type moqUsual_PassByReference_fnRecorder struct { + params moqUsual_PassByReference_params + anyParams uint64 + sequence bool + results *moqUsual_PassByReference_results + moq *moqUsual +} + +// moqUsual_PassByReference_anyParams isolates the any params functions of the +// Usual type +type moqUsual_PassByReference_anyParams struct { + recorder *moqUsual_PassByReference_fnRecorder +} + +// moqUsual_PassBySlice_params holds the params of the Usual type +type moqUsual_PassBySlice_params struct{ p []testmoqs.Params } + +// moqUsual_PassBySlice_paramsKey holds the map key params of the Usual type +type moqUsual_PassBySlice_paramsKey struct { + params struct{} + hashes struct{ p hash.Hash } +} + +// moqUsual_PassBySlice_resultsByParams contains the results for a given set of +// parameters for the Usual type +type moqUsual_PassBySlice_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_PassBySlice_paramsKey]*moqUsual_PassBySlice_results +} + +// moqUsual_PassBySlice_doFn defines the type of function needed when calling +// andDo for the Usual type +type moqUsual_PassBySlice_doFn func(p []testmoqs.Params) + +// moqUsual_PassBySlice_doReturnFn defines the type of function needed when +// calling doReturnResults for the Usual type +type moqUsual_PassBySlice_doReturnFn func(p []testmoqs.Params) []testmoqs.Results + +// moqUsual_PassBySlice_results holds the results of the Usual type +type moqUsual_PassBySlice_results struct { + params moqUsual_PassBySlice_params + results []struct { + values *struct { + result1 []testmoqs.Results + } + sequence uint32 + doFn moqUsual_PassBySlice_doFn + doReturnFn moqUsual_PassBySlice_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_PassBySlice_fnRecorder routes recorded function calls to the +// moqUsual moq +type moqUsual_PassBySlice_fnRecorder struct { + params moqUsual_PassBySlice_params + anyParams uint64 + sequence bool + results *moqUsual_PassBySlice_results + moq *moqUsual +} + +// moqUsual_PassBySlice_anyParams isolates the any params functions of the +// Usual type +type moqUsual_PassBySlice_anyParams struct { + recorder *moqUsual_PassBySlice_fnRecorder +} + +// moqUsual_PassByValue_params holds the params of the Usual type +type moqUsual_PassByValue_params struct{ p testmoqs.Params } + +// moqUsual_PassByValue_paramsKey holds the map key params of the Usual type +type moqUsual_PassByValue_paramsKey struct { + params struct{ p testmoqs.Params } + hashes struct{ p hash.Hash } +} + +// moqUsual_PassByValue_resultsByParams contains the results for a given set of +// parameters for the Usual type +type moqUsual_PassByValue_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_PassByValue_paramsKey]*moqUsual_PassByValue_results +} + +// moqUsual_PassByValue_doFn defines the type of function needed when calling +// andDo for the Usual type +type moqUsual_PassByValue_doFn func(p testmoqs.Params) + +// moqUsual_PassByValue_doReturnFn defines the type of function needed when +// calling doReturnResults for the Usual type +type moqUsual_PassByValue_doReturnFn func(p testmoqs.Params) testmoqs.Results + +// moqUsual_PassByValue_results holds the results of the Usual type +type moqUsual_PassByValue_results struct { + params moqUsual_PassByValue_params + results []struct { + values *struct { + result1 testmoqs.Results + } + sequence uint32 + doFn moqUsual_PassByValue_doFn + doReturnFn moqUsual_PassByValue_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_PassByValue_fnRecorder routes recorded function calls to the +// moqUsual moq +type moqUsual_PassByValue_fnRecorder struct { + params moqUsual_PassByValue_params + anyParams uint64 + sequence bool + results *moqUsual_PassByValue_results + moq *moqUsual +} + +// moqUsual_PassByValue_anyParams isolates the any params functions of the +// Usual type +type moqUsual_PassByValue_anyParams struct { + recorder *moqUsual_PassByValue_fnRecorder +} + +// moqUsual_InterfaceParam_params holds the params of the Usual type +type moqUsual_InterfaceParam_params struct{ w io.Writer } + +// moqUsual_InterfaceParam_paramsKey holds the map key params of the Usual type +type moqUsual_InterfaceParam_paramsKey struct { + params struct{ w io.Writer } + hashes struct{ w hash.Hash } +} + +// moqUsual_InterfaceParam_resultsByParams contains the results for a given set +// of parameters for the Usual type +type moqUsual_InterfaceParam_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_InterfaceParam_paramsKey]*moqUsual_InterfaceParam_results +} + +// moqUsual_InterfaceParam_doFn defines the type of function needed when +// calling andDo for the Usual type +type moqUsual_InterfaceParam_doFn func(w io.Writer) + +// moqUsual_InterfaceParam_doReturnFn defines the type of function needed when +// calling doReturnResults for the Usual type +type moqUsual_InterfaceParam_doReturnFn func(w io.Writer) (sResult string, err error) + +// moqUsual_InterfaceParam_results holds the results of the Usual type +type moqUsual_InterfaceParam_results struct { + params moqUsual_InterfaceParam_params + results []struct { + values *struct { + sResult string + err error + } + sequence uint32 + doFn moqUsual_InterfaceParam_doFn + doReturnFn moqUsual_InterfaceParam_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_InterfaceParam_fnRecorder routes recorded function calls to the +// moqUsual moq +type moqUsual_InterfaceParam_fnRecorder struct { + params moqUsual_InterfaceParam_params + anyParams uint64 + sequence bool + results *moqUsual_InterfaceParam_results + moq *moqUsual +} + +// moqUsual_InterfaceParam_anyParams isolates the any params functions of the +// Usual type +type moqUsual_InterfaceParam_anyParams struct { + recorder *moqUsual_InterfaceParam_fnRecorder +} + +// moqUsual_InterfaceResult_params holds the params of the Usual type +type moqUsual_InterfaceResult_params struct { + sParam string + bParam bool +} + +// moqUsual_InterfaceResult_paramsKey holds the map key params of the Usual +// type +type moqUsual_InterfaceResult_paramsKey struct { + params struct { + sParam string + bParam bool + } + hashes struct { + sParam hash.Hash + bParam hash.Hash + } +} + +// moqUsual_InterfaceResult_resultsByParams contains the results for a given +// set of parameters for the Usual type +type moqUsual_InterfaceResult_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_InterfaceResult_paramsKey]*moqUsual_InterfaceResult_results +} + +// moqUsual_InterfaceResult_doFn defines the type of function needed when +// calling andDo for the Usual type +type moqUsual_InterfaceResult_doFn func(sParam string, bParam bool) + +// moqUsual_InterfaceResult_doReturnFn defines the type of function needed when +// calling doReturnResults for the Usual type +type moqUsual_InterfaceResult_doReturnFn func(sParam string, bParam bool) (r io.Reader) + +// moqUsual_InterfaceResult_results holds the results of the Usual type +type moqUsual_InterfaceResult_results struct { + params moqUsual_InterfaceResult_params + results []struct { + values *struct{ result1 io.Reader } + sequence uint32 + doFn moqUsual_InterfaceResult_doFn + doReturnFn moqUsual_InterfaceResult_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_InterfaceResult_fnRecorder routes recorded function calls to the +// moqUsual moq +type moqUsual_InterfaceResult_fnRecorder struct { + params moqUsual_InterfaceResult_params + anyParams uint64 + sequence bool + results *moqUsual_InterfaceResult_results + moq *moqUsual +} + +// moqUsual_InterfaceResult_anyParams isolates the any params functions of the +// Usual type +type moqUsual_InterfaceResult_anyParams struct { + recorder *moqUsual_InterfaceResult_fnRecorder +} + +// moqUsual_FnParam_params holds the params of the Usual type +type moqUsual_FnParam_params struct{ fn func() } + +// moqUsual_FnParam_paramsKey holds the map key params of the Usual type +type moqUsual_FnParam_paramsKey struct { + params struct{} + hashes struct{ fn hash.Hash } +} + +// moqUsual_FnParam_resultsByParams contains the results for a given set of +// parameters for the Usual type +type moqUsual_FnParam_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_FnParam_paramsKey]*moqUsual_FnParam_results +} + +// moqUsual_FnParam_doFn defines the type of function needed when calling andDo +// for the Usual type +type moqUsual_FnParam_doFn func(fn func()) + +// moqUsual_FnParam_doReturnFn defines the type of function needed when calling +// doReturnResults for the Usual type +type moqUsual_FnParam_doReturnFn func(fn func()) + +// moqUsual_FnParam_results holds the results of the Usual type +type moqUsual_FnParam_results struct { + params moqUsual_FnParam_params + results []struct { + values *struct{} + sequence uint32 + doFn moqUsual_FnParam_doFn + doReturnFn moqUsual_FnParam_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_FnParam_fnRecorder routes recorded function calls to the moqUsual +// moq +type moqUsual_FnParam_fnRecorder struct { + params moqUsual_FnParam_params + anyParams uint64 + sequence bool + results *moqUsual_FnParam_results + moq *moqUsual +} + +// moqUsual_FnParam_anyParams isolates the any params functions of the Usual +// type +type moqUsual_FnParam_anyParams struct { + recorder *moqUsual_FnParam_fnRecorder +} + +// moqUsual_Other_params holds the params of the Usual type +type moqUsual_Other_params struct{ param1 other.Params } + +// moqUsual_Other_paramsKey holds the map key params of the Usual type +type moqUsual_Other_paramsKey struct { + params struct{ param1 other.Params } + hashes struct{ param1 hash.Hash } +} + +// moqUsual_Other_resultsByParams contains the results for a given set of +// parameters for the Usual type +type moqUsual_Other_resultsByParams struct { + anyCount int + anyParams uint64 + results map[moqUsual_Other_paramsKey]*moqUsual_Other_results +} + +// moqUsual_Other_doFn defines the type of function needed when calling andDo +// for the Usual type +type moqUsual_Other_doFn func(other.Params) + +// moqUsual_Other_doReturnFn defines the type of function needed when calling +// doReturnResults for the Usual type +type moqUsual_Other_doReturnFn func(other.Params) other.Results + +// moqUsual_Other_results holds the results of the Usual type +type moqUsual_Other_results struct { + params moqUsual_Other_params + results []struct { + values *struct { + result1 other.Results + } + sequence uint32 + doFn moqUsual_Other_doFn + doReturnFn moqUsual_Other_doReturnFn + } + index uint32 + repeat *moq.RepeatVal +} + +// moqUsual_Other_fnRecorder routes recorded function calls to the moqUsual moq +type moqUsual_Other_fnRecorder struct { + params moqUsual_Other_params + anyParams uint64 + sequence bool + results *moqUsual_Other_results + moq *moqUsual +} + +// moqUsual_Other_anyParams isolates the any params functions of the Usual type +type moqUsual_Other_anyParams struct { + recorder *moqUsual_Other_fnRecorder +} + +// newMoqUsual creates a new moq of the Usual type +func newMoqUsual(scene *moq.Scene, config *moq.Config) *moqUsual { + if config == nil { + config = &moq.Config{} + } + m := &moqUsual{ + scene: scene, + config: *config, + moq: &moqUsual_mock{}, + + runtime: struct { + parameterIndexing struct { + Usual struct { + sParam moq.ParamIndexing + bParam moq.ParamIndexing + } + NoNames struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } + NoResults struct { + sParam moq.ParamIndexing + bParam moq.ParamIndexing + } + NoParams struct{} + Nothing struct{} + Variadic struct { + other moq.ParamIndexing + args moq.ParamIndexing + } + RepeatedIds struct { + sParam1 moq.ParamIndexing + sParam2 moq.ParamIndexing + bParam moq.ParamIndexing + } + Times struct { + sParam moq.ParamIndexing + times moq.ParamIndexing + } + DifficultParamNames struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + param3 moq.ParamIndexing + param moq.ParamIndexing + param5 moq.ParamIndexing + param6 moq.ParamIndexing + param7 moq.ParamIndexing + param8 moq.ParamIndexing + param9 moq.ParamIndexing + } + DifficultResultNames struct{} + PassByArray struct { + p moq.ParamIndexing + } + PassByChan struct { + p moq.ParamIndexing + } + PassByEllipsis struct { + p moq.ParamIndexing + } + PassByMap struct { + p moq.ParamIndexing + } + PassByReference struct { + p moq.ParamIndexing + } + PassBySlice struct { + p moq.ParamIndexing + } + PassByValue struct { + p moq.ParamIndexing + } + InterfaceParam struct { + w moq.ParamIndexing + } + InterfaceResult struct { + sParam moq.ParamIndexing + bParam moq.ParamIndexing + } + FnParam struct { + fn moq.ParamIndexing + } + Other struct { + param1 moq.ParamIndexing + } + } + }{parameterIndexing: struct { + Usual struct { + sParam moq.ParamIndexing + bParam moq.ParamIndexing + } + NoNames struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } + NoResults struct { + sParam moq.ParamIndexing + bParam moq.ParamIndexing + } + NoParams struct{} + Nothing struct{} + Variadic struct { + other moq.ParamIndexing + args moq.ParamIndexing + } + RepeatedIds struct { + sParam1 moq.ParamIndexing + sParam2 moq.ParamIndexing + bParam moq.ParamIndexing + } + Times struct { + sParam moq.ParamIndexing + times moq.ParamIndexing + } + DifficultParamNames struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + param3 moq.ParamIndexing + param moq.ParamIndexing + param5 moq.ParamIndexing + param6 moq.ParamIndexing + param7 moq.ParamIndexing + param8 moq.ParamIndexing + param9 moq.ParamIndexing + } + DifficultResultNames struct{} + PassByArray struct { + p moq.ParamIndexing + } + PassByChan struct { + p moq.ParamIndexing + } + PassByEllipsis struct { + p moq.ParamIndexing + } + PassByMap struct { + p moq.ParamIndexing + } + PassByReference struct { + p moq.ParamIndexing + } + PassBySlice struct { + p moq.ParamIndexing + } + PassByValue struct { + p moq.ParamIndexing + } + InterfaceParam struct { + w moq.ParamIndexing + } + InterfaceResult struct { + sParam moq.ParamIndexing + bParam moq.ParamIndexing + } + FnParam struct { + fn moq.ParamIndexing + } + Other struct { + param1 moq.ParamIndexing + } + }{ + Usual: struct { + sParam moq.ParamIndexing + bParam moq.ParamIndexing + }{ + sParam: moq.ParamIndexByValue, + bParam: moq.ParamIndexByValue, + }, + NoNames: struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + }{ + param1: moq.ParamIndexByValue, + param2: moq.ParamIndexByValue, + }, + NoResults: struct { + sParam moq.ParamIndexing + bParam moq.ParamIndexing + }{ + sParam: moq.ParamIndexByValue, + bParam: moq.ParamIndexByValue, + }, + NoParams: struct{}{}, + Nothing: struct{}{}, + Variadic: struct { + other moq.ParamIndexing + args moq.ParamIndexing + }{ + other: moq.ParamIndexByValue, + args: moq.ParamIndexByHash, + }, + RepeatedIds: struct { + sParam1 moq.ParamIndexing + sParam2 moq.ParamIndexing + bParam moq.ParamIndexing + }{ + sParam1: moq.ParamIndexByValue, + sParam2: moq.ParamIndexByValue, + bParam: moq.ParamIndexByValue, + }, + Times: struct { + sParam moq.ParamIndexing + times moq.ParamIndexing + }{ + sParam: moq.ParamIndexByValue, + times: moq.ParamIndexByValue, + }, + DifficultParamNames: struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + param3 moq.ParamIndexing + param moq.ParamIndexing + param5 moq.ParamIndexing + param6 moq.ParamIndexing + param7 moq.ParamIndexing + param8 moq.ParamIndexing + param9 moq.ParamIndexing + }{ + param1: moq.ParamIndexByValue, + param2: moq.ParamIndexByValue, + param3: moq.ParamIndexByValue, + param: moq.ParamIndexByValue, + param5: moq.ParamIndexByValue, + param6: moq.ParamIndexByValue, + param7: moq.ParamIndexByValue, + param8: moq.ParamIndexByValue, + param9: moq.ParamIndexByValue, + }, + DifficultResultNames: struct{}{}, + PassByArray: struct { + p moq.ParamIndexing + }{ + p: moq.ParamIndexByValue, + }, + PassByChan: struct { + p moq.ParamIndexing + }{ + p: moq.ParamIndexByValue, + }, + PassByEllipsis: struct { + p moq.ParamIndexing + }{ + p: moq.ParamIndexByHash, + }, + PassByMap: struct { + p moq.ParamIndexing + }{ + p: moq.ParamIndexByHash, + }, + PassByReference: struct { + p moq.ParamIndexing + }{ + p: moq.ParamIndexByHash, + }, + PassBySlice: struct { + p moq.ParamIndexing + }{ + p: moq.ParamIndexByHash, + }, + PassByValue: struct { + p moq.ParamIndexing + }{ + p: moq.ParamIndexByValue, + }, + InterfaceParam: struct { + w moq.ParamIndexing + }{ + w: moq.ParamIndexByHash, + }, + InterfaceResult: struct { + sParam moq.ParamIndexing + bParam moq.ParamIndexing + }{ + sParam: moq.ParamIndexByValue, + bParam: moq.ParamIndexByValue, + }, + FnParam: struct { + fn moq.ParamIndexing + }{ + fn: moq.ParamIndexByHash, + }, + Other: struct { + param1 moq.ParamIndexing + }{ + param1: moq.ParamIndexByValue, + }, + }}, + } + m.moq.moq = m + + scene.AddMoq(m) + return m +} + +// mock returns the mock implementation of the Usual type +func (m *moqUsual) mock() *moqUsual_mock { return m.moq } + +func (m *moqUsual_mock) Usual(sParam string, bParam bool) (sResult string, err error) { + m.moq.scene.T.Helper() + params := moqUsual_Usual_params{ + sParam: sParam, + bParam: bParam, + } + var results *moqUsual_Usual_results + for _, resultsByParams := range m.moq.resultsByParams_Usual { + paramsKey := m.moq.paramsKey_Usual(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_Usual(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_Usual(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_Usual(params)) + } + } + + if result.doFn != nil { + result.doFn(sParam, bParam) + } + + if result.values != nil { + sResult = result.values.sResult + err = result.values.err + } + if result.doReturnFn != nil { + sResult, err = result.doReturnFn(sParam, bParam) + } + return +} + +func (m *moqUsual_mock) NoNames(param1 string, param2 bool) (result1 string, result2 error) { + m.moq.scene.T.Helper() + params := moqUsual_NoNames_params{ + param1: param1, + param2: param2, + } + var results *moqUsual_NoNames_results + for _, resultsByParams := range m.moq.resultsByParams_NoNames { + paramsKey := m.moq.paramsKey_NoNames(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_NoNames(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_NoNames(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_NoNames(params)) + } + } + + if result.doFn != nil { + result.doFn(param1, param2) + } + + if result.values != nil { + result1 = result.values.result1 + result2 = result.values.result2 + } + if result.doReturnFn != nil { + result1, result2 = result.doReturnFn(param1, param2) + } + return +} + +func (m *moqUsual_mock) NoResults(sParam string, bParam bool) { + m.moq.scene.T.Helper() + params := moqUsual_NoResults_params{ + sParam: sParam, + bParam: bParam, + } + var results *moqUsual_NoResults_results + for _, resultsByParams := range m.moq.resultsByParams_NoResults { + paramsKey := m.moq.paramsKey_NoResults(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_NoResults(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_NoResults(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_NoResults(params)) + } + } + + if result.doFn != nil { + result.doFn(sParam, bParam) + } + + if result.doReturnFn != nil { + result.doReturnFn(sParam, bParam) + } + return +} + +func (m *moqUsual_mock) NoParams() (sResult string, err error) { + m.moq.scene.T.Helper() + params := moqUsual_NoParams_params{} + var results *moqUsual_NoParams_results + for _, resultsByParams := range m.moq.resultsByParams_NoParams { + paramsKey := m.moq.paramsKey_NoParams(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_NoParams(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_NoParams(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_NoParams(params)) + } + } + + if result.doFn != nil { + result.doFn() + } + + if result.values != nil { + sResult = result.values.sResult + err = result.values.err + } + if result.doReturnFn != nil { + sResult, err = result.doReturnFn() + } + return +} + +func (m *moqUsual_mock) Nothing() { + m.moq.scene.T.Helper() + params := moqUsual_Nothing_params{} + var results *moqUsual_Nothing_results + for _, resultsByParams := range m.moq.resultsByParams_Nothing { + paramsKey := m.moq.paramsKey_Nothing(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_Nothing(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_Nothing(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_Nothing(params)) + } + } + + if result.doFn != nil { + result.doFn() + } + + if result.doReturnFn != nil { + result.doReturnFn() + } + return +} + +func (m *moqUsual_mock) Variadic(other bool, args ...string) (sResult string, err error) { + m.moq.scene.T.Helper() + params := moqUsual_Variadic_params{ + other: other, + args: args, + } + var results *moqUsual_Variadic_results + for _, resultsByParams := range m.moq.resultsByParams_Variadic { + paramsKey := m.moq.paramsKey_Variadic(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_Variadic(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_Variadic(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_Variadic(params)) + } + } + + if result.doFn != nil { + result.doFn(other, args...) + } + + if result.values != nil { + sResult = result.values.sResult + err = result.values.err + } + if result.doReturnFn != nil { + sResult, err = result.doReturnFn(other, args...) + } + return +} + +func (m *moqUsual_mock) RepeatedIds(sParam1, sParam2 string, bParam bool) (sResult1, sResult2 string, err error) { + m.moq.scene.T.Helper() + params := moqUsual_RepeatedIds_params{ + sParam1: sParam1, + sParam2: sParam2, + bParam: bParam, + } + var results *moqUsual_RepeatedIds_results + for _, resultsByParams := range m.moq.resultsByParams_RepeatedIds { + paramsKey := m.moq.paramsKey_RepeatedIds(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_RepeatedIds(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_RepeatedIds(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_RepeatedIds(params)) + } + } + + if result.doFn != nil { + result.doFn(sParam1, sParam2, bParam) + } + + if result.values != nil { + sResult1 = result.values.sResult1 + sResult2 = result.values.sResult2 + err = result.values.err + } + if result.doReturnFn != nil { + sResult1, sResult2, err = result.doReturnFn(sParam1, sParam2, bParam) + } + return +} + +func (m *moqUsual_mock) Times(sParam string, times bool) (sResult string, err error) { + m.moq.scene.T.Helper() + params := moqUsual_Times_params{ + sParam: sParam, + times: times, + } + var results *moqUsual_Times_results + for _, resultsByParams := range m.moq.resultsByParams_Times { + paramsKey := m.moq.paramsKey_Times(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_Times(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_Times(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_Times(params)) + } + } + + if result.doFn != nil { + result.doFn(sParam, times) + } + + if result.values != nil { + sResult = result.values.sResult + err = result.values.err + } + if result.doReturnFn != nil { + sResult, err = result.doReturnFn(sParam, times) + } + return +} + +func (m *moqUsual_mock) DifficultParamNames(param1, param2 bool, param3 string, param, param5, param6 int, param7, param8, param9 float32) { + m.moq.scene.T.Helper() + params := moqUsual_DifficultParamNames_params{ + param1: param1, + param2: param2, + param3: param3, + param: param, + param5: param5, + param6: param6, + param7: param7, + param8: param8, + param9: param9, + } + var results *moqUsual_DifficultParamNames_results + for _, resultsByParams := range m.moq.resultsByParams_DifficultParamNames { + paramsKey := m.moq.paramsKey_DifficultParamNames(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_DifficultParamNames(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_DifficultParamNames(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_DifficultParamNames(params)) + } + } + + if result.doFn != nil { + result.doFn(param1, param2, param3, param, param5, param6, param7, param8, param9) + } + + if result.doReturnFn != nil { + result.doReturnFn(param1, param2, param3, param, param5, param6, param7, param8, param9) + } + return +} + +func (m *moqUsual_mock) DifficultResultNames() (result1, result2 string, result3 error, param, result5, result6 int, result7, result8, result9 float32) { + m.moq.scene.T.Helper() + params := moqUsual_DifficultResultNames_params{} + var results *moqUsual_DifficultResultNames_results + for _, resultsByParams := range m.moq.resultsByParams_DifficultResultNames { + paramsKey := m.moq.paramsKey_DifficultResultNames(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_DifficultResultNames(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_DifficultResultNames(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_DifficultResultNames(params)) + } + } + + if result.doFn != nil { + result.doFn() + } + + if result.values != nil { + result1 = result.values.result1 + result2 = result.values.result2 + result3 = result.values.result3 + param = result.values.param + result5 = result.values.result5 + result6 = result.values.result6 + result7 = result.values.result7 + result8 = result.values.result8 + result9 = result.values.result9 + } + if result.doReturnFn != nil { + result1, result2, result3, param, result5, result6, result7, result8, result9 = result.doReturnFn() + } + return +} + +func (m *moqUsual_mock) PassByArray(p [3]testmoqs.Params) (result1 [3]testmoqs.Results) { + m.moq.scene.T.Helper() + params := moqUsual_PassByArray_params{ + p: p, + } + var results *moqUsual_PassByArray_results + for _, resultsByParams := range m.moq.resultsByParams_PassByArray { + paramsKey := m.moq.paramsKey_PassByArray(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_PassByArray(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_PassByArray(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_PassByArray(params)) + } + } + + if result.doFn != nil { + result.doFn(p) + } + + if result.values != nil { + result1 = result.values.result1 + } + if result.doReturnFn != nil { + result1 = result.doReturnFn(p) + } + return +} + +func (m *moqUsual_mock) PassByChan(p chan testmoqs.Params) (result1 chan testmoqs.Results) { + m.moq.scene.T.Helper() + params := moqUsual_PassByChan_params{ + p: p, + } + var results *moqUsual_PassByChan_results + for _, resultsByParams := range m.moq.resultsByParams_PassByChan { + paramsKey := m.moq.paramsKey_PassByChan(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_PassByChan(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_PassByChan(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_PassByChan(params)) + } + } + + if result.doFn != nil { + result.doFn(p) + } + + if result.values != nil { + result1 = result.values.result1 + } + if result.doReturnFn != nil { + result1 = result.doReturnFn(p) + } + return +} + +func (m *moqUsual_mock) PassByEllipsis(p ...testmoqs.Params) (result1 string, result2 error) { + m.moq.scene.T.Helper() + params := moqUsual_PassByEllipsis_params{ + p: p, + } + var results *moqUsual_PassByEllipsis_results + for _, resultsByParams := range m.moq.resultsByParams_PassByEllipsis { + paramsKey := m.moq.paramsKey_PassByEllipsis(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_PassByEllipsis(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_PassByEllipsis(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_PassByEllipsis(params)) + } + } + + if result.doFn != nil { + result.doFn(p...) + } + + if result.values != nil { + result1 = result.values.result1 + result2 = result.values.result2 + } + if result.doReturnFn != nil { + result1, result2 = result.doReturnFn(p...) + } + return +} + +func (m *moqUsual_mock) PassByMap(p map[string]testmoqs.Params) (result1 map[string]testmoqs.Results) { + m.moq.scene.T.Helper() + params := moqUsual_PassByMap_params{ + p: p, + } + var results *moqUsual_PassByMap_results + for _, resultsByParams := range m.moq.resultsByParams_PassByMap { + paramsKey := m.moq.paramsKey_PassByMap(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_PassByMap(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_PassByMap(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_PassByMap(params)) + } + } + + if result.doFn != nil { + result.doFn(p) + } + + if result.values != nil { + result1 = result.values.result1 + } + if result.doReturnFn != nil { + result1 = result.doReturnFn(p) + } + return +} + +func (m *moqUsual_mock) PassByReference(p *testmoqs.Params) (result1 *testmoqs.Results) { + m.moq.scene.T.Helper() + params := moqUsual_PassByReference_params{ + p: p, + } + var results *moqUsual_PassByReference_results + for _, resultsByParams := range m.moq.resultsByParams_PassByReference { + paramsKey := m.moq.paramsKey_PassByReference(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_PassByReference(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_PassByReference(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_PassByReference(params)) + } + } + + if result.doFn != nil { + result.doFn(p) + } + + if result.values != nil { + result1 = result.values.result1 + } + if result.doReturnFn != nil { + result1 = result.doReturnFn(p) + } + return +} + +func (m *moqUsual_mock) PassBySlice(p []testmoqs.Params) (result1 []testmoqs.Results) { + m.moq.scene.T.Helper() + params := moqUsual_PassBySlice_params{ + p: p, + } + var results *moqUsual_PassBySlice_results + for _, resultsByParams := range m.moq.resultsByParams_PassBySlice { + paramsKey := m.moq.paramsKey_PassBySlice(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_PassBySlice(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_PassBySlice(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_PassBySlice(params)) + } + } + + if result.doFn != nil { + result.doFn(p) + } + + if result.values != nil { + result1 = result.values.result1 + } + if result.doReturnFn != nil { + result1 = result.doReturnFn(p) + } + return +} + +func (m *moqUsual_mock) PassByValue(p testmoqs.Params) (result1 testmoqs.Results) { + m.moq.scene.T.Helper() + params := moqUsual_PassByValue_params{ + p: p, + } + var results *moqUsual_PassByValue_results + for _, resultsByParams := range m.moq.resultsByParams_PassByValue { + paramsKey := m.moq.paramsKey_PassByValue(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_PassByValue(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_PassByValue(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_PassByValue(params)) + } + } + + if result.doFn != nil { + result.doFn(p) + } + + if result.values != nil { + result1 = result.values.result1 + } + if result.doReturnFn != nil { + result1 = result.doReturnFn(p) + } + return +} + +func (m *moqUsual_mock) InterfaceParam(w io.Writer) (sResult string, err error) { + m.moq.scene.T.Helper() + params := moqUsual_InterfaceParam_params{ + w: w, + } + var results *moqUsual_InterfaceParam_results + for _, resultsByParams := range m.moq.resultsByParams_InterfaceParam { + paramsKey := m.moq.paramsKey_InterfaceParam(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_InterfaceParam(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_InterfaceParam(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_InterfaceParam(params)) + } + } + + if result.doFn != nil { + result.doFn(w) + } + + if result.values != nil { + sResult = result.values.sResult + err = result.values.err + } + if result.doReturnFn != nil { + sResult, err = result.doReturnFn(w) + } + return } -// mock returns the mock implementation of the Usual type -func (m *moqUsual) mock() *moqUsual_mock { return m.moq } - -func (m *moqUsual_mock) Usual(sParam string, bParam bool) (sResult string, err error) { +func (m *moqUsual_mock) InterfaceResult(sParam string, bParam bool) (result1 io.Reader) { m.moq.scene.T.Helper() - params := moqUsual_Usual_params{ + params := moqUsual_InterfaceResult_params{ sParam: sParam, bParam: bParam, } - var results *moqUsual_Usual_results - for _, resultsByParams := range m.moq.resultsByParams_Usual { - paramsKey := m.moq.paramsKey_Usual(params, resultsByParams.anyParams) + var results *moqUsual_InterfaceResult_results + for _, resultsByParams := range m.moq.resultsByParams_InterfaceResult { + paramsKey := m.moq.paramsKey_InterfaceResult(params, resultsByParams.anyParams) var ok bool results, ok = resultsByParams.results[paramsKey] if ok { @@ -9393,7 +12874,7 @@ func (m *moqUsual_mock) Usual(sParam string, bParam bool) (sResult string, err e } if results == nil { if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_Usual(params)) + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_InterfaceResult(params)) } return } @@ -9402,7 +12883,7 @@ func (m *moqUsual_mock) Usual(sParam string, bParam bool) (sResult string, err e if i >= results.repeat.ResultCount { if !results.repeat.AnyTimes { if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_Usual(params)) + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_InterfaceResult(params)) } return } @@ -9413,7 +12894,7 @@ func (m *moqUsual_mock) Usual(sParam string, bParam bool) (sResult string, err e if result.sequence != 0 { sequence := m.moq.scene.NextMockSequence() if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_Usual(params)) + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_InterfaceResult(params)) } } @@ -9422,24 +12903,72 @@ func (m *moqUsual_mock) Usual(sParam string, bParam bool) (sResult string, err e } if result.values != nil { - sResult = result.values.sResult - err = result.values.err + result1 = result.values.result1 } if result.doReturnFn != nil { - sResult, err = result.doReturnFn(sParam, bParam) + result1 = result.doReturnFn(sParam, bParam) } return } -func (m *moqUsual_mock) NoNames(param1 string, param2 bool) (result1 string, result2 error) { +func (m *moqUsual_mock) FnParam(fn func()) { m.moq.scene.T.Helper() - params := moqUsual_NoNames_params{ + params := moqUsual_FnParam_params{ + fn: fn, + } + var results *moqUsual_FnParam_results + for _, resultsByParams := range m.moq.resultsByParams_FnParam { + paramsKey := m.moq.paramsKey_FnParam(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_FnParam(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_FnParam(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_FnParam(params)) + } + } + + if result.doFn != nil { + result.doFn(fn) + } + + if result.doReturnFn != nil { + result.doReturnFn(fn) + } + return +} + +func (m *moqUsual_mock) Other(param1 other.Params) (result1 other.Results) { + m.moq.scene.T.Helper() + params := moqUsual_Other_params{ param1: param1, - param2: param2, } - var results *moqUsual_NoNames_results - for _, resultsByParams := range m.moq.resultsByParams_NoNames { - paramsKey := m.moq.paramsKey_NoNames(params, resultsByParams.anyParams) + var results *moqUsual_Other_results + for _, resultsByParams := range m.moq.resultsByParams_Other { + paramsKey := m.moq.paramsKey_Other(params, resultsByParams.anyParams) var ok bool results, ok = resultsByParams.results[paramsKey] if ok { @@ -9447,1121 +12976,1615 @@ func (m *moqUsual_mock) NoNames(param1 string, param2 bool) (result1 string, res } } if results == nil { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_NoNames(params)) + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_Other(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_Other(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_Other(params)) + } + } + + if result.doFn != nil { + result.doFn(param1) + } + + if result.values != nil { + result1 = result.values.result1 + } + if result.doReturnFn != nil { + result1 = result.doReturnFn(param1) + } + return +} + +// onCall returns the recorder implementation of the Usual type +func (m *moqUsual) onCall() *moqUsual_recorder { + return &moqUsual_recorder{ + moq: m, + } +} + +func (m *moqUsual_recorder) Usual(sParam string, bParam bool) *moqUsual_Usual_fnRecorder { + return &moqUsual_Usual_fnRecorder{ + params: moqUsual_Usual_params{ + sParam: sParam, + bParam: bParam, + }, + sequence: m.moq.config.Sequence == moq.SeqDefaultOn, + moq: m.moq, + } +} + +func (r *moqUsual_Usual_fnRecorder) any() *moqUsual_Usual_anyParams { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) + return nil + } + return &moqUsual_Usual_anyParams{recorder: r} +} + +func (a *moqUsual_Usual_anyParams) sParam() *moqUsual_Usual_fnRecorder { + a.recorder.anyParams |= 1 << 0 + return a.recorder +} + +func (a *moqUsual_Usual_anyParams) bParam() *moqUsual_Usual_fnRecorder { + a.recorder.anyParams |= 1 << 1 + return a.recorder +} + +func (r *moqUsual_Usual_fnRecorder) seq() *moqUsual_Usual_fnRecorder { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) + return nil + } + r.sequence = true + return r +} + +func (r *moqUsual_Usual_fnRecorder) noSeq() *moqUsual_Usual_fnRecorder { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) + return nil + } + r.sequence = false + return r +} + +func (r *moqUsual_Usual_fnRecorder) returnResults(sResult string, err error) *moqUsual_Usual_fnRecorder { + r.moq.scene.T.Helper() + r.findResults() + + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() + } + + r.results.results = append(r.results.results, struct { + values *struct { + sResult string + err error + } + sequence uint32 + doFn moqUsual_Usual_doFn + doReturnFn moqUsual_Usual_doReturnFn + }{ + values: &struct { + sResult string + err error + }{ + sResult: sResult, + err: err, + }, + sequence: sequence, + }) + return r +} + +func (r *moqUsual_Usual_fnRecorder) andDo(fn moqUsual_Usual_doFn) *moqUsual_Usual_fnRecorder { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") + return nil + } + last := &r.results.results[len(r.results.results)-1] + last.doFn = fn + return r +} + +func (r *moqUsual_Usual_fnRecorder) doReturnResults(fn moqUsual_Usual_doReturnFn) *moqUsual_Usual_fnRecorder { + r.moq.scene.T.Helper() + r.findResults() + + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() + } + + r.results.results = append(r.results.results, struct { + values *struct { + sResult string + err error + } + sequence uint32 + doFn moqUsual_Usual_doFn + doReturnFn moqUsual_Usual_doReturnFn + }{sequence: sequence, doReturnFn: fn}) + return r +} + +func (r *moqUsual_Usual_fnRecorder) findResults() { + r.moq.scene.T.Helper() + if r.results != nil { + r.results.repeat.Increment(r.moq.scene.T) + return + } + + anyCount := bits.OnesCount64(r.anyParams) + insertAt := -1 + var results *moqUsual_Usual_resultsByParams + for n, res := range r.moq.resultsByParams_Usual { + if res.anyParams == r.anyParams { + results = &res + break + } + if res.anyCount > anyCount { + insertAt = n + } + } + if results == nil { + results = &moqUsual_Usual_resultsByParams{ + anyCount: anyCount, + anyParams: r.anyParams, + results: map[moqUsual_Usual_paramsKey]*moqUsual_Usual_results{}, } - return - } - - i := int(atomic.AddUint32(&results.index, 1)) - 1 - if i >= results.repeat.ResultCount { - if !results.repeat.AnyTimes { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_NoNames(params)) - } - return + r.moq.resultsByParams_Usual = append(r.moq.resultsByParams_Usual, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_Usual) { + copy(r.moq.resultsByParams_Usual[insertAt+1:], r.moq.resultsByParams_Usual[insertAt:0]) + r.moq.resultsByParams_Usual[insertAt] = *results } - i = results.repeat.ResultCount - 1 } - result := results.results[i] - if result.sequence != 0 { - sequence := m.moq.scene.NextMockSequence() - if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_NoNames(params)) + paramsKey := r.moq.paramsKey_Usual(r.params, r.anyParams) + + var ok bool + r.results, ok = results.results[paramsKey] + if !ok { + r.results = &moqUsual_Usual_results{ + params: r.params, + results: nil, + index: 0, + repeat: &moq.RepeatVal{}, } + results.results[paramsKey] = r.results } - if result.doFn != nil { - result.doFn(param1, param2) - } + r.results.repeat.Increment(r.moq.scene.T) +} - if result.values != nil { - result1 = result.values.result1 - result2 = result.values.result2 +func (r *moqUsual_Usual_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_Usual_fnRecorder { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") + return nil } - if result.doReturnFn != nil { - result1, result2 = result.doReturnFn(param1, param2) + r.results.repeat.Repeat(r.moq.scene.T, repeaters) + last := r.results.results[len(r.results.results)-1] + for n := 0; n < r.results.repeat.ResultCount-1; n++ { + if r.sequence { + last = struct { + values *struct { + sResult string + err error + } + sequence uint32 + doFn moqUsual_Usual_doFn + doReturnFn moqUsual_Usual_doReturnFn + }{ + values: last.values, + sequence: r.moq.scene.NextRecorderSequence(), + } + } + r.results.results = append(r.results.results, last) } - return + return r } -func (m *moqUsual_mock) NoResults(sParam string, bParam bool) { - m.moq.scene.T.Helper() - params := moqUsual_NoResults_params{ - sParam: sParam, - bParam: bParam, - } - var results *moqUsual_NoResults_results - for _, resultsByParams := range m.moq.resultsByParams_NoResults { - paramsKey := m.moq.paramsKey_NoResults(params, resultsByParams.anyParams) - var ok bool - results, ok = resultsByParams.results[paramsKey] - if ok { - break +func (m *moqUsual) prettyParams_Usual(params moqUsual_Usual_params) string { + return fmt.Sprintf("Usual(%#v, %#v)", params.sParam, params.bParam) +} + +func (m *moqUsual) paramsKey_Usual(params moqUsual_Usual_params, anyParams uint64) moqUsual_Usual_paramsKey { + m.scene.T.Helper() + var sParamUsed string + var sParamUsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.runtime.parameterIndexing.Usual.sParam == moq.ParamIndexByValue { + sParamUsed = params.sParam + } else { + sParamUsedHash = hash.DeepHash(params.sParam) } } - if results == nil { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_NoResults(params)) + var bParamUsed bool + var bParamUsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.runtime.parameterIndexing.Usual.bParam == moq.ParamIndexByValue { + bParamUsed = params.bParam + } else { + bParamUsedHash = hash.DeepHash(params.bParam) } - return } - - i := int(atomic.AddUint32(&results.index, 1)) - 1 - if i >= results.repeat.ResultCount { - if !results.repeat.AnyTimes { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_NoResults(params)) - } - return - } - i = results.repeat.ResultCount - 1 + return moqUsual_Usual_paramsKey{ + params: struct { + sParam string + bParam bool + }{ + sParam: sParamUsed, + bParam: bParamUsed, + }, + hashes: struct { + sParam hash.Hash + bParam hash.Hash + }{ + sParam: sParamUsedHash, + bParam: bParamUsedHash, + }, } +} - result := results.results[i] - if result.sequence != 0 { - sequence := m.moq.scene.NextMockSequence() - if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_NoResults(params)) - } +func (m *moqUsual_recorder) NoNames(param1 string, param2 bool) *moqUsual_NoNames_fnRecorder { + return &moqUsual_NoNames_fnRecorder{ + params: moqUsual_NoNames_params{ + param1: param1, + param2: param2, + }, + sequence: m.moq.config.Sequence == moq.SeqDefaultOn, + moq: m.moq, } +} - if result.doFn != nil { - result.doFn(sParam, bParam) +func (r *moqUsual_NoNames_fnRecorder) any() *moqUsual_NoNames_anyParams { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_NoNames(r.params)) + return nil } + return &moqUsual_NoNames_anyParams{recorder: r} +} - if result.doReturnFn != nil { - result.doReturnFn(sParam, bParam) +func (a *moqUsual_NoNames_anyParams) param1() *moqUsual_NoNames_fnRecorder { + a.recorder.anyParams |= 1 << 0 + return a.recorder +} + +func (a *moqUsual_NoNames_anyParams) param2() *moqUsual_NoNames_fnRecorder { + a.recorder.anyParams |= 1 << 1 + return a.recorder +} + +func (r *moqUsual_NoNames_fnRecorder) seq() *moqUsual_NoNames_fnRecorder { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_NoNames(r.params)) + return nil } - return + r.sequence = true + return r } -func (m *moqUsual_mock) NoParams() (sResult string, err error) { - m.moq.scene.T.Helper() - params := moqUsual_NoParams_params{} - var results *moqUsual_NoParams_results - for _, resultsByParams := range m.moq.resultsByParams_NoParams { - paramsKey := m.moq.paramsKey_NoParams(params, resultsByParams.anyParams) - var ok bool - results, ok = resultsByParams.results[paramsKey] - if ok { - break - } +func (r *moqUsual_NoNames_fnRecorder) noSeq() *moqUsual_NoNames_fnRecorder { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_NoNames(r.params)) + return nil } - if results == nil { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_NoParams(params)) - } - return + r.sequence = false + return r +} + +func (r *moqUsual_NoNames_fnRecorder) returnResults(result1 string, result2 error) *moqUsual_NoNames_fnRecorder { + r.moq.scene.T.Helper() + r.findResults() + + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() } - i := int(atomic.AddUint32(&results.index, 1)) - 1 - if i >= results.repeat.ResultCount { - if !results.repeat.AnyTimes { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_NoParams(params)) - } - return + r.results.results = append(r.results.results, struct { + values *struct { + result1 string + result2 error } - i = results.repeat.ResultCount - 1 + sequence uint32 + doFn moqUsual_NoNames_doFn + doReturnFn moqUsual_NoNames_doReturnFn + }{ + values: &struct { + result1 string + result2 error + }{ + result1: result1, + result2: result2, + }, + sequence: sequence, + }) + return r +} + +func (r *moqUsual_NoNames_fnRecorder) andDo(fn moqUsual_NoNames_doFn) *moqUsual_NoNames_fnRecorder { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") + return nil } + last := &r.results.results[len(r.results.results)-1] + last.doFn = fn + return r +} - result := results.results[i] - if result.sequence != 0 { - sequence := m.moq.scene.NextMockSequence() - if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_NoParams(params)) - } - } +func (r *moqUsual_NoNames_fnRecorder) doReturnResults(fn moqUsual_NoNames_doReturnFn) *moqUsual_NoNames_fnRecorder { + r.moq.scene.T.Helper() + r.findResults() - if result.doFn != nil { - result.doFn() + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() } - if result.values != nil { - sResult = result.values.sResult - err = result.values.err - } - if result.doReturnFn != nil { - sResult, err = result.doReturnFn() - } - return + r.results.results = append(r.results.results, struct { + values *struct { + result1 string + result2 error + } + sequence uint32 + doFn moqUsual_NoNames_doFn + doReturnFn moqUsual_NoNames_doReturnFn + }{sequence: sequence, doReturnFn: fn}) + return r } -func (m *moqUsual_mock) Nothing() { - m.moq.scene.T.Helper() - params := moqUsual_Nothing_params{} - var results *moqUsual_Nothing_results - for _, resultsByParams := range m.moq.resultsByParams_Nothing { - paramsKey := m.moq.paramsKey_Nothing(params, resultsByParams.anyParams) - var ok bool - results, ok = resultsByParams.results[paramsKey] - if ok { +func (r *moqUsual_NoNames_fnRecorder) findResults() { + r.moq.scene.T.Helper() + if r.results != nil { + r.results.repeat.Increment(r.moq.scene.T) + return + } + + anyCount := bits.OnesCount64(r.anyParams) + insertAt := -1 + var results *moqUsual_NoNames_resultsByParams + for n, res := range r.moq.resultsByParams_NoNames { + if res.anyParams == r.anyParams { + results = &res break } + if res.anyCount > anyCount { + insertAt = n + } } if results == nil { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_Nothing(params)) + results = &moqUsual_NoNames_resultsByParams{ + anyCount: anyCount, + anyParams: r.anyParams, + results: map[moqUsual_NoNames_paramsKey]*moqUsual_NoNames_results{}, } - return - } - - i := int(atomic.AddUint32(&results.index, 1)) - 1 - if i >= results.repeat.ResultCount { - if !results.repeat.AnyTimes { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_Nothing(params)) - } - return + r.moq.resultsByParams_NoNames = append(r.moq.resultsByParams_NoNames, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_NoNames) { + copy(r.moq.resultsByParams_NoNames[insertAt+1:], r.moq.resultsByParams_NoNames[insertAt:0]) + r.moq.resultsByParams_NoNames[insertAt] = *results } - i = results.repeat.ResultCount - 1 } - result := results.results[i] - if result.sequence != 0 { - sequence := m.moq.scene.NextMockSequence() - if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_Nothing(params)) - } - } + paramsKey := r.moq.paramsKey_NoNames(r.params, r.anyParams) - if result.doFn != nil { - result.doFn() + var ok bool + r.results, ok = results.results[paramsKey] + if !ok { + r.results = &moqUsual_NoNames_results{ + params: r.params, + results: nil, + index: 0, + repeat: &moq.RepeatVal{}, + } + results.results[paramsKey] = r.results } - if result.doReturnFn != nil { - result.doReturnFn() - } - return + r.results.repeat.Increment(r.moq.scene.T) } -func (m *moqUsual_mock) Variadic(other bool, args ...string) (sResult string, err error) { - m.moq.scene.T.Helper() - params := moqUsual_Variadic_params{ - other: other, - args: args, - } - var results *moqUsual_Variadic_results - for _, resultsByParams := range m.moq.resultsByParams_Variadic { - paramsKey := m.moq.paramsKey_Variadic(params, resultsByParams.anyParams) - var ok bool - results, ok = resultsByParams.results[paramsKey] - if ok { - break - } +func (r *moqUsual_NoNames_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_NoNames_fnRecorder { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") + return nil } - if results == nil { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_Variadic(params)) + r.results.repeat.Repeat(r.moq.scene.T, repeaters) + last := r.results.results[len(r.results.results)-1] + for n := 0; n < r.results.repeat.ResultCount-1; n++ { + if r.sequence { + last = struct { + values *struct { + result1 string + result2 error + } + sequence uint32 + doFn moqUsual_NoNames_doFn + doReturnFn moqUsual_NoNames_doReturnFn + }{ + values: last.values, + sequence: r.moq.scene.NextRecorderSequence(), + } } - return + r.results.results = append(r.results.results, last) } + return r +} - i := int(atomic.AddUint32(&results.index, 1)) - 1 - if i >= results.repeat.ResultCount { - if !results.repeat.AnyTimes { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_Variadic(params)) - } - return +func (m *moqUsual) prettyParams_NoNames(params moqUsual_NoNames_params) string { + return fmt.Sprintf("NoNames(%#v, %#v)", params.param1, params.param2) +} + +func (m *moqUsual) paramsKey_NoNames(params moqUsual_NoNames_params, anyParams uint64) moqUsual_NoNames_paramsKey { + m.scene.T.Helper() + var param1Used string + var param1UsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.runtime.parameterIndexing.NoNames.param1 == moq.ParamIndexByValue { + param1Used = params.param1 + } else { + param1UsedHash = hash.DeepHash(params.param1) } - i = results.repeat.ResultCount - 1 } - - result := results.results[i] - if result.sequence != 0 { - sequence := m.moq.scene.NextMockSequence() - if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_Variadic(params)) + var param2Used bool + var param2UsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.runtime.parameterIndexing.NoNames.param2 == moq.ParamIndexByValue { + param2Used = params.param2 + } else { + param2UsedHash = hash.DeepHash(params.param2) } } - - if result.doFn != nil { - result.doFn(other, args...) + return moqUsual_NoNames_paramsKey{ + params: struct { + param1 string + param2 bool + }{ + param1: param1Used, + param2: param2Used, + }, + hashes: struct { + param1 hash.Hash + param2 hash.Hash + }{ + param1: param1UsedHash, + param2: param2UsedHash, + }, } +} - if result.values != nil { - sResult = result.values.sResult - err = result.values.err - } - if result.doReturnFn != nil { - sResult, err = result.doReturnFn(other, args...) +func (m *moqUsual_recorder) NoResults(sParam string, bParam bool) *moqUsual_NoResults_fnRecorder { + return &moqUsual_NoResults_fnRecorder{ + params: moqUsual_NoResults_params{ + sParam: sParam, + bParam: bParam, + }, + sequence: m.moq.config.Sequence == moq.SeqDefaultOn, + moq: m.moq, } - return } -func (m *moqUsual_mock) RepeatedIds(sParam1, sParam2 string, bParam bool) (sResult1, sResult2 string, err error) { - m.moq.scene.T.Helper() - params := moqUsual_RepeatedIds_params{ - sParam1: sParam1, - sParam2: sParam2, - bParam: bParam, - } - var results *moqUsual_RepeatedIds_results - for _, resultsByParams := range m.moq.resultsByParams_RepeatedIds { - paramsKey := m.moq.paramsKey_RepeatedIds(params, resultsByParams.anyParams) - var ok bool - results, ok = resultsByParams.results[paramsKey] - if ok { - break - } - } - if results == nil { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_RepeatedIds(params)) - } - return +func (r *moqUsual_NoResults_fnRecorder) any() *moqUsual_NoResults_anyParams { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_NoResults(r.params)) + return nil } + return &moqUsual_NoResults_anyParams{recorder: r} +} + +func (a *moqUsual_NoResults_anyParams) sParam() *moqUsual_NoResults_fnRecorder { + a.recorder.anyParams |= 1 << 0 + return a.recorder +} + +func (a *moqUsual_NoResults_anyParams) bParam() *moqUsual_NoResults_fnRecorder { + a.recorder.anyParams |= 1 << 1 + return a.recorder +} - i := int(atomic.AddUint32(&results.index, 1)) - 1 - if i >= results.repeat.ResultCount { - if !results.repeat.AnyTimes { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_RepeatedIds(params)) - } - return - } - i = results.repeat.ResultCount - 1 +func (r *moqUsual_NoResults_fnRecorder) seq() *moqUsual_NoResults_fnRecorder { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_NoResults(r.params)) + return nil } + r.sequence = true + return r +} - result := results.results[i] - if result.sequence != 0 { - sequence := m.moq.scene.NextMockSequence() - if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_RepeatedIds(params)) - } +func (r *moqUsual_NoResults_fnRecorder) noSeq() *moqUsual_NoResults_fnRecorder { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_NoResults(r.params)) + return nil } + r.sequence = false + return r +} - if result.doFn != nil { - result.doFn(sParam1, sParam2, bParam) +func (r *moqUsual_NoResults_fnRecorder) returnResults() *moqUsual_NoResults_fnRecorder { + r.moq.scene.T.Helper() + r.findResults() + + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() } - if result.values != nil { - sResult1 = result.values.sResult1 - sResult2 = result.values.sResult2 - err = result.values.err + r.results.results = append(r.results.results, struct { + values *struct{} + sequence uint32 + doFn moqUsual_NoResults_doFn + doReturnFn moqUsual_NoResults_doReturnFn + }{ + values: &struct{}{}, + sequence: sequence, + }) + return r +} + +func (r *moqUsual_NoResults_fnRecorder) andDo(fn moqUsual_NoResults_doFn) *moqUsual_NoResults_fnRecorder { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") + return nil } - if result.doReturnFn != nil { - sResult1, sResult2, err = result.doReturnFn(sParam1, sParam2, bParam) + last := &r.results.results[len(r.results.results)-1] + last.doFn = fn + return r +} + +func (r *moqUsual_NoResults_fnRecorder) doReturnResults(fn moqUsual_NoResults_doReturnFn) *moqUsual_NoResults_fnRecorder { + r.moq.scene.T.Helper() + r.findResults() + + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() } - return + + r.results.results = append(r.results.results, struct { + values *struct{} + sequence uint32 + doFn moqUsual_NoResults_doFn + doReturnFn moqUsual_NoResults_doReturnFn + }{sequence: sequence, doReturnFn: fn}) + return r } -func (m *moqUsual_mock) Times(sParam string, times bool) (sResult string, err error) { - m.moq.scene.T.Helper() - params := moqUsual_Times_params{ - sParam: sParam, - times: times, +func (r *moqUsual_NoResults_fnRecorder) findResults() { + r.moq.scene.T.Helper() + if r.results != nil { + r.results.repeat.Increment(r.moq.scene.T) + return } - var results *moqUsual_Times_results - for _, resultsByParams := range m.moq.resultsByParams_Times { - paramsKey := m.moq.paramsKey_Times(params, resultsByParams.anyParams) - var ok bool - results, ok = resultsByParams.results[paramsKey] - if ok { + + anyCount := bits.OnesCount64(r.anyParams) + insertAt := -1 + var results *moqUsual_NoResults_resultsByParams + for n, res := range r.moq.resultsByParams_NoResults { + if res.anyParams == r.anyParams { + results = &res break } + if res.anyCount > anyCount { + insertAt = n + } } if results == nil { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_Times(params)) + results = &moqUsual_NoResults_resultsByParams{ + anyCount: anyCount, + anyParams: r.anyParams, + results: map[moqUsual_NoResults_paramsKey]*moqUsual_NoResults_results{}, } - return - } - - i := int(atomic.AddUint32(&results.index, 1)) - 1 - if i >= results.repeat.ResultCount { - if !results.repeat.AnyTimes { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_Times(params)) - } - return + r.moq.resultsByParams_NoResults = append(r.moq.resultsByParams_NoResults, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_NoResults) { + copy(r.moq.resultsByParams_NoResults[insertAt+1:], r.moq.resultsByParams_NoResults[insertAt:0]) + r.moq.resultsByParams_NoResults[insertAt] = *results } - i = results.repeat.ResultCount - 1 } - result := results.results[i] - if result.sequence != 0 { - sequence := m.moq.scene.NextMockSequence() - if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_Times(params)) - } - } + paramsKey := r.moq.paramsKey_NoResults(r.params, r.anyParams) - if result.doFn != nil { - result.doFn(sParam, times) + var ok bool + r.results, ok = results.results[paramsKey] + if !ok { + r.results = &moqUsual_NoResults_results{ + params: r.params, + results: nil, + index: 0, + repeat: &moq.RepeatVal{}, + } + results.results[paramsKey] = r.results } - if result.values != nil { - sResult = result.values.sResult - err = result.values.err - } - if result.doReturnFn != nil { - sResult, err = result.doReturnFn(sParam, times) - } - return + r.results.repeat.Increment(r.moq.scene.T) } -func (m *moqUsual_mock) DifficultParamNames(param1, param2 bool, param3 string, param, param5, param6 int, param7, param8, param9 float32) { - m.moq.scene.T.Helper() - params := moqUsual_DifficultParamNames_params{ - param1: param1, - param2: param2, - param3: param3, - param: param, - param5: param5, - param6: param6, - param7: param7, - param8: param8, - param9: param9, - } - var results *moqUsual_DifficultParamNames_results - for _, resultsByParams := range m.moq.resultsByParams_DifficultParamNames { - paramsKey := m.moq.paramsKey_DifficultParamNames(params, resultsByParams.anyParams) - var ok bool - results, ok = resultsByParams.results[paramsKey] - if ok { - break - } +func (r *moqUsual_NoResults_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_NoResults_fnRecorder { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") + return nil } - if results == nil { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_DifficultParamNames(params)) + r.results.repeat.Repeat(r.moq.scene.T, repeaters) + last := r.results.results[len(r.results.results)-1] + for n := 0; n < r.results.repeat.ResultCount-1; n++ { + if r.sequence { + last = struct { + values *struct{} + sequence uint32 + doFn moqUsual_NoResults_doFn + doReturnFn moqUsual_NoResults_doReturnFn + }{ + values: last.values, + sequence: r.moq.scene.NextRecorderSequence(), + } } - return + r.results.results = append(r.results.results, last) } + return r +} - i := int(atomic.AddUint32(&results.index, 1)) - 1 - if i >= results.repeat.ResultCount { - if !results.repeat.AnyTimes { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_DifficultParamNames(params)) - } - return +func (m *moqUsual) prettyParams_NoResults(params moqUsual_NoResults_params) string { + return fmt.Sprintf("NoResults(%#v, %#v)", params.sParam, params.bParam) +} + +func (m *moqUsual) paramsKey_NoResults(params moqUsual_NoResults_params, anyParams uint64) moqUsual_NoResults_paramsKey { + m.scene.T.Helper() + var sParamUsed string + var sParamUsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.runtime.parameterIndexing.NoResults.sParam == moq.ParamIndexByValue { + sParamUsed = params.sParam + } else { + sParamUsedHash = hash.DeepHash(params.sParam) } - i = results.repeat.ResultCount - 1 } - - result := results.results[i] - if result.sequence != 0 { - sequence := m.moq.scene.NextMockSequence() - if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_DifficultParamNames(params)) + var bParamUsed bool + var bParamUsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.runtime.parameterIndexing.NoResults.bParam == moq.ParamIndexByValue { + bParamUsed = params.bParam + } else { + bParamUsedHash = hash.DeepHash(params.bParam) } } + return moqUsual_NoResults_paramsKey{ + params: struct { + sParam string + bParam bool + }{ + sParam: sParamUsed, + bParam: bParamUsed, + }, + hashes: struct { + sParam hash.Hash + bParam hash.Hash + }{ + sParam: sParamUsedHash, + bParam: bParamUsedHash, + }, + } +} - if result.doFn != nil { - result.doFn(param1, param2, param3, param, param5, param6, param7, param8, param9) +func (m *moqUsual_recorder) NoParams() *moqUsual_NoParams_fnRecorder { + return &moqUsual_NoParams_fnRecorder{ + params: moqUsual_NoParams_params{}, + sequence: m.moq.config.Sequence == moq.SeqDefaultOn, + moq: m.moq, } +} - if result.doReturnFn != nil { - result.doReturnFn(param1, param2, param3, param, param5, param6, param7, param8, param9) +func (r *moqUsual_NoParams_fnRecorder) any() *moqUsual_NoParams_anyParams { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_NoParams(r.params)) + return nil } - return + return &moqUsual_NoParams_anyParams{recorder: r} } -func (m *moqUsual_mock) DifficultResultNames() (result1, result2 string, result3 error, param, result5, result6 int, result7, result8, result9 float32) { - m.moq.scene.T.Helper() - params := moqUsual_DifficultResultNames_params{} - var results *moqUsual_DifficultResultNames_results - for _, resultsByParams := range m.moq.resultsByParams_DifficultResultNames { - paramsKey := m.moq.paramsKey_DifficultResultNames(params, resultsByParams.anyParams) - var ok bool - results, ok = resultsByParams.results[paramsKey] - if ok { - break - } +func (r *moqUsual_NoParams_fnRecorder) seq() *moqUsual_NoParams_fnRecorder { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_NoParams(r.params)) + return nil } - if results == nil { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_DifficultResultNames(params)) - } - return + r.sequence = true + return r +} + +func (r *moqUsual_NoParams_fnRecorder) noSeq() *moqUsual_NoParams_fnRecorder { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_NoParams(r.params)) + return nil } + r.sequence = false + return r +} - i := int(atomic.AddUint32(&results.index, 1)) - 1 - if i >= results.repeat.ResultCount { - if !results.repeat.AnyTimes { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_DifficultResultNames(params)) - } - return - } - i = results.repeat.ResultCount - 1 +func (r *moqUsual_NoParams_fnRecorder) returnResults(sResult string, err error) *moqUsual_NoParams_fnRecorder { + r.moq.scene.T.Helper() + r.findResults() + + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() } - result := results.results[i] - if result.sequence != 0 { - sequence := m.moq.scene.NextMockSequence() - if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_DifficultResultNames(params)) + r.results.results = append(r.results.results, struct { + values *struct { + sResult string + err error } - } + sequence uint32 + doFn moqUsual_NoParams_doFn + doReturnFn moqUsual_NoParams_doReturnFn + }{ + values: &struct { + sResult string + err error + }{ + sResult: sResult, + err: err, + }, + sequence: sequence, + }) + return r +} - if result.doFn != nil { - result.doFn() +func (r *moqUsual_NoParams_fnRecorder) andDo(fn moqUsual_NoParams_doFn) *moqUsual_NoParams_fnRecorder { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") + return nil } + last := &r.results.results[len(r.results.results)-1] + last.doFn = fn + return r +} - if result.values != nil { - result1 = result.values.result1 - result2 = result.values.result2 - result3 = result.values.result3 - param = result.values.param - result5 = result.values.result5 - result6 = result.values.result6 - result7 = result.values.result7 - result8 = result.values.result8 - result9 = result.values.result9 - } - if result.doReturnFn != nil { - result1, result2, result3, param, result5, result6, result7, result8, result9 = result.doReturnFn() +func (r *moqUsual_NoParams_fnRecorder) doReturnResults(fn moqUsual_NoParams_doReturnFn) *moqUsual_NoParams_fnRecorder { + r.moq.scene.T.Helper() + r.findResults() + + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() } - return + + r.results.results = append(r.results.results, struct { + values *struct { + sResult string + err error + } + sequence uint32 + doFn moqUsual_NoParams_doFn + doReturnFn moqUsual_NoParams_doReturnFn + }{sequence: sequence, doReturnFn: fn}) + return r } -func (m *moqUsual_mock) PassByArray(p [3]testmoqs.Params) (result1 [3]testmoqs.Results) { - m.moq.scene.T.Helper() - params := moqUsual_PassByArray_params{ - p: p, +func (r *moqUsual_NoParams_fnRecorder) findResults() { + r.moq.scene.T.Helper() + if r.results != nil { + r.results.repeat.Increment(r.moq.scene.T) + return } - var results *moqUsual_PassByArray_results - for _, resultsByParams := range m.moq.resultsByParams_PassByArray { - paramsKey := m.moq.paramsKey_PassByArray(params, resultsByParams.anyParams) - var ok bool - results, ok = resultsByParams.results[paramsKey] - if ok { + + anyCount := bits.OnesCount64(r.anyParams) + insertAt := -1 + var results *moqUsual_NoParams_resultsByParams + for n, res := range r.moq.resultsByParams_NoParams { + if res.anyParams == r.anyParams { + results = &res break } + if res.anyCount > anyCount { + insertAt = n + } } if results == nil { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_PassByArray(params)) + results = &moqUsual_NoParams_resultsByParams{ + anyCount: anyCount, + anyParams: r.anyParams, + results: map[moqUsual_NoParams_paramsKey]*moqUsual_NoParams_results{}, } - return - } - - i := int(atomic.AddUint32(&results.index, 1)) - 1 - if i >= results.repeat.ResultCount { - if !results.repeat.AnyTimes { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_PassByArray(params)) - } - return + r.moq.resultsByParams_NoParams = append(r.moq.resultsByParams_NoParams, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_NoParams) { + copy(r.moq.resultsByParams_NoParams[insertAt+1:], r.moq.resultsByParams_NoParams[insertAt:0]) + r.moq.resultsByParams_NoParams[insertAt] = *results } - i = results.repeat.ResultCount - 1 } - result := results.results[i] - if result.sequence != 0 { - sequence := m.moq.scene.NextMockSequence() - if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_PassByArray(params)) - } - } + paramsKey := r.moq.paramsKey_NoParams(r.params, r.anyParams) - if result.doFn != nil { - result.doFn(p) + var ok bool + r.results, ok = results.results[paramsKey] + if !ok { + r.results = &moqUsual_NoParams_results{ + params: r.params, + results: nil, + index: 0, + repeat: &moq.RepeatVal{}, + } + results.results[paramsKey] = r.results } - if result.values != nil { - result1 = result.values.result1 - } - if result.doReturnFn != nil { - result1 = result.doReturnFn(p) - } - return + r.results.repeat.Increment(r.moq.scene.T) } -func (m *moqUsual_mock) PassByChan(p chan testmoqs.Params) (result1 chan testmoqs.Results) { - m.moq.scene.T.Helper() - params := moqUsual_PassByChan_params{ - p: p, - } - var results *moqUsual_PassByChan_results - for _, resultsByParams := range m.moq.resultsByParams_PassByChan { - paramsKey := m.moq.paramsKey_PassByChan(params, resultsByParams.anyParams) - var ok bool - results, ok = resultsByParams.results[paramsKey] - if ok { - break - } - } - if results == nil { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_PassByChan(params)) - } - return +func (r *moqUsual_NoParams_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_NoParams_fnRecorder { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") + return nil } - - i := int(atomic.AddUint32(&results.index, 1)) - 1 - if i >= results.repeat.ResultCount { - if !results.repeat.AnyTimes { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_PassByChan(params)) + r.results.repeat.Repeat(r.moq.scene.T, repeaters) + last := r.results.results[len(r.results.results)-1] + for n := 0; n < r.results.repeat.ResultCount-1; n++ { + if r.sequence { + last = struct { + values *struct { + sResult string + err error + } + sequence uint32 + doFn moqUsual_NoParams_doFn + doReturnFn moqUsual_NoParams_doReturnFn + }{ + values: last.values, + sequence: r.moq.scene.NextRecorderSequence(), } - return } - i = results.repeat.ResultCount - 1 + r.results.results = append(r.results.results, last) } + return r +} - result := results.results[i] - if result.sequence != 0 { - sequence := m.moq.scene.NextMockSequence() - if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_PassByChan(params)) - } - } +func (m *moqUsual) prettyParams_NoParams(params moqUsual_NoParams_params) string { + return fmt.Sprintf("NoParams()") +} - if result.doFn != nil { - result.doFn(p) +func (m *moqUsual) paramsKey_NoParams(params moqUsual_NoParams_params, anyParams uint64) moqUsual_NoParams_paramsKey { + m.scene.T.Helper() + return moqUsual_NoParams_paramsKey{ + params: struct{}{}, + hashes: struct{}{}, } +} - if result.values != nil { - result1 = result.values.result1 - } - if result.doReturnFn != nil { - result1 = result.doReturnFn(p) +func (m *moqUsual_recorder) Nothing() *moqUsual_Nothing_fnRecorder { + return &moqUsual_Nothing_fnRecorder{ + params: moqUsual_Nothing_params{}, + sequence: m.moq.config.Sequence == moq.SeqDefaultOn, + moq: m.moq, } - return } -func (m *moqUsual_mock) PassByEllipsis(p ...testmoqs.Params) (result1 string, result2 error) { - m.moq.scene.T.Helper() - params := moqUsual_PassByEllipsis_params{ - p: p, - } - var results *moqUsual_PassByEllipsis_results - for _, resultsByParams := range m.moq.resultsByParams_PassByEllipsis { - paramsKey := m.moq.paramsKey_PassByEllipsis(params, resultsByParams.anyParams) - var ok bool - results, ok = resultsByParams.results[paramsKey] - if ok { - break - } - } - if results == nil { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_PassByEllipsis(params)) - } - return +func (r *moqUsual_Nothing_fnRecorder) any() *moqUsual_Nothing_anyParams { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Nothing(r.params)) + return nil } + return &moqUsual_Nothing_anyParams{recorder: r} +} - i := int(atomic.AddUint32(&results.index, 1)) - 1 - if i >= results.repeat.ResultCount { - if !results.repeat.AnyTimes { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_PassByEllipsis(params)) - } - return - } - i = results.repeat.ResultCount - 1 +func (r *moqUsual_Nothing_fnRecorder) seq() *moqUsual_Nothing_fnRecorder { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Nothing(r.params)) + return nil } + r.sequence = true + return r +} - result := results.results[i] - if result.sequence != 0 { - sequence := m.moq.scene.NextMockSequence() - if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_PassByEllipsis(params)) - } +func (r *moqUsual_Nothing_fnRecorder) noSeq() *moqUsual_Nothing_fnRecorder { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Nothing(r.params)) + return nil } + r.sequence = false + return r +} - if result.doFn != nil { - result.doFn(p...) +func (r *moqUsual_Nothing_fnRecorder) returnResults() *moqUsual_Nothing_fnRecorder { + r.moq.scene.T.Helper() + r.findResults() + + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() } - if result.values != nil { - result1 = result.values.result1 - result2 = result.values.result2 + r.results.results = append(r.results.results, struct { + values *struct{} + sequence uint32 + doFn moqUsual_Nothing_doFn + doReturnFn moqUsual_Nothing_doReturnFn + }{ + values: &struct{}{}, + sequence: sequence, + }) + return r +} + +func (r *moqUsual_Nothing_fnRecorder) andDo(fn moqUsual_Nothing_doFn) *moqUsual_Nothing_fnRecorder { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") + return nil } - if result.doReturnFn != nil { - result1, result2 = result.doReturnFn(p...) + last := &r.results.results[len(r.results.results)-1] + last.doFn = fn + return r +} + +func (r *moqUsual_Nothing_fnRecorder) doReturnResults(fn moqUsual_Nothing_doReturnFn) *moqUsual_Nothing_fnRecorder { + r.moq.scene.T.Helper() + r.findResults() + + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() } - return + + r.results.results = append(r.results.results, struct { + values *struct{} + sequence uint32 + doFn moqUsual_Nothing_doFn + doReturnFn moqUsual_Nothing_doReturnFn + }{sequence: sequence, doReturnFn: fn}) + return r } -func (m *moqUsual_mock) PassByMap(p map[string]testmoqs.Params) (result1 map[string]testmoqs.Results) { - m.moq.scene.T.Helper() - params := moqUsual_PassByMap_params{ - p: p, +func (r *moqUsual_Nothing_fnRecorder) findResults() { + r.moq.scene.T.Helper() + if r.results != nil { + r.results.repeat.Increment(r.moq.scene.T) + return } - var results *moqUsual_PassByMap_results - for _, resultsByParams := range m.moq.resultsByParams_PassByMap { - paramsKey := m.moq.paramsKey_PassByMap(params, resultsByParams.anyParams) - var ok bool - results, ok = resultsByParams.results[paramsKey] - if ok { + + anyCount := bits.OnesCount64(r.anyParams) + insertAt := -1 + var results *moqUsual_Nothing_resultsByParams + for n, res := range r.moq.resultsByParams_Nothing { + if res.anyParams == r.anyParams { + results = &res break } + if res.anyCount > anyCount { + insertAt = n + } } if results == nil { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_PassByMap(params)) + results = &moqUsual_Nothing_resultsByParams{ + anyCount: anyCount, + anyParams: r.anyParams, + results: map[moqUsual_Nothing_paramsKey]*moqUsual_Nothing_results{}, } - return - } - - i := int(atomic.AddUint32(&results.index, 1)) - 1 - if i >= results.repeat.ResultCount { - if !results.repeat.AnyTimes { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_PassByMap(params)) - } - return + r.moq.resultsByParams_Nothing = append(r.moq.resultsByParams_Nothing, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_Nothing) { + copy(r.moq.resultsByParams_Nothing[insertAt+1:], r.moq.resultsByParams_Nothing[insertAt:0]) + r.moq.resultsByParams_Nothing[insertAt] = *results } - i = results.repeat.ResultCount - 1 } - result := results.results[i] - if result.sequence != 0 { - sequence := m.moq.scene.NextMockSequence() - if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_PassByMap(params)) - } - } + paramsKey := r.moq.paramsKey_Nothing(r.params, r.anyParams) - if result.doFn != nil { - result.doFn(p) + var ok bool + r.results, ok = results.results[paramsKey] + if !ok { + r.results = &moqUsual_Nothing_results{ + params: r.params, + results: nil, + index: 0, + repeat: &moq.RepeatVal{}, + } + results.results[paramsKey] = r.results } - if result.values != nil { - result1 = result.values.result1 - } - if result.doReturnFn != nil { - result1 = result.doReturnFn(p) - } - return + r.results.repeat.Increment(r.moq.scene.T) } -func (m *moqUsual_mock) PassByReference(p *testmoqs.Params) (result1 *testmoqs.Results) { - m.moq.scene.T.Helper() - params := moqUsual_PassByReference_params{ - p: p, - } - var results *moqUsual_PassByReference_results - for _, resultsByParams := range m.moq.resultsByParams_PassByReference { - paramsKey := m.moq.paramsKey_PassByReference(params, resultsByParams.anyParams) - var ok bool - results, ok = resultsByParams.results[paramsKey] - if ok { - break - } - } - if results == nil { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_PassByReference(params)) - } - return +func (r *moqUsual_Nothing_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_Nothing_fnRecorder { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") + return nil } - - i := int(atomic.AddUint32(&results.index, 1)) - 1 - if i >= results.repeat.ResultCount { - if !results.repeat.AnyTimes { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_PassByReference(params)) + r.results.repeat.Repeat(r.moq.scene.T, repeaters) + last := r.results.results[len(r.results.results)-1] + for n := 0; n < r.results.repeat.ResultCount-1; n++ { + if r.sequence { + last = struct { + values *struct{} + sequence uint32 + doFn moqUsual_Nothing_doFn + doReturnFn moqUsual_Nothing_doReturnFn + }{ + values: last.values, + sequence: r.moq.scene.NextRecorderSequence(), } - return } - i = results.repeat.ResultCount - 1 + r.results.results = append(r.results.results, last) } + return r +} - result := results.results[i] - if result.sequence != 0 { - sequence := m.moq.scene.NextMockSequence() - if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_PassByReference(params)) - } - } +func (m *moqUsual) prettyParams_Nothing(params moqUsual_Nothing_params) string { + return fmt.Sprintf("Nothing()") +} - if result.doFn != nil { - result.doFn(p) +func (m *moqUsual) paramsKey_Nothing(params moqUsual_Nothing_params, anyParams uint64) moqUsual_Nothing_paramsKey { + m.scene.T.Helper() + return moqUsual_Nothing_paramsKey{ + params: struct{}{}, + hashes: struct{}{}, } +} - if result.values != nil { - result1 = result.values.result1 - } - if result.doReturnFn != nil { - result1 = result.doReturnFn(p) +func (m *moqUsual_recorder) Variadic(other bool, args ...string) *moqUsual_Variadic_fnRecorder { + return &moqUsual_Variadic_fnRecorder{ + params: moqUsual_Variadic_params{ + other: other, + args: args, + }, + sequence: m.moq.config.Sequence == moq.SeqDefaultOn, + moq: m.moq, } - return } -func (m *moqUsual_mock) PassBySlice(p []testmoqs.Params) (result1 []testmoqs.Results) { - m.moq.scene.T.Helper() - params := moqUsual_PassBySlice_params{ - p: p, - } - var results *moqUsual_PassBySlice_results - for _, resultsByParams := range m.moq.resultsByParams_PassBySlice { - paramsKey := m.moq.paramsKey_PassBySlice(params, resultsByParams.anyParams) - var ok bool - results, ok = resultsByParams.results[paramsKey] - if ok { - break - } - } - if results == nil { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_PassBySlice(params)) - } - return +func (r *moqUsual_Variadic_fnRecorder) any() *moqUsual_Variadic_anyParams { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Variadic(r.params)) + return nil } + return &moqUsual_Variadic_anyParams{recorder: r} +} - i := int(atomic.AddUint32(&results.index, 1)) - 1 - if i >= results.repeat.ResultCount { - if !results.repeat.AnyTimes { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_PassBySlice(params)) - } - return - } - i = results.repeat.ResultCount - 1 - } +func (a *moqUsual_Variadic_anyParams) other() *moqUsual_Variadic_fnRecorder { + a.recorder.anyParams |= 1 << 0 + return a.recorder +} - result := results.results[i] - if result.sequence != 0 { - sequence := m.moq.scene.NextMockSequence() - if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_PassBySlice(params)) - } - } +func (a *moqUsual_Variadic_anyParams) args() *moqUsual_Variadic_fnRecorder { + a.recorder.anyParams |= 1 << 1 + return a.recorder +} - if result.doFn != nil { - result.doFn(p) +func (r *moqUsual_Variadic_fnRecorder) seq() *moqUsual_Variadic_fnRecorder { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Variadic(r.params)) + return nil } + r.sequence = true + return r +} - if result.values != nil { - result1 = result.values.result1 - } - if result.doReturnFn != nil { - result1 = result.doReturnFn(p) +func (r *moqUsual_Variadic_fnRecorder) noSeq() *moqUsual_Variadic_fnRecorder { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Variadic(r.params)) + return nil } - return + r.sequence = false + return r } -func (m *moqUsual_mock) PassByValue(p testmoqs.Params) (result1 testmoqs.Results) { - m.moq.scene.T.Helper() - params := moqUsual_PassByValue_params{ - p: p, - } - var results *moqUsual_PassByValue_results - for _, resultsByParams := range m.moq.resultsByParams_PassByValue { - paramsKey := m.moq.paramsKey_PassByValue(params, resultsByParams.anyParams) - var ok bool - results, ok = resultsByParams.results[paramsKey] - if ok { - break - } - } - if results == nil { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_PassByValue(params)) - } - return - } +func (r *moqUsual_Variadic_fnRecorder) returnResults(sResult string, err error) *moqUsual_Variadic_fnRecorder { + r.moq.scene.T.Helper() + r.findResults() - i := int(atomic.AddUint32(&results.index, 1)) - 1 - if i >= results.repeat.ResultCount { - if !results.repeat.AnyTimes { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_PassByValue(params)) - } - return - } - i = results.repeat.ResultCount - 1 + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() } - result := results.results[i] - if result.sequence != 0 { - sequence := m.moq.scene.NextMockSequence() - if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_PassByValue(params)) + r.results.results = append(r.results.results, struct { + values *struct { + sResult string + err error } - } + sequence uint32 + doFn moqUsual_Variadic_doFn + doReturnFn moqUsual_Variadic_doReturnFn + }{ + values: &struct { + sResult string + err error + }{ + sResult: sResult, + err: err, + }, + sequence: sequence, + }) + return r +} - if result.doFn != nil { - result.doFn(p) +func (r *moqUsual_Variadic_fnRecorder) andDo(fn moqUsual_Variadic_doFn) *moqUsual_Variadic_fnRecorder { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") + return nil } + last := &r.results.results[len(r.results.results)-1] + last.doFn = fn + return r +} - if result.values != nil { - result1 = result.values.result1 - } - if result.doReturnFn != nil { - result1 = result.doReturnFn(p) +func (r *moqUsual_Variadic_fnRecorder) doReturnResults(fn moqUsual_Variadic_doReturnFn) *moqUsual_Variadic_fnRecorder { + r.moq.scene.T.Helper() + r.findResults() + + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() } - return + + r.results.results = append(r.results.results, struct { + values *struct { + sResult string + err error + } + sequence uint32 + doFn moqUsual_Variadic_doFn + doReturnFn moqUsual_Variadic_doReturnFn + }{sequence: sequence, doReturnFn: fn}) + return r } -func (m *moqUsual_mock) InterfaceParam(w io.Writer) (sResult string, err error) { - m.moq.scene.T.Helper() - params := moqUsual_InterfaceParam_params{ - w: w, +func (r *moqUsual_Variadic_fnRecorder) findResults() { + r.moq.scene.T.Helper() + if r.results != nil { + r.results.repeat.Increment(r.moq.scene.T) + return } - var results *moqUsual_InterfaceParam_results - for _, resultsByParams := range m.moq.resultsByParams_InterfaceParam { - paramsKey := m.moq.paramsKey_InterfaceParam(params, resultsByParams.anyParams) - var ok bool - results, ok = resultsByParams.results[paramsKey] - if ok { + + anyCount := bits.OnesCount64(r.anyParams) + insertAt := -1 + var results *moqUsual_Variadic_resultsByParams + for n, res := range r.moq.resultsByParams_Variadic { + if res.anyParams == r.anyParams { + results = &res break } + if res.anyCount > anyCount { + insertAt = n + } } if results == nil { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_InterfaceParam(params)) + results = &moqUsual_Variadic_resultsByParams{ + anyCount: anyCount, + anyParams: r.anyParams, + results: map[moqUsual_Variadic_paramsKey]*moqUsual_Variadic_results{}, } - return - } - - i := int(atomic.AddUint32(&results.index, 1)) - 1 - if i >= results.repeat.ResultCount { - if !results.repeat.AnyTimes { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_InterfaceParam(params)) - } - return + r.moq.resultsByParams_Variadic = append(r.moq.resultsByParams_Variadic, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_Variadic) { + copy(r.moq.resultsByParams_Variadic[insertAt+1:], r.moq.resultsByParams_Variadic[insertAt:0]) + r.moq.resultsByParams_Variadic[insertAt] = *results } - i = results.repeat.ResultCount - 1 } - result := results.results[i] - if result.sequence != 0 { - sequence := m.moq.scene.NextMockSequence() - if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_InterfaceParam(params)) + paramsKey := r.moq.paramsKey_Variadic(r.params, r.anyParams) + + var ok bool + r.results, ok = results.results[paramsKey] + if !ok { + r.results = &moqUsual_Variadic_results{ + params: r.params, + results: nil, + index: 0, + repeat: &moq.RepeatVal{}, } + results.results[paramsKey] = r.results } - if result.doFn != nil { - result.doFn(w) - } + r.results.repeat.Increment(r.moq.scene.T) +} - if result.values != nil { - sResult = result.values.sResult - err = result.values.err +func (r *moqUsual_Variadic_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_Variadic_fnRecorder { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") + return nil } - if result.doReturnFn != nil { - sResult, err = result.doReturnFn(w) + r.results.repeat.Repeat(r.moq.scene.T, repeaters) + last := r.results.results[len(r.results.results)-1] + for n := 0; n < r.results.repeat.ResultCount-1; n++ { + if r.sequence { + last = struct { + values *struct { + sResult string + err error + } + sequence uint32 + doFn moqUsual_Variadic_doFn + doReturnFn moqUsual_Variadic_doReturnFn + }{ + values: last.values, + sequence: r.moq.scene.NextRecorderSequence(), + } + } + r.results.results = append(r.results.results, last) } - return + return r } -func (m *moqUsual_mock) InterfaceResult(sParam string, bParam bool) (result1 io.Reader) { - m.moq.scene.T.Helper() - params := moqUsual_InterfaceResult_params{ - sParam: sParam, - bParam: bParam, - } - var results *moqUsual_InterfaceResult_results - for _, resultsByParams := range m.moq.resultsByParams_InterfaceResult { - paramsKey := m.moq.paramsKey_InterfaceResult(params, resultsByParams.anyParams) - var ok bool - results, ok = resultsByParams.results[paramsKey] - if ok { - break +func (m *moqUsual) prettyParams_Variadic(params moqUsual_Variadic_params) string { + return fmt.Sprintf("Variadic(%#v, %#v)", params.other, params.args) +} + +func (m *moqUsual) paramsKey_Variadic(params moqUsual_Variadic_params, anyParams uint64) moqUsual_Variadic_paramsKey { + m.scene.T.Helper() + var otherUsed bool + var otherUsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.runtime.parameterIndexing.Variadic.other == moq.ParamIndexByValue { + otherUsed = params.other + } else { + otherUsedHash = hash.DeepHash(params.other) } } - if results == nil { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_InterfaceResult(params)) + var argsUsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.runtime.parameterIndexing.Variadic.args == moq.ParamIndexByValue { + m.scene.T.Fatalf("The args parameter of the Variadic function can't be indexed by value") } - return + argsUsedHash = hash.DeepHash(params.args) } - - i := int(atomic.AddUint32(&results.index, 1)) - 1 - if i >= results.repeat.ResultCount { - if !results.repeat.AnyTimes { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_InterfaceResult(params)) - } - return - } - i = results.repeat.ResultCount - 1 + return moqUsual_Variadic_paramsKey{ + params: struct{ other bool }{ + other: otherUsed, + }, + hashes: struct { + other hash.Hash + args hash.Hash + }{ + other: otherUsedHash, + args: argsUsedHash, + }, } +} - result := results.results[i] - if result.sequence != 0 { - sequence := m.moq.scene.NextMockSequence() - if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_InterfaceResult(params)) - } +func (m *moqUsual_recorder) RepeatedIds(sParam1, sParam2 string, bParam bool) *moqUsual_RepeatedIds_fnRecorder { + return &moqUsual_RepeatedIds_fnRecorder{ + params: moqUsual_RepeatedIds_params{ + sParam1: sParam1, + sParam2: sParam2, + bParam: bParam, + }, + sequence: m.moq.config.Sequence == moq.SeqDefaultOn, + moq: m.moq, } +} - if result.doFn != nil { - result.doFn(sParam, bParam) +func (r *moqUsual_RepeatedIds_fnRecorder) any() *moqUsual_RepeatedIds_anyParams { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_RepeatedIds(r.params)) + return nil } + return &moqUsual_RepeatedIds_anyParams{recorder: r} +} - if result.values != nil { - result1 = result.values.result1 - } - if result.doReturnFn != nil { - result1 = result.doReturnFn(sParam, bParam) - } - return +func (a *moqUsual_RepeatedIds_anyParams) sParam1() *moqUsual_RepeatedIds_fnRecorder { + a.recorder.anyParams |= 1 << 0 + return a.recorder } -func (m *moqUsual_mock) FnParam(fn func()) { - m.moq.scene.T.Helper() - params := moqUsual_FnParam_params{ - fn: fn, - } - var results *moqUsual_FnParam_results - for _, resultsByParams := range m.moq.resultsByParams_FnParam { - paramsKey := m.moq.paramsKey_FnParam(params, resultsByParams.anyParams) - var ok bool - results, ok = resultsByParams.results[paramsKey] - if ok { - break - } +func (a *moqUsual_RepeatedIds_anyParams) sParam2() *moqUsual_RepeatedIds_fnRecorder { + a.recorder.anyParams |= 1 << 1 + return a.recorder +} + +func (a *moqUsual_RepeatedIds_anyParams) bParam() *moqUsual_RepeatedIds_fnRecorder { + a.recorder.anyParams |= 1 << 2 + return a.recorder +} + +func (r *moqUsual_RepeatedIds_fnRecorder) seq() *moqUsual_RepeatedIds_fnRecorder { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_RepeatedIds(r.params)) + return nil } - if results == nil { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_FnParam(params)) - } - return + r.sequence = true + return r +} + +func (r *moqUsual_RepeatedIds_fnRecorder) noSeq() *moqUsual_RepeatedIds_fnRecorder { + r.moq.scene.T.Helper() + if r.results != nil { + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_RepeatedIds(r.params)) + return nil } + r.sequence = false + return r +} - i := int(atomic.AddUint32(&results.index, 1)) - 1 - if i >= results.repeat.ResultCount { - if !results.repeat.AnyTimes { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_FnParam(params)) - } - return - } - i = results.repeat.ResultCount - 1 +func (r *moqUsual_RepeatedIds_fnRecorder) returnResults(sResult1, sResult2 string, err error) *moqUsual_RepeatedIds_fnRecorder { + r.moq.scene.T.Helper() + r.findResults() + + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() } - result := results.results[i] - if result.sequence != 0 { - sequence := m.moq.scene.NextMockSequence() - if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_FnParam(params)) + r.results.results = append(r.results.results, struct { + values *struct { + sResult1, sResult2 string + err error } - } + sequence uint32 + doFn moqUsual_RepeatedIds_doFn + doReturnFn moqUsual_RepeatedIds_doReturnFn + }{ + values: &struct { + sResult1, sResult2 string + err error + }{ + sResult1: sResult1, + sResult2: sResult2, + err: err, + }, + sequence: sequence, + }) + return r +} - if result.doFn != nil { - result.doFn(fn) +func (r *moqUsual_RepeatedIds_fnRecorder) andDo(fn moqUsual_RepeatedIds_doFn) *moqUsual_RepeatedIds_fnRecorder { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") + return nil } + last := &r.results.results[len(r.results.results)-1] + last.doFn = fn + return r +} - if result.doReturnFn != nil { - result.doReturnFn(fn) +func (r *moqUsual_RepeatedIds_fnRecorder) doReturnResults(fn moqUsual_RepeatedIds_doReturnFn) *moqUsual_RepeatedIds_fnRecorder { + r.moq.scene.T.Helper() + r.findResults() + + var sequence uint32 + if r.sequence { + sequence = r.moq.scene.NextRecorderSequence() } - return + + r.results.results = append(r.results.results, struct { + values *struct { + sResult1, sResult2 string + err error + } + sequence uint32 + doFn moqUsual_RepeatedIds_doFn + doReturnFn moqUsual_RepeatedIds_doReturnFn + }{sequence: sequence, doReturnFn: fn}) + return r } -func (m *moqUsual_mock) Other(param1 other.Params) (result1 other.Results) { - m.moq.scene.T.Helper() - params := moqUsual_Other_params{ - param1: param1, +func (r *moqUsual_RepeatedIds_fnRecorder) findResults() { + r.moq.scene.T.Helper() + if r.results != nil { + r.results.repeat.Increment(r.moq.scene.T) + return } - var results *moqUsual_Other_results - for _, resultsByParams := range m.moq.resultsByParams_Other { - paramsKey := m.moq.paramsKey_Other(params, resultsByParams.anyParams) - var ok bool - results, ok = resultsByParams.results[paramsKey] - if ok { + + anyCount := bits.OnesCount64(r.anyParams) + insertAt := -1 + var results *moqUsual_RepeatedIds_resultsByParams + for n, res := range r.moq.resultsByParams_RepeatedIds { + if res.anyParams == r.anyParams { + results = &res break } + if res.anyCount > anyCount { + insertAt = n + } } if results == nil { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_Other(params)) + results = &moqUsual_RepeatedIds_resultsByParams{ + anyCount: anyCount, + anyParams: r.anyParams, + results: map[moqUsual_RepeatedIds_paramsKey]*moqUsual_RepeatedIds_results{}, } - return - } - - i := int(atomic.AddUint32(&results.index, 1)) - 1 - if i >= results.repeat.ResultCount { - if !results.repeat.AnyTimes { - if m.moq.config.Expectation == moq.Strict { - m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_Other(params)) - } - return + r.moq.resultsByParams_RepeatedIds = append(r.moq.resultsByParams_RepeatedIds, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_RepeatedIds) { + copy(r.moq.resultsByParams_RepeatedIds[insertAt+1:], r.moq.resultsByParams_RepeatedIds[insertAt:0]) + r.moq.resultsByParams_RepeatedIds[insertAt] = *results } - i = results.repeat.ResultCount - 1 } - result := results.results[i] - if result.sequence != 0 { - sequence := m.moq.scene.NextMockSequence() - if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { - m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_Other(params)) + paramsKey := r.moq.paramsKey_RepeatedIds(r.params, r.anyParams) + + var ok bool + r.results, ok = results.results[paramsKey] + if !ok { + r.results = &moqUsual_RepeatedIds_results{ + params: r.params, + results: nil, + index: 0, + repeat: &moq.RepeatVal{}, } + results.results[paramsKey] = r.results } - if result.doFn != nil { - result.doFn(param1) - } + r.results.repeat.Increment(r.moq.scene.T) +} - if result.values != nil { - result1 = result.values.result1 +func (r *moqUsual_RepeatedIds_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_RepeatedIds_fnRecorder { + r.moq.scene.T.Helper() + if r.results == nil { + r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") + return nil } - if result.doReturnFn != nil { - result1 = result.doReturnFn(param1) + r.results.repeat.Repeat(r.moq.scene.T, repeaters) + last := r.results.results[len(r.results.results)-1] + for n := 0; n < r.results.repeat.ResultCount-1; n++ { + if r.sequence { + last = struct { + values *struct { + sResult1, sResult2 string + err error + } + sequence uint32 + doFn moqUsual_RepeatedIds_doFn + doReturnFn moqUsual_RepeatedIds_doReturnFn + }{ + values: last.values, + sequence: r.moq.scene.NextRecorderSequence(), + } + } + r.results.results = append(r.results.results, last) } - return + return r } -// onCall returns the recorder implementation of the Usual type -func (m *moqUsual) onCall() *moqUsual_recorder { - return &moqUsual_recorder{ - moq: m, +func (m *moqUsual) prettyParams_RepeatedIds(params moqUsual_RepeatedIds_params) string { + return fmt.Sprintf("RepeatedIds(%#v, %#v, %#v)", params.sParam1, params.sParam2, params.bParam) +} + +func (m *moqUsual) paramsKey_RepeatedIds(params moqUsual_RepeatedIds_params, anyParams uint64) moqUsual_RepeatedIds_paramsKey { + m.scene.T.Helper() + var sParam1Used string + var sParam1UsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.runtime.parameterIndexing.RepeatedIds.sParam1 == moq.ParamIndexByValue { + sParam1Used = params.sParam1 + } else { + sParam1UsedHash = hash.DeepHash(params.sParam1) + } + } + var sParam2Used string + var sParam2UsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.runtime.parameterIndexing.RepeatedIds.sParam2 == moq.ParamIndexByValue { + sParam2Used = params.sParam2 + } else { + sParam2UsedHash = hash.DeepHash(params.sParam2) + } + } + var bParamUsed bool + var bParamUsedHash hash.Hash + if anyParams&(1<<2) == 0 { + if m.runtime.parameterIndexing.RepeatedIds.bParam == moq.ParamIndexByValue { + bParamUsed = params.bParam + } else { + bParamUsedHash = hash.DeepHash(params.bParam) + } + } + return moqUsual_RepeatedIds_paramsKey{ + params: struct { + sParam1, sParam2 string + bParam bool + }{ + sParam1: sParam1Used, + sParam2: sParam2Used, + bParam: bParamUsed, + }, + hashes: struct { + sParam1, sParam2 hash.Hash + bParam hash.Hash + }{ + sParam1: sParam1UsedHash, + sParam2: sParam2UsedHash, + bParam: bParamUsedHash, + }, } } -func (m *moqUsual_recorder) Usual(sParam string, bParam bool) *moqUsual_Usual_fnRecorder { - return &moqUsual_Usual_fnRecorder{ - params: moqUsual_Usual_params{ +func (m *moqUsual_recorder) Times(sParam string, times bool) *moqUsual_Times_fnRecorder { + return &moqUsual_Times_fnRecorder{ + params: moqUsual_Times_params{ sParam: sParam, - bParam: bParam, + times: times, }, sequence: m.moq.config.Sequence == moq.SeqDefaultOn, moq: m.moq, } } -func (r *moqUsual_Usual_fnRecorder) any() *moqUsual_Usual_anyParams { +func (r *moqUsual_Times_fnRecorder) any() *moqUsual_Times_anyParams { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Times(r.params)) return nil } - return &moqUsual_Usual_anyParams{recorder: r} + return &moqUsual_Times_anyParams{recorder: r} } -func (a *moqUsual_Usual_anyParams) sParam() *moqUsual_Usual_fnRecorder { +func (a *moqUsual_Times_anyParams) sParam() *moqUsual_Times_fnRecorder { a.recorder.anyParams |= 1 << 0 return a.recorder } -func (a *moqUsual_Usual_anyParams) bParam() *moqUsual_Usual_fnRecorder { +func (a *moqUsual_Times_anyParams) times() *moqUsual_Times_fnRecorder { a.recorder.anyParams |= 1 << 1 return a.recorder } -func (r *moqUsual_Usual_fnRecorder) seq() *moqUsual_Usual_fnRecorder { +func (r *moqUsual_Times_fnRecorder) seq() *moqUsual_Times_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Times(r.params)) return nil } r.sequence = true return r } -func (r *moqUsual_Usual_fnRecorder) noSeq() *moqUsual_Usual_fnRecorder { +func (r *moqUsual_Times_fnRecorder) noSeq() *moqUsual_Times_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Times(r.params)) return nil } r.sequence = false return r } -func (r *moqUsual_Usual_fnRecorder) returnResults(sResult string, err error) *moqUsual_Usual_fnRecorder { +func (r *moqUsual_Times_fnRecorder) returnResults(sResult string, err error) *moqUsual_Times_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -10576,8 +14599,8 @@ func (r *moqUsual_Usual_fnRecorder) returnResults(sResult string, err error) *mo err error } sequence uint32 - doFn moqUsual_Usual_doFn - doReturnFn moqUsual_Usual_doReturnFn + doFn moqUsual_Times_doFn + doReturnFn moqUsual_Times_doReturnFn }{ values: &struct { sResult string @@ -10591,7 +14614,7 @@ func (r *moqUsual_Usual_fnRecorder) returnResults(sResult string, err error) *mo return r } -func (r *moqUsual_Usual_fnRecorder) andDo(fn moqUsual_Usual_doFn) *moqUsual_Usual_fnRecorder { +func (r *moqUsual_Times_fnRecorder) andDo(fn moqUsual_Times_doFn) *moqUsual_Times_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") @@ -10602,7 +14625,7 @@ func (r *moqUsual_Usual_fnRecorder) andDo(fn moqUsual_Usual_doFn) *moqUsual_Usua return r } -func (r *moqUsual_Usual_fnRecorder) doReturnResults(fn moqUsual_Usual_doReturnFn) *moqUsual_Usual_fnRecorder { +func (r *moqUsual_Times_fnRecorder) doReturnResults(fn moqUsual_Times_doReturnFn) *moqUsual_Times_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -10617,13 +14640,13 @@ func (r *moqUsual_Usual_fnRecorder) doReturnResults(fn moqUsual_Usual_doReturnFn err error } sequence uint32 - doFn moqUsual_Usual_doFn - doReturnFn moqUsual_Usual_doReturnFn + doFn moqUsual_Times_doFn + doReturnFn moqUsual_Times_doReturnFn }{sequence: sequence, doReturnFn: fn}) return r } -func (r *moqUsual_Usual_fnRecorder) findResults() { +func (r *moqUsual_Times_fnRecorder) findResults() { r.moq.scene.T.Helper() if r.results != nil { r.results.repeat.Increment(r.moq.scene.T) @@ -10632,8 +14655,8 @@ func (r *moqUsual_Usual_fnRecorder) findResults() { anyCount := bits.OnesCount64(r.anyParams) insertAt := -1 - var results *moqUsual_Usual_resultsByParams - for n, res := range r.moq.resultsByParams_Usual { + var results *moqUsual_Times_resultsByParams + for n, res := range r.moq.resultsByParams_Times { if res.anyParams == r.anyParams { results = &res break @@ -10643,24 +14666,24 @@ func (r *moqUsual_Usual_fnRecorder) findResults() { } } if results == nil { - results = &moqUsual_Usual_resultsByParams{ + results = &moqUsual_Times_resultsByParams{ anyCount: anyCount, anyParams: r.anyParams, - results: map[moqUsual_Usual_paramsKey]*moqUsual_Usual_results{}, + results: map[moqUsual_Times_paramsKey]*moqUsual_Times_results{}, } - r.moq.resultsByParams_Usual = append(r.moq.resultsByParams_Usual, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_Usual) { - copy(r.moq.resultsByParams_Usual[insertAt+1:], r.moq.resultsByParams_Usual[insertAt:0]) - r.moq.resultsByParams_Usual[insertAt] = *results + r.moq.resultsByParams_Times = append(r.moq.resultsByParams_Times, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_Times) { + copy(r.moq.resultsByParams_Times[insertAt+1:], r.moq.resultsByParams_Times[insertAt:0]) + r.moq.resultsByParams_Times[insertAt] = *results } } - paramsKey := r.moq.paramsKey_Usual(r.params, r.anyParams) + paramsKey := r.moq.paramsKey_Times(r.params, r.anyParams) var ok bool r.results, ok = results.results[paramsKey] if !ok { - r.results = &moqUsual_Usual_results{ + r.results = &moqUsual_Times_results{ params: r.params, results: nil, index: 0, @@ -10672,7 +14695,7 @@ func (r *moqUsual_Usual_fnRecorder) findResults() { r.results.repeat.Increment(r.moq.scene.T) } -func (r *moqUsual_Usual_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_Usual_fnRecorder { +func (r *moqUsual_Times_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_Times_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") @@ -10688,8 +14711,8 @@ func (r *moqUsual_Usual_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_ err error } sequence uint32 - doFn moqUsual_Usual_doFn - doReturnFn moqUsual_Usual_doReturnFn + doFn moqUsual_Times_doFn + doReturnFn moqUsual_Times_doReturnFn }{ values: last.values, sequence: r.moq.scene.NextRecorderSequence(), @@ -10700,99 +14723,141 @@ func (r *moqUsual_Usual_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_ return r } -func (m *moqUsual) prettyParams_Usual(params moqUsual_Usual_params) string { - return fmt.Sprintf("Usual(%#v, %#v)", params.sParam, params.bParam) +func (m *moqUsual) prettyParams_Times(params moqUsual_Times_params) string { + return fmt.Sprintf("Times(%#v, %#v)", params.sParam, params.times) } -func (m *moqUsual) paramsKey_Usual(params moqUsual_Usual_params, anyParams uint64) moqUsual_Usual_paramsKey { +func (m *moqUsual) paramsKey_Times(params moqUsual_Times_params, anyParams uint64) moqUsual_Times_paramsKey { m.scene.T.Helper() var sParamUsed string var sParamUsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.runtime.parameterIndexing.Usual.sParam == moq.ParamIndexByValue { + if m.runtime.parameterIndexing.Times.sParam == moq.ParamIndexByValue { sParamUsed = params.sParam } else { sParamUsedHash = hash.DeepHash(params.sParam) } } - var bParamUsed bool - var bParamUsedHash hash.Hash + var timesUsed bool + var timesUsedHash hash.Hash if anyParams&(1<<1) == 0 { - if m.runtime.parameterIndexing.Usual.bParam == moq.ParamIndexByValue { - bParamUsed = params.bParam + if m.runtime.parameterIndexing.Times.times == moq.ParamIndexByValue { + timesUsed = params.times } else { - bParamUsedHash = hash.DeepHash(params.bParam) + timesUsedHash = hash.DeepHash(params.times) } } - return moqUsual_Usual_paramsKey{ + return moqUsual_Times_paramsKey{ params: struct { sParam string - bParam bool + times bool }{ sParam: sParamUsed, - bParam: bParamUsed, + times: timesUsed, }, hashes: struct { sParam hash.Hash - bParam hash.Hash + times hash.Hash }{ sParam: sParamUsedHash, - bParam: bParamUsedHash, + times: timesUsedHash, }, } } -func (m *moqUsual_recorder) NoNames(param1 string, param2 bool) *moqUsual_NoNames_fnRecorder { - return &moqUsual_NoNames_fnRecorder{ - params: moqUsual_NoNames_params{ +func (m *moqUsual_recorder) DifficultParamNames(param1, param2 bool, param3 string, param, param5, param6 int, param7, param8, param9 float32) *moqUsual_DifficultParamNames_fnRecorder { + return &moqUsual_DifficultParamNames_fnRecorder{ + params: moqUsual_DifficultParamNames_params{ param1: param1, param2: param2, + param3: param3, + param: param, + param5: param5, + param6: param6, + param7: param7, + param8: param8, + param9: param9, }, sequence: m.moq.config.Sequence == moq.SeqDefaultOn, moq: m.moq, } } -func (r *moqUsual_NoNames_fnRecorder) any() *moqUsual_NoNames_anyParams { +func (r *moqUsual_DifficultParamNames_fnRecorder) any() *moqUsual_DifficultParamNames_anyParams { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_NoNames(r.params)) + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_DifficultParamNames(r.params)) return nil } - return &moqUsual_NoNames_anyParams{recorder: r} + return &moqUsual_DifficultParamNames_anyParams{recorder: r} } -func (a *moqUsual_NoNames_anyParams) param1() *moqUsual_NoNames_fnRecorder { +func (a *moqUsual_DifficultParamNames_anyParams) param1() *moqUsual_DifficultParamNames_fnRecorder { a.recorder.anyParams |= 1 << 0 return a.recorder } -func (a *moqUsual_NoNames_anyParams) param2() *moqUsual_NoNames_fnRecorder { +func (a *moqUsual_DifficultParamNames_anyParams) param2() *moqUsual_DifficultParamNames_fnRecorder { a.recorder.anyParams |= 1 << 1 return a.recorder } -func (r *moqUsual_NoNames_fnRecorder) seq() *moqUsual_NoNames_fnRecorder { +func (a *moqUsual_DifficultParamNames_anyParams) param3() *moqUsual_DifficultParamNames_fnRecorder { + a.recorder.anyParams |= 1 << 2 + return a.recorder +} + +func (a *moqUsual_DifficultParamNames_anyParams) param() *moqUsual_DifficultParamNames_fnRecorder { + a.recorder.anyParams |= 1 << 3 + return a.recorder +} + +func (a *moqUsual_DifficultParamNames_anyParams) param5() *moqUsual_DifficultParamNames_fnRecorder { + a.recorder.anyParams |= 1 << 4 + return a.recorder +} + +func (a *moqUsual_DifficultParamNames_anyParams) param6() *moqUsual_DifficultParamNames_fnRecorder { + a.recorder.anyParams |= 1 << 5 + return a.recorder +} + +func (a *moqUsual_DifficultParamNames_anyParams) param7() *moqUsual_DifficultParamNames_fnRecorder { + a.recorder.anyParams |= 1 << 6 + return a.recorder +} + +func (a *moqUsual_DifficultParamNames_anyParams) param8() *moqUsual_DifficultParamNames_fnRecorder { + a.recorder.anyParams |= 1 << 7 + return a.recorder +} + +func (a *moqUsual_DifficultParamNames_anyParams) param9() *moqUsual_DifficultParamNames_fnRecorder { + a.recorder.anyParams |= 1 << 8 + return a.recorder +} + +func (r *moqUsual_DifficultParamNames_fnRecorder) seq() *moqUsual_DifficultParamNames_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_NoNames(r.params)) + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_DifficultParamNames(r.params)) return nil } r.sequence = true return r } -func (r *moqUsual_NoNames_fnRecorder) noSeq() *moqUsual_NoNames_fnRecorder { +func (r *moqUsual_DifficultParamNames_fnRecorder) noSeq() *moqUsual_DifficultParamNames_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_NoNames(r.params)) + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_DifficultParamNames(r.params)) return nil } r.sequence = false return r } -func (r *moqUsual_NoNames_fnRecorder) returnResults(result1 string, result2 error) *moqUsual_NoNames_fnRecorder { +func (r *moqUsual_DifficultParamNames_fnRecorder) returnResults() *moqUsual_DifficultParamNames_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -10802,27 +14867,18 @@ func (r *moqUsual_NoNames_fnRecorder) returnResults(result1 string, result2 erro } r.results.results = append(r.results.results, struct { - values *struct { - result1 string - result2 error - } + values *struct{} sequence uint32 - doFn moqUsual_NoNames_doFn - doReturnFn moqUsual_NoNames_doReturnFn + doFn moqUsual_DifficultParamNames_doFn + doReturnFn moqUsual_DifficultParamNames_doReturnFn }{ - values: &struct { - result1 string - result2 error - }{ - result1: result1, - result2: result2, - }, + values: &struct{}{}, sequence: sequence, }) return r } -func (r *moqUsual_NoNames_fnRecorder) andDo(fn moqUsual_NoNames_doFn) *moqUsual_NoNames_fnRecorder { +func (r *moqUsual_DifficultParamNames_fnRecorder) andDo(fn moqUsual_DifficultParamNames_doFn) *moqUsual_DifficultParamNames_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") @@ -10833,7 +14889,7 @@ func (r *moqUsual_NoNames_fnRecorder) andDo(fn moqUsual_NoNames_doFn) *moqUsual_ return r } -func (r *moqUsual_NoNames_fnRecorder) doReturnResults(fn moqUsual_NoNames_doReturnFn) *moqUsual_NoNames_fnRecorder { +func (r *moqUsual_DifficultParamNames_fnRecorder) doReturnResults(fn moqUsual_DifficultParamNames_doReturnFn) *moqUsual_DifficultParamNames_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -10843,18 +14899,15 @@ func (r *moqUsual_NoNames_fnRecorder) doReturnResults(fn moqUsual_NoNames_doRetu } r.results.results = append(r.results.results, struct { - values *struct { - result1 string - result2 error - } + values *struct{} sequence uint32 - doFn moqUsual_NoNames_doFn - doReturnFn moqUsual_NoNames_doReturnFn + doFn moqUsual_DifficultParamNames_doFn + doReturnFn moqUsual_DifficultParamNames_doReturnFn }{sequence: sequence, doReturnFn: fn}) return r } -func (r *moqUsual_NoNames_fnRecorder) findResults() { +func (r *moqUsual_DifficultParamNames_fnRecorder) findResults() { r.moq.scene.T.Helper() if r.results != nil { r.results.repeat.Increment(r.moq.scene.T) @@ -10863,8 +14916,8 @@ func (r *moqUsual_NoNames_fnRecorder) findResults() { anyCount := bits.OnesCount64(r.anyParams) insertAt := -1 - var results *moqUsual_NoNames_resultsByParams - for n, res := range r.moq.resultsByParams_NoNames { + var results *moqUsual_DifficultParamNames_resultsByParams + for n, res := range r.moq.resultsByParams_DifficultParamNames { if res.anyParams == r.anyParams { results = &res break @@ -10874,24 +14927,24 @@ func (r *moqUsual_NoNames_fnRecorder) findResults() { } } if results == nil { - results = &moqUsual_NoNames_resultsByParams{ + results = &moqUsual_DifficultParamNames_resultsByParams{ anyCount: anyCount, anyParams: r.anyParams, - results: map[moqUsual_NoNames_paramsKey]*moqUsual_NoNames_results{}, + results: map[moqUsual_DifficultParamNames_paramsKey]*moqUsual_DifficultParamNames_results{}, } - r.moq.resultsByParams_NoNames = append(r.moq.resultsByParams_NoNames, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_NoNames) { - copy(r.moq.resultsByParams_NoNames[insertAt+1:], r.moq.resultsByParams_NoNames[insertAt:0]) - r.moq.resultsByParams_NoNames[insertAt] = *results + r.moq.resultsByParams_DifficultParamNames = append(r.moq.resultsByParams_DifficultParamNames, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_DifficultParamNames) { + copy(r.moq.resultsByParams_DifficultParamNames[insertAt+1:], r.moq.resultsByParams_DifficultParamNames[insertAt:0]) + r.moq.resultsByParams_DifficultParamNames[insertAt] = *results } } - paramsKey := r.moq.paramsKey_NoNames(r.params, r.anyParams) + paramsKey := r.moq.paramsKey_DifficultParamNames(r.params, r.anyParams) var ok bool r.results, ok = results.results[paramsKey] if !ok { - r.results = &moqUsual_NoNames_results{ + r.results = &moqUsual_DifficultParamNames_results{ params: r.params, results: nil, index: 0, @@ -10903,7 +14956,7 @@ func (r *moqUsual_NoNames_fnRecorder) findResults() { r.results.repeat.Increment(r.moq.scene.T) } -func (r *moqUsual_NoNames_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_NoNames_fnRecorder { +func (r *moqUsual_DifficultParamNames_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_DifficultParamNames_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") @@ -10914,13 +14967,10 @@ func (r *moqUsual_NoNames_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsua for n := 0; n < r.results.repeat.ResultCount-1; n++ { if r.sequence { last = struct { - values *struct { - result1 string - result2 error - } + values *struct{} sequence uint32 - doFn moqUsual_NoNames_doFn - doReturnFn moqUsual_NoNames_doReturnFn + doFn moqUsual_DifficultParamNames_doFn + doReturnFn moqUsual_DifficultParamNames_doReturnFn }{ values: last.values, sequence: r.moq.scene.NextRecorderSequence(), @@ -10931,16 +14981,16 @@ func (r *moqUsual_NoNames_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsua return r } -func (m *moqUsual) prettyParams_NoNames(params moqUsual_NoNames_params) string { - return fmt.Sprintf("NoNames(%#v, %#v)", params.param1, params.param2) +func (m *moqUsual) prettyParams_DifficultParamNames(params moqUsual_DifficultParamNames_params) string { + return fmt.Sprintf("DifficultParamNames(%#v, %#v, %#v, %#v, %#v, %#v, %#v, %#v, %#v)", params.param1, params.param2, params.param3, params.param, params.param5, params.param6, params.param7, params.param8, params.param9) } -func (m *moqUsual) paramsKey_NoNames(params moqUsual_NoNames_params, anyParams uint64) moqUsual_NoNames_paramsKey { +func (m *moqUsual) paramsKey_DifficultParamNames(params moqUsual_DifficultParamNames_params, anyParams uint64) moqUsual_DifficultParamNames_paramsKey { m.scene.T.Helper() - var param1Used string + var param1Used bool var param1UsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.runtime.parameterIndexing.NoNames.param1 == moq.ParamIndexByValue { + if m.runtime.parameterIndexing.DifficultParamNames.param1 == moq.ParamIndexByValue { param1Used = params.param1 } else { param1UsedHash = hash.DeepHash(params.param1) @@ -10949,81 +14999,149 @@ func (m *moqUsual) paramsKey_NoNames(params moqUsual_NoNames_params, anyParams u var param2Used bool var param2UsedHash hash.Hash if anyParams&(1<<1) == 0 { - if m.runtime.parameterIndexing.NoNames.param2 == moq.ParamIndexByValue { + if m.runtime.parameterIndexing.DifficultParamNames.param2 == moq.ParamIndexByValue { param2Used = params.param2 } else { param2UsedHash = hash.DeepHash(params.param2) } } - return moqUsual_NoNames_paramsKey{ + var param3Used string + var param3UsedHash hash.Hash + if anyParams&(1<<2) == 0 { + if m.runtime.parameterIndexing.DifficultParamNames.param3 == moq.ParamIndexByValue { + param3Used = params.param3 + } else { + param3UsedHash = hash.DeepHash(params.param3) + } + } + var paramUsed int + var paramUsedHash hash.Hash + if anyParams&(1<<3) == 0 { + if m.runtime.parameterIndexing.DifficultParamNames.param == moq.ParamIndexByValue { + paramUsed = params.param + } else { + paramUsedHash = hash.DeepHash(params.param) + } + } + var param5Used int + var param5UsedHash hash.Hash + if anyParams&(1<<4) == 0 { + if m.runtime.parameterIndexing.DifficultParamNames.param5 == moq.ParamIndexByValue { + param5Used = params.param5 + } else { + param5UsedHash = hash.DeepHash(params.param5) + } + } + var param6Used int + var param6UsedHash hash.Hash + if anyParams&(1<<5) == 0 { + if m.runtime.parameterIndexing.DifficultParamNames.param6 == moq.ParamIndexByValue { + param6Used = params.param6 + } else { + param6UsedHash = hash.DeepHash(params.param6) + } + } + var param7Used float32 + var param7UsedHash hash.Hash + if anyParams&(1<<6) == 0 { + if m.runtime.parameterIndexing.DifficultParamNames.param7 == moq.ParamIndexByValue { + param7Used = params.param7 + } else { + param7UsedHash = hash.DeepHash(params.param7) + } + } + var param8Used float32 + var param8UsedHash hash.Hash + if anyParams&(1<<7) == 0 { + if m.runtime.parameterIndexing.DifficultParamNames.param8 == moq.ParamIndexByValue { + param8Used = params.param8 + } else { + param8UsedHash = hash.DeepHash(params.param8) + } + } + var param9Used float32 + var param9UsedHash hash.Hash + if anyParams&(1<<8) == 0 { + if m.runtime.parameterIndexing.DifficultParamNames.param9 == moq.ParamIndexByValue { + param9Used = params.param9 + } else { + param9UsedHash = hash.DeepHash(params.param9) + } + } + return moqUsual_DifficultParamNames_paramsKey{ params: struct { - param1 string - param2 bool + param1, param2 bool + param3 string + param, param5, param6 int + param7, param8, param9 float32 }{ param1: param1Used, param2: param2Used, + param3: param3Used, + param: paramUsed, + param5: param5Used, + param6: param6Used, + param7: param7Used, + param8: param8Used, + param9: param9Used, }, hashes: struct { - param1 hash.Hash - param2 hash.Hash + param1, param2 hash.Hash + param3 hash.Hash + param, param5, param6 hash.Hash + param7, param8, param9 hash.Hash }{ param1: param1UsedHash, param2: param2UsedHash, + param3: param3UsedHash, + param: paramUsedHash, + param5: param5UsedHash, + param6: param6UsedHash, + param7: param7UsedHash, + param8: param8UsedHash, + param9: param9UsedHash, }, } } -func (m *moqUsual_recorder) NoResults(sParam string, bParam bool) *moqUsual_NoResults_fnRecorder { - return &moqUsual_NoResults_fnRecorder{ - params: moqUsual_NoResults_params{ - sParam: sParam, - bParam: bParam, - }, +func (m *moqUsual_recorder) DifficultResultNames() *moqUsual_DifficultResultNames_fnRecorder { + return &moqUsual_DifficultResultNames_fnRecorder{ + params: moqUsual_DifficultResultNames_params{}, sequence: m.moq.config.Sequence == moq.SeqDefaultOn, moq: m.moq, } } -func (r *moqUsual_NoResults_fnRecorder) any() *moqUsual_NoResults_anyParams { +func (r *moqUsual_DifficultResultNames_fnRecorder) any() *moqUsual_DifficultResultNames_anyParams { r.moq.scene.T.Helper() - if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_NoResults(r.params)) - return nil - } - return &moqUsual_NoResults_anyParams{recorder: r} -} - -func (a *moqUsual_NoResults_anyParams) sParam() *moqUsual_NoResults_fnRecorder { - a.recorder.anyParams |= 1 << 0 - return a.recorder -} - -func (a *moqUsual_NoResults_anyParams) bParam() *moqUsual_NoResults_fnRecorder { - a.recorder.anyParams |= 1 << 1 - return a.recorder + if r.results != nil { + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_DifficultResultNames(r.params)) + return nil + } + return &moqUsual_DifficultResultNames_anyParams{recorder: r} } -func (r *moqUsual_NoResults_fnRecorder) seq() *moqUsual_NoResults_fnRecorder { +func (r *moqUsual_DifficultResultNames_fnRecorder) seq() *moqUsual_DifficultResultNames_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_NoResults(r.params)) + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_DifficultResultNames(r.params)) return nil } r.sequence = true return r } -func (r *moqUsual_NoResults_fnRecorder) noSeq() *moqUsual_NoResults_fnRecorder { +func (r *moqUsual_DifficultResultNames_fnRecorder) noSeq() *moqUsual_DifficultResultNames_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_NoResults(r.params)) + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_DifficultResultNames(r.params)) return nil } r.sequence = false return r } -func (r *moqUsual_NoResults_fnRecorder) returnResults() *moqUsual_NoResults_fnRecorder { +func (r *moqUsual_DifficultResultNames_fnRecorder) returnResults(result1, result2 string, result3 error, param, result5, result6 int, result7, result8, result9 float32) *moqUsual_DifficultResultNames_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -11033,18 +15151,38 @@ func (r *moqUsual_NoResults_fnRecorder) returnResults() *moqUsual_NoResults_fnRe } r.results.results = append(r.results.results, struct { - values *struct{} + values *struct { + result1, result2 string + result3 error + param, result5, result6 int + result7, result8, result9 float32 + } sequence uint32 - doFn moqUsual_NoResults_doFn - doReturnFn moqUsual_NoResults_doReturnFn + doFn moqUsual_DifficultResultNames_doFn + doReturnFn moqUsual_DifficultResultNames_doReturnFn }{ - values: &struct{}{}, + values: &struct { + result1, result2 string + result3 error + param, result5, result6 int + result7, result8, result9 float32 + }{ + result1: result1, + result2: result2, + result3: result3, + param: param, + result5: result5, + result6: result6, + result7: result7, + result8: result8, + result9: result9, + }, sequence: sequence, }) return r } -func (r *moqUsual_NoResults_fnRecorder) andDo(fn moqUsual_NoResults_doFn) *moqUsual_NoResults_fnRecorder { +func (r *moqUsual_DifficultResultNames_fnRecorder) andDo(fn moqUsual_DifficultResultNames_doFn) *moqUsual_DifficultResultNames_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") @@ -11055,7 +15193,7 @@ func (r *moqUsual_NoResults_fnRecorder) andDo(fn moqUsual_NoResults_doFn) *moqUs return r } -func (r *moqUsual_NoResults_fnRecorder) doReturnResults(fn moqUsual_NoResults_doReturnFn) *moqUsual_NoResults_fnRecorder { +func (r *moqUsual_DifficultResultNames_fnRecorder) doReturnResults(fn moqUsual_DifficultResultNames_doReturnFn) *moqUsual_DifficultResultNames_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -11065,15 +15203,20 @@ func (r *moqUsual_NoResults_fnRecorder) doReturnResults(fn moqUsual_NoResults_do } r.results.results = append(r.results.results, struct { - values *struct{} + values *struct { + result1, result2 string + result3 error + param, result5, result6 int + result7, result8, result9 float32 + } sequence uint32 - doFn moqUsual_NoResults_doFn - doReturnFn moqUsual_NoResults_doReturnFn + doFn moqUsual_DifficultResultNames_doFn + doReturnFn moqUsual_DifficultResultNames_doReturnFn }{sequence: sequence, doReturnFn: fn}) return r } -func (r *moqUsual_NoResults_fnRecorder) findResults() { +func (r *moqUsual_DifficultResultNames_fnRecorder) findResults() { r.moq.scene.T.Helper() if r.results != nil { r.results.repeat.Increment(r.moq.scene.T) @@ -11082,8 +15225,8 @@ func (r *moqUsual_NoResults_fnRecorder) findResults() { anyCount := bits.OnesCount64(r.anyParams) insertAt := -1 - var results *moqUsual_NoResults_resultsByParams - for n, res := range r.moq.resultsByParams_NoResults { + var results *moqUsual_DifficultResultNames_resultsByParams + for n, res := range r.moq.resultsByParams_DifficultResultNames { if res.anyParams == r.anyParams { results = &res break @@ -11093,24 +15236,24 @@ func (r *moqUsual_NoResults_fnRecorder) findResults() { } } if results == nil { - results = &moqUsual_NoResults_resultsByParams{ + results = &moqUsual_DifficultResultNames_resultsByParams{ anyCount: anyCount, anyParams: r.anyParams, - results: map[moqUsual_NoResults_paramsKey]*moqUsual_NoResults_results{}, + results: map[moqUsual_DifficultResultNames_paramsKey]*moqUsual_DifficultResultNames_results{}, } - r.moq.resultsByParams_NoResults = append(r.moq.resultsByParams_NoResults, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_NoResults) { - copy(r.moq.resultsByParams_NoResults[insertAt+1:], r.moq.resultsByParams_NoResults[insertAt:0]) - r.moq.resultsByParams_NoResults[insertAt] = *results + r.moq.resultsByParams_DifficultResultNames = append(r.moq.resultsByParams_DifficultResultNames, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_DifficultResultNames) { + copy(r.moq.resultsByParams_DifficultResultNames[insertAt+1:], r.moq.resultsByParams_DifficultResultNames[insertAt:0]) + r.moq.resultsByParams_DifficultResultNames[insertAt] = *results } } - paramsKey := r.moq.paramsKey_NoResults(r.params, r.anyParams) + paramsKey := r.moq.paramsKey_DifficultResultNames(r.params, r.anyParams) var ok bool r.results, ok = results.results[paramsKey] if !ok { - r.results = &moqUsual_NoResults_results{ + r.results = &moqUsual_DifficultResultNames_results{ params: r.params, results: nil, index: 0, @@ -11122,7 +15265,7 @@ func (r *moqUsual_NoResults_fnRecorder) findResults() { r.results.repeat.Increment(r.moq.scene.T) } -func (r *moqUsual_NoResults_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_NoResults_fnRecorder { +func (r *moqUsual_DifficultResultNames_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_DifficultResultNames_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") @@ -11133,10 +15276,15 @@ func (r *moqUsual_NoResults_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUs for n := 0; n < r.results.repeat.ResultCount-1; n++ { if r.sequence { last = struct { - values *struct{} + values *struct { + result1, result2 string + result3 error + param, result5, result6 int + result7, result8, result9 float32 + } sequence uint32 - doFn moqUsual_NoResults_doFn - doReturnFn moqUsual_NoResults_doReturnFn + doFn moqUsual_DifficultResultNames_doFn + doReturnFn moqUsual_DifficultResultNames_doReturnFn }{ values: last.values, sequence: r.moq.scene.NextRecorderSequence(), @@ -11147,86 +15295,63 @@ func (r *moqUsual_NoResults_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUs return r } -func (m *moqUsual) prettyParams_NoResults(params moqUsual_NoResults_params) string { - return fmt.Sprintf("NoResults(%#v, %#v)", params.sParam, params.bParam) +func (m *moqUsual) prettyParams_DifficultResultNames(params moqUsual_DifficultResultNames_params) string { + return fmt.Sprintf("DifficultResultNames()") } -func (m *moqUsual) paramsKey_NoResults(params moqUsual_NoResults_params, anyParams uint64) moqUsual_NoResults_paramsKey { +func (m *moqUsual) paramsKey_DifficultResultNames(params moqUsual_DifficultResultNames_params, anyParams uint64) moqUsual_DifficultResultNames_paramsKey { m.scene.T.Helper() - var sParamUsed string - var sParamUsedHash hash.Hash - if anyParams&(1<<0) == 0 { - if m.runtime.parameterIndexing.NoResults.sParam == moq.ParamIndexByValue { - sParamUsed = params.sParam - } else { - sParamUsedHash = hash.DeepHash(params.sParam) - } - } - var bParamUsed bool - var bParamUsedHash hash.Hash - if anyParams&(1<<1) == 0 { - if m.runtime.parameterIndexing.NoResults.bParam == moq.ParamIndexByValue { - bParamUsed = params.bParam - } else { - bParamUsedHash = hash.DeepHash(params.bParam) - } - } - return moqUsual_NoResults_paramsKey{ - params: struct { - sParam string - bParam bool - }{ - sParam: sParamUsed, - bParam: bParamUsed, - }, - hashes: struct { - sParam hash.Hash - bParam hash.Hash - }{ - sParam: sParamUsedHash, - bParam: bParamUsedHash, - }, + return moqUsual_DifficultResultNames_paramsKey{ + params: struct{}{}, + hashes: struct{}{}, } } -func (m *moqUsual_recorder) NoParams() *moqUsual_NoParams_fnRecorder { - return &moqUsual_NoParams_fnRecorder{ - params: moqUsual_NoParams_params{}, +func (m *moqUsual_recorder) PassByArray(p [3]testmoqs.Params) *moqUsual_PassByArray_fnRecorder { + return &moqUsual_PassByArray_fnRecorder{ + params: moqUsual_PassByArray_params{ + p: p, + }, sequence: m.moq.config.Sequence == moq.SeqDefaultOn, moq: m.moq, } } -func (r *moqUsual_NoParams_fnRecorder) any() *moqUsual_NoParams_anyParams { +func (r *moqUsual_PassByArray_fnRecorder) any() *moqUsual_PassByArray_anyParams { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_NoParams(r.params)) + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByArray(r.params)) return nil } - return &moqUsual_NoParams_anyParams{recorder: r} + return &moqUsual_PassByArray_anyParams{recorder: r} } -func (r *moqUsual_NoParams_fnRecorder) seq() *moqUsual_NoParams_fnRecorder { +func (a *moqUsual_PassByArray_anyParams) p() *moqUsual_PassByArray_fnRecorder { + a.recorder.anyParams |= 1 << 0 + return a.recorder +} + +func (r *moqUsual_PassByArray_fnRecorder) seq() *moqUsual_PassByArray_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_NoParams(r.params)) + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByArray(r.params)) return nil } r.sequence = true return r } -func (r *moqUsual_NoParams_fnRecorder) noSeq() *moqUsual_NoParams_fnRecorder { +func (r *moqUsual_PassByArray_fnRecorder) noSeq() *moqUsual_PassByArray_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_NoParams(r.params)) + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByArray(r.params)) return nil } r.sequence = false return r } -func (r *moqUsual_NoParams_fnRecorder) returnResults(sResult string, err error) *moqUsual_NoParams_fnRecorder { +func (r *moqUsual_PassByArray_fnRecorder) returnResults(result1 [3]testmoqs.Results) *moqUsual_PassByArray_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -11237,26 +15362,23 @@ func (r *moqUsual_NoParams_fnRecorder) returnResults(sResult string, err error) r.results.results = append(r.results.results, struct { values *struct { - sResult string - err error + result1 [3]testmoqs.Results } sequence uint32 - doFn moqUsual_NoParams_doFn - doReturnFn moqUsual_NoParams_doReturnFn + doFn moqUsual_PassByArray_doFn + doReturnFn moqUsual_PassByArray_doReturnFn }{ values: &struct { - sResult string - err error + result1 [3]testmoqs.Results }{ - sResult: sResult, - err: err, + result1: result1, }, sequence: sequence, }) return r } -func (r *moqUsual_NoParams_fnRecorder) andDo(fn moqUsual_NoParams_doFn) *moqUsual_NoParams_fnRecorder { +func (r *moqUsual_PassByArray_fnRecorder) andDo(fn moqUsual_PassByArray_doFn) *moqUsual_PassByArray_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") @@ -11267,7 +15389,7 @@ func (r *moqUsual_NoParams_fnRecorder) andDo(fn moqUsual_NoParams_doFn) *moqUsua return r } -func (r *moqUsual_NoParams_fnRecorder) doReturnResults(fn moqUsual_NoParams_doReturnFn) *moqUsual_NoParams_fnRecorder { +func (r *moqUsual_PassByArray_fnRecorder) doReturnResults(fn moqUsual_PassByArray_doReturnFn) *moqUsual_PassByArray_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -11278,17 +15400,16 @@ func (r *moqUsual_NoParams_fnRecorder) doReturnResults(fn moqUsual_NoParams_doRe r.results.results = append(r.results.results, struct { values *struct { - sResult string - err error + result1 [3]testmoqs.Results } sequence uint32 - doFn moqUsual_NoParams_doFn - doReturnFn moqUsual_NoParams_doReturnFn + doFn moqUsual_PassByArray_doFn + doReturnFn moqUsual_PassByArray_doReturnFn }{sequence: sequence, doReturnFn: fn}) return r } -func (r *moqUsual_NoParams_fnRecorder) findResults() { +func (r *moqUsual_PassByArray_fnRecorder) findResults() { r.moq.scene.T.Helper() if r.results != nil { r.results.repeat.Increment(r.moq.scene.T) @@ -11297,8 +15418,8 @@ func (r *moqUsual_NoParams_fnRecorder) findResults() { anyCount := bits.OnesCount64(r.anyParams) insertAt := -1 - var results *moqUsual_NoParams_resultsByParams - for n, res := range r.moq.resultsByParams_NoParams { + var results *moqUsual_PassByArray_resultsByParams + for n, res := range r.moq.resultsByParams_PassByArray { if res.anyParams == r.anyParams { results = &res break @@ -11308,24 +15429,24 @@ func (r *moqUsual_NoParams_fnRecorder) findResults() { } } if results == nil { - results = &moqUsual_NoParams_resultsByParams{ + results = &moqUsual_PassByArray_resultsByParams{ anyCount: anyCount, anyParams: r.anyParams, - results: map[moqUsual_NoParams_paramsKey]*moqUsual_NoParams_results{}, + results: map[moqUsual_PassByArray_paramsKey]*moqUsual_PassByArray_results{}, } - r.moq.resultsByParams_NoParams = append(r.moq.resultsByParams_NoParams, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_NoParams) { - copy(r.moq.resultsByParams_NoParams[insertAt+1:], r.moq.resultsByParams_NoParams[insertAt:0]) - r.moq.resultsByParams_NoParams[insertAt] = *results + r.moq.resultsByParams_PassByArray = append(r.moq.resultsByParams_PassByArray, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_PassByArray) { + copy(r.moq.resultsByParams_PassByArray[insertAt+1:], r.moq.resultsByParams_PassByArray[insertAt:0]) + r.moq.resultsByParams_PassByArray[insertAt] = *results } } - paramsKey := r.moq.paramsKey_NoParams(r.params, r.anyParams) + paramsKey := r.moq.paramsKey_PassByArray(r.params, r.anyParams) var ok bool r.results, ok = results.results[paramsKey] if !ok { - r.results = &moqUsual_NoParams_results{ + r.results = &moqUsual_PassByArray_results{ params: r.params, results: nil, index: 0, @@ -11337,7 +15458,7 @@ func (r *moqUsual_NoParams_fnRecorder) findResults() { r.results.repeat.Increment(r.moq.scene.T) } -func (r *moqUsual_NoParams_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_NoParams_fnRecorder { +func (r *moqUsual_PassByArray_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_PassByArray_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") @@ -11349,12 +15470,11 @@ func (r *moqUsual_NoParams_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsu if r.sequence { last = struct { values *struct { - sResult string - err error + result1 [3]testmoqs.Results } sequence uint32 - doFn moqUsual_NoParams_doFn - doReturnFn moqUsual_NoParams_doReturnFn + doFn moqUsual_PassByArray_doFn + doReturnFn moqUsual_PassByArray_doReturnFn }{ values: last.values, sequence: r.moq.scene.NextRecorderSequence(), @@ -11365,56 +15485,76 @@ func (r *moqUsual_NoParams_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsu return r } -func (m *moqUsual) prettyParams_NoParams(params moqUsual_NoParams_params) string { - return fmt.Sprintf("NoParams()") +func (m *moqUsual) prettyParams_PassByArray(params moqUsual_PassByArray_params) string { + return fmt.Sprintf("PassByArray(%#v)", params.p) } -func (m *moqUsual) paramsKey_NoParams(params moqUsual_NoParams_params, anyParams uint64) moqUsual_NoParams_paramsKey { +func (m *moqUsual) paramsKey_PassByArray(params moqUsual_PassByArray_params, anyParams uint64) moqUsual_PassByArray_paramsKey { m.scene.T.Helper() - return moqUsual_NoParams_paramsKey{ - params: struct{}{}, - hashes: struct{}{}, + var pUsed [3]testmoqs.Params + var pUsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.runtime.parameterIndexing.PassByArray.p == moq.ParamIndexByValue { + pUsed = params.p + } else { + pUsedHash = hash.DeepHash(params.p) + } + } + return moqUsual_PassByArray_paramsKey{ + params: struct{ p [3]testmoqs.Params }{ + p: pUsed, + }, + hashes: struct{ p hash.Hash }{ + p: pUsedHash, + }, } } -func (m *moqUsual_recorder) Nothing() *moqUsual_Nothing_fnRecorder { - return &moqUsual_Nothing_fnRecorder{ - params: moqUsual_Nothing_params{}, +func (m *moqUsual_recorder) PassByChan(p chan testmoqs.Params) *moqUsual_PassByChan_fnRecorder { + return &moqUsual_PassByChan_fnRecorder{ + params: moqUsual_PassByChan_params{ + p: p, + }, sequence: m.moq.config.Sequence == moq.SeqDefaultOn, moq: m.moq, } } -func (r *moqUsual_Nothing_fnRecorder) any() *moqUsual_Nothing_anyParams { +func (r *moqUsual_PassByChan_fnRecorder) any() *moqUsual_PassByChan_anyParams { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Nothing(r.params)) + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByChan(r.params)) return nil } - return &moqUsual_Nothing_anyParams{recorder: r} + return &moqUsual_PassByChan_anyParams{recorder: r} } -func (r *moqUsual_Nothing_fnRecorder) seq() *moqUsual_Nothing_fnRecorder { +func (a *moqUsual_PassByChan_anyParams) p() *moqUsual_PassByChan_fnRecorder { + a.recorder.anyParams |= 1 << 0 + return a.recorder +} + +func (r *moqUsual_PassByChan_fnRecorder) seq() *moqUsual_PassByChan_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Nothing(r.params)) + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByChan(r.params)) return nil } r.sequence = true return r } -func (r *moqUsual_Nothing_fnRecorder) noSeq() *moqUsual_Nothing_fnRecorder { +func (r *moqUsual_PassByChan_fnRecorder) noSeq() *moqUsual_PassByChan_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Nothing(r.params)) + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByChan(r.params)) return nil } r.sequence = false return r } -func (r *moqUsual_Nothing_fnRecorder) returnResults() *moqUsual_Nothing_fnRecorder { +func (r *moqUsual_PassByChan_fnRecorder) returnResults(result1 chan testmoqs.Results) *moqUsual_PassByChan_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -11424,18 +15564,24 @@ func (r *moqUsual_Nothing_fnRecorder) returnResults() *moqUsual_Nothing_fnRecord } r.results.results = append(r.results.results, struct { - values *struct{} + values *struct { + result1 chan testmoqs.Results + } sequence uint32 - doFn moqUsual_Nothing_doFn - doReturnFn moqUsual_Nothing_doReturnFn + doFn moqUsual_PassByChan_doFn + doReturnFn moqUsual_PassByChan_doReturnFn }{ - values: &struct{}{}, + values: &struct { + result1 chan testmoqs.Results + }{ + result1: result1, + }, sequence: sequence, }) return r } -func (r *moqUsual_Nothing_fnRecorder) andDo(fn moqUsual_Nothing_doFn) *moqUsual_Nothing_fnRecorder { +func (r *moqUsual_PassByChan_fnRecorder) andDo(fn moqUsual_PassByChan_doFn) *moqUsual_PassByChan_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") @@ -11446,7 +15592,7 @@ func (r *moqUsual_Nothing_fnRecorder) andDo(fn moqUsual_Nothing_doFn) *moqUsual_ return r } -func (r *moqUsual_Nothing_fnRecorder) doReturnResults(fn moqUsual_Nothing_doReturnFn) *moqUsual_Nothing_fnRecorder { +func (r *moqUsual_PassByChan_fnRecorder) doReturnResults(fn moqUsual_PassByChan_doReturnFn) *moqUsual_PassByChan_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -11456,15 +15602,17 @@ func (r *moqUsual_Nothing_fnRecorder) doReturnResults(fn moqUsual_Nothing_doRetu } r.results.results = append(r.results.results, struct { - values *struct{} + values *struct { + result1 chan testmoqs.Results + } sequence uint32 - doFn moqUsual_Nothing_doFn - doReturnFn moqUsual_Nothing_doReturnFn + doFn moqUsual_PassByChan_doFn + doReturnFn moqUsual_PassByChan_doReturnFn }{sequence: sequence, doReturnFn: fn}) return r } -func (r *moqUsual_Nothing_fnRecorder) findResults() { +func (r *moqUsual_PassByChan_fnRecorder) findResults() { r.moq.scene.T.Helper() if r.results != nil { r.results.repeat.Increment(r.moq.scene.T) @@ -11473,8 +15621,8 @@ func (r *moqUsual_Nothing_fnRecorder) findResults() { anyCount := bits.OnesCount64(r.anyParams) insertAt := -1 - var results *moqUsual_Nothing_resultsByParams - for n, res := range r.moq.resultsByParams_Nothing { + var results *moqUsual_PassByChan_resultsByParams + for n, res := range r.moq.resultsByParams_PassByChan { if res.anyParams == r.anyParams { results = &res break @@ -11484,24 +15632,24 @@ func (r *moqUsual_Nothing_fnRecorder) findResults() { } } if results == nil { - results = &moqUsual_Nothing_resultsByParams{ + results = &moqUsual_PassByChan_resultsByParams{ anyCount: anyCount, anyParams: r.anyParams, - results: map[moqUsual_Nothing_paramsKey]*moqUsual_Nothing_results{}, + results: map[moqUsual_PassByChan_paramsKey]*moqUsual_PassByChan_results{}, } - r.moq.resultsByParams_Nothing = append(r.moq.resultsByParams_Nothing, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_Nothing) { - copy(r.moq.resultsByParams_Nothing[insertAt+1:], r.moq.resultsByParams_Nothing[insertAt:0]) - r.moq.resultsByParams_Nothing[insertAt] = *results + r.moq.resultsByParams_PassByChan = append(r.moq.resultsByParams_PassByChan, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_PassByChan) { + copy(r.moq.resultsByParams_PassByChan[insertAt+1:], r.moq.resultsByParams_PassByChan[insertAt:0]) + r.moq.resultsByParams_PassByChan[insertAt] = *results } } - paramsKey := r.moq.paramsKey_Nothing(r.params, r.anyParams) + paramsKey := r.moq.paramsKey_PassByChan(r.params, r.anyParams) var ok bool r.results, ok = results.results[paramsKey] if !ok { - r.results = &moqUsual_Nothing_results{ + r.results = &moqUsual_PassByChan_results{ params: r.params, results: nil, index: 0, @@ -11513,7 +15661,7 @@ func (r *moqUsual_Nothing_fnRecorder) findResults() { r.results.repeat.Increment(r.moq.scene.T) } -func (r *moqUsual_Nothing_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_Nothing_fnRecorder { +func (r *moqUsual_PassByChan_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_PassByChan_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") @@ -11524,10 +15672,12 @@ func (r *moqUsual_Nothing_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsua for n := 0; n < r.results.repeat.ResultCount-1; n++ { if r.sequence { last = struct { - values *struct{} + values *struct { + result1 chan testmoqs.Results + } sequence uint32 - doFn moqUsual_Nothing_doFn - doReturnFn moqUsual_Nothing_doReturnFn + doFn moqUsual_PassByChan_doFn + doReturnFn moqUsual_PassByChan_doReturnFn }{ values: last.values, sequence: r.moq.scene.NextRecorderSequence(), @@ -11538,69 +15688,76 @@ func (r *moqUsual_Nothing_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsua return r } -func (m *moqUsual) prettyParams_Nothing(params moqUsual_Nothing_params) string { - return fmt.Sprintf("Nothing()") +func (m *moqUsual) prettyParams_PassByChan(params moqUsual_PassByChan_params) string { + return fmt.Sprintf("PassByChan(%#v)", params.p) } -func (m *moqUsual) paramsKey_Nothing(params moqUsual_Nothing_params, anyParams uint64) moqUsual_Nothing_paramsKey { +func (m *moqUsual) paramsKey_PassByChan(params moqUsual_PassByChan_params, anyParams uint64) moqUsual_PassByChan_paramsKey { m.scene.T.Helper() - return moqUsual_Nothing_paramsKey{ - params: struct{}{}, - hashes: struct{}{}, + var pUsed chan testmoqs.Params + var pUsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.runtime.parameterIndexing.PassByChan.p == moq.ParamIndexByValue { + pUsed = params.p + } else { + pUsedHash = hash.DeepHash(params.p) + } + } + return moqUsual_PassByChan_paramsKey{ + params: struct{ p chan testmoqs.Params }{ + p: pUsed, + }, + hashes: struct{ p hash.Hash }{ + p: pUsedHash, + }, } } -func (m *moqUsual_recorder) Variadic(other bool, args ...string) *moqUsual_Variadic_fnRecorder { - return &moqUsual_Variadic_fnRecorder{ - params: moqUsual_Variadic_params{ - other: other, - args: args, +func (m *moqUsual_recorder) PassByEllipsis(p ...testmoqs.Params) *moqUsual_PassByEllipsis_fnRecorder { + return &moqUsual_PassByEllipsis_fnRecorder{ + params: moqUsual_PassByEllipsis_params{ + p: p, }, sequence: m.moq.config.Sequence == moq.SeqDefaultOn, moq: m.moq, } } -func (r *moqUsual_Variadic_fnRecorder) any() *moqUsual_Variadic_anyParams { +func (r *moqUsual_PassByEllipsis_fnRecorder) any() *moqUsual_PassByEllipsis_anyParams { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Variadic(r.params)) + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByEllipsis(r.params)) return nil } - return &moqUsual_Variadic_anyParams{recorder: r} + return &moqUsual_PassByEllipsis_anyParams{recorder: r} } -func (a *moqUsual_Variadic_anyParams) other() *moqUsual_Variadic_fnRecorder { +func (a *moqUsual_PassByEllipsis_anyParams) p() *moqUsual_PassByEllipsis_fnRecorder { a.recorder.anyParams |= 1 << 0 return a.recorder } -func (a *moqUsual_Variadic_anyParams) args() *moqUsual_Variadic_fnRecorder { - a.recorder.anyParams |= 1 << 1 - return a.recorder -} - -func (r *moqUsual_Variadic_fnRecorder) seq() *moqUsual_Variadic_fnRecorder { +func (r *moqUsual_PassByEllipsis_fnRecorder) seq() *moqUsual_PassByEllipsis_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Variadic(r.params)) + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByEllipsis(r.params)) return nil } r.sequence = true return r } -func (r *moqUsual_Variadic_fnRecorder) noSeq() *moqUsual_Variadic_fnRecorder { +func (r *moqUsual_PassByEllipsis_fnRecorder) noSeq() *moqUsual_PassByEllipsis_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Variadic(r.params)) + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByEllipsis(r.params)) return nil } r.sequence = false return r } -func (r *moqUsual_Variadic_fnRecorder) returnResults(sResult string, err error) *moqUsual_Variadic_fnRecorder { +func (r *moqUsual_PassByEllipsis_fnRecorder) returnResults(result1 string, result2 error) *moqUsual_PassByEllipsis_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -11611,26 +15768,26 @@ func (r *moqUsual_Variadic_fnRecorder) returnResults(sResult string, err error) r.results.results = append(r.results.results, struct { values *struct { - sResult string - err error + result1 string + result2 error } sequence uint32 - doFn moqUsual_Variadic_doFn - doReturnFn moqUsual_Variadic_doReturnFn + doFn moqUsual_PassByEllipsis_doFn + doReturnFn moqUsual_PassByEllipsis_doReturnFn }{ values: &struct { - sResult string - err error + result1 string + result2 error }{ - sResult: sResult, - err: err, + result1: result1, + result2: result2, }, sequence: sequence, }) return r } -func (r *moqUsual_Variadic_fnRecorder) andDo(fn moqUsual_Variadic_doFn) *moqUsual_Variadic_fnRecorder { +func (r *moqUsual_PassByEllipsis_fnRecorder) andDo(fn moqUsual_PassByEllipsis_doFn) *moqUsual_PassByEllipsis_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") @@ -11641,7 +15798,7 @@ func (r *moqUsual_Variadic_fnRecorder) andDo(fn moqUsual_Variadic_doFn) *moqUsua return r } -func (r *moqUsual_Variadic_fnRecorder) doReturnResults(fn moqUsual_Variadic_doReturnFn) *moqUsual_Variadic_fnRecorder { +func (r *moqUsual_PassByEllipsis_fnRecorder) doReturnResults(fn moqUsual_PassByEllipsis_doReturnFn) *moqUsual_PassByEllipsis_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -11652,17 +15809,17 @@ func (r *moqUsual_Variadic_fnRecorder) doReturnResults(fn moqUsual_Variadic_doRe r.results.results = append(r.results.results, struct { values *struct { - sResult string - err error + result1 string + result2 error } sequence uint32 - doFn moqUsual_Variadic_doFn - doReturnFn moqUsual_Variadic_doReturnFn + doFn moqUsual_PassByEllipsis_doFn + doReturnFn moqUsual_PassByEllipsis_doReturnFn }{sequence: sequence, doReturnFn: fn}) return r } -func (r *moqUsual_Variadic_fnRecorder) findResults() { +func (r *moqUsual_PassByEllipsis_fnRecorder) findResults() { r.moq.scene.T.Helper() if r.results != nil { r.results.repeat.Increment(r.moq.scene.T) @@ -11671,8 +15828,8 @@ func (r *moqUsual_Variadic_fnRecorder) findResults() { anyCount := bits.OnesCount64(r.anyParams) insertAt := -1 - var results *moqUsual_Variadic_resultsByParams - for n, res := range r.moq.resultsByParams_Variadic { + var results *moqUsual_PassByEllipsis_resultsByParams + for n, res := range r.moq.resultsByParams_PassByEllipsis { if res.anyParams == r.anyParams { results = &res break @@ -11682,24 +15839,24 @@ func (r *moqUsual_Variadic_fnRecorder) findResults() { } } if results == nil { - results = &moqUsual_Variadic_resultsByParams{ + results = &moqUsual_PassByEllipsis_resultsByParams{ anyCount: anyCount, anyParams: r.anyParams, - results: map[moqUsual_Variadic_paramsKey]*moqUsual_Variadic_results{}, + results: map[moqUsual_PassByEllipsis_paramsKey]*moqUsual_PassByEllipsis_results{}, } - r.moq.resultsByParams_Variadic = append(r.moq.resultsByParams_Variadic, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_Variadic) { - copy(r.moq.resultsByParams_Variadic[insertAt+1:], r.moq.resultsByParams_Variadic[insertAt:0]) - r.moq.resultsByParams_Variadic[insertAt] = *results + r.moq.resultsByParams_PassByEllipsis = append(r.moq.resultsByParams_PassByEllipsis, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_PassByEllipsis) { + copy(r.moq.resultsByParams_PassByEllipsis[insertAt+1:], r.moq.resultsByParams_PassByEllipsis[insertAt:0]) + r.moq.resultsByParams_PassByEllipsis[insertAt] = *results } } - paramsKey := r.moq.paramsKey_Variadic(r.params, r.anyParams) + paramsKey := r.moq.paramsKey_PassByEllipsis(r.params, r.anyParams) var ok bool r.results, ok = results.results[paramsKey] if !ok { - r.results = &moqUsual_Variadic_results{ + r.results = &moqUsual_PassByEllipsis_results{ params: r.params, results: nil, index: 0, @@ -11711,7 +15868,7 @@ func (r *moqUsual_Variadic_fnRecorder) findResults() { r.results.repeat.Increment(r.moq.scene.T) } -func (r *moqUsual_Variadic_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_Variadic_fnRecorder { +func (r *moqUsual_PassByEllipsis_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_PassByEllipsis_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") @@ -11723,12 +15880,12 @@ func (r *moqUsual_Variadic_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsu if r.sequence { last = struct { values *struct { - sResult string - err error + result1 string + result2 error } sequence uint32 - doFn moqUsual_Variadic_doFn - doReturnFn moqUsual_Variadic_doReturnFn + doFn moqUsual_PassByEllipsis_doFn + doReturnFn moqUsual_PassByEllipsis_doReturnFn }{ values: last.values, sequence: r.moq.scene.NextRecorderSequence(), @@ -11739,99 +15896,72 @@ func (r *moqUsual_Variadic_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsu return r } -func (m *moqUsual) prettyParams_Variadic(params moqUsual_Variadic_params) string { - return fmt.Sprintf("Variadic(%#v, %#v)", params.other, params.args) +func (m *moqUsual) prettyParams_PassByEllipsis(params moqUsual_PassByEllipsis_params) string { + return fmt.Sprintf("PassByEllipsis(%#v)", params.p) } -func (m *moqUsual) paramsKey_Variadic(params moqUsual_Variadic_params, anyParams uint64) moqUsual_Variadic_paramsKey { +func (m *moqUsual) paramsKey_PassByEllipsis(params moqUsual_PassByEllipsis_params, anyParams uint64) moqUsual_PassByEllipsis_paramsKey { m.scene.T.Helper() - var otherUsed bool - var otherUsedHash hash.Hash + var pUsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.runtime.parameterIndexing.Variadic.other == moq.ParamIndexByValue { - otherUsed = params.other - } else { - otherUsedHash = hash.DeepHash(params.other) - } - } - var argsUsedHash hash.Hash - if anyParams&(1<<1) == 0 { - if m.runtime.parameterIndexing.Variadic.args == moq.ParamIndexByValue { - m.scene.T.Fatalf("The args parameter of the Variadic function can't be indexed by value") + if m.runtime.parameterIndexing.PassByEllipsis.p == moq.ParamIndexByValue { + m.scene.T.Fatalf("The p parameter of the PassByEllipsis function can't be indexed by value") } - argsUsedHash = hash.DeepHash(params.args) + pUsedHash = hash.DeepHash(params.p) } - return moqUsual_Variadic_paramsKey{ - params: struct{ other bool }{ - other: otherUsed, - }, - hashes: struct { - other hash.Hash - args hash.Hash - }{ - other: otherUsedHash, - args: argsUsedHash, + return moqUsual_PassByEllipsis_paramsKey{ + params: struct{}{}, + hashes: struct{ p hash.Hash }{ + p: pUsedHash, }, } } -func (m *moqUsual_recorder) RepeatedIds(sParam1, sParam2 string, bParam bool) *moqUsual_RepeatedIds_fnRecorder { - return &moqUsual_RepeatedIds_fnRecorder{ - params: moqUsual_RepeatedIds_params{ - sParam1: sParam1, - sParam2: sParam2, - bParam: bParam, +func (m *moqUsual_recorder) PassByMap(p map[string]testmoqs.Params) *moqUsual_PassByMap_fnRecorder { + return &moqUsual_PassByMap_fnRecorder{ + params: moqUsual_PassByMap_params{ + p: p, }, sequence: m.moq.config.Sequence == moq.SeqDefaultOn, moq: m.moq, } } -func (r *moqUsual_RepeatedIds_fnRecorder) any() *moqUsual_RepeatedIds_anyParams { +func (r *moqUsual_PassByMap_fnRecorder) any() *moqUsual_PassByMap_anyParams { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_RepeatedIds(r.params)) - return nil - } - return &moqUsual_RepeatedIds_anyParams{recorder: r} -} - -func (a *moqUsual_RepeatedIds_anyParams) sParam1() *moqUsual_RepeatedIds_fnRecorder { - a.recorder.anyParams |= 1 << 0 - return a.recorder -} - -func (a *moqUsual_RepeatedIds_anyParams) sParam2() *moqUsual_RepeatedIds_fnRecorder { - a.recorder.anyParams |= 1 << 1 - return a.recorder + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByMap(r.params)) + return nil + } + return &moqUsual_PassByMap_anyParams{recorder: r} } -func (a *moqUsual_RepeatedIds_anyParams) bParam() *moqUsual_RepeatedIds_fnRecorder { - a.recorder.anyParams |= 1 << 2 +func (a *moqUsual_PassByMap_anyParams) p() *moqUsual_PassByMap_fnRecorder { + a.recorder.anyParams |= 1 << 0 return a.recorder } -func (r *moqUsual_RepeatedIds_fnRecorder) seq() *moqUsual_RepeatedIds_fnRecorder { +func (r *moqUsual_PassByMap_fnRecorder) seq() *moqUsual_PassByMap_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_RepeatedIds(r.params)) + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByMap(r.params)) return nil } r.sequence = true return r } -func (r *moqUsual_RepeatedIds_fnRecorder) noSeq() *moqUsual_RepeatedIds_fnRecorder { +func (r *moqUsual_PassByMap_fnRecorder) noSeq() *moqUsual_PassByMap_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_RepeatedIds(r.params)) + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByMap(r.params)) return nil } r.sequence = false return r } -func (r *moqUsual_RepeatedIds_fnRecorder) returnResults(sResult1, sResult2 string, err error) *moqUsual_RepeatedIds_fnRecorder { +func (r *moqUsual_PassByMap_fnRecorder) returnResults(result1 map[string]testmoqs.Results) *moqUsual_PassByMap_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -11842,27 +15972,23 @@ func (r *moqUsual_RepeatedIds_fnRecorder) returnResults(sResult1, sResult2 strin r.results.results = append(r.results.results, struct { values *struct { - sResult1, sResult2 string - err error + result1 map[string]testmoqs.Results } sequence uint32 - doFn moqUsual_RepeatedIds_doFn - doReturnFn moqUsual_RepeatedIds_doReturnFn + doFn moqUsual_PassByMap_doFn + doReturnFn moqUsual_PassByMap_doReturnFn }{ values: &struct { - sResult1, sResult2 string - err error + result1 map[string]testmoqs.Results }{ - sResult1: sResult1, - sResult2: sResult2, - err: err, + result1: result1, }, sequence: sequence, }) return r } -func (r *moqUsual_RepeatedIds_fnRecorder) andDo(fn moqUsual_RepeatedIds_doFn) *moqUsual_RepeatedIds_fnRecorder { +func (r *moqUsual_PassByMap_fnRecorder) andDo(fn moqUsual_PassByMap_doFn) *moqUsual_PassByMap_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") @@ -11873,7 +15999,7 @@ func (r *moqUsual_RepeatedIds_fnRecorder) andDo(fn moqUsual_RepeatedIds_doFn) *m return r } -func (r *moqUsual_RepeatedIds_fnRecorder) doReturnResults(fn moqUsual_RepeatedIds_doReturnFn) *moqUsual_RepeatedIds_fnRecorder { +func (r *moqUsual_PassByMap_fnRecorder) doReturnResults(fn moqUsual_PassByMap_doReturnFn) *moqUsual_PassByMap_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -11884,17 +16010,16 @@ func (r *moqUsual_RepeatedIds_fnRecorder) doReturnResults(fn moqUsual_RepeatedId r.results.results = append(r.results.results, struct { values *struct { - sResult1, sResult2 string - err error + result1 map[string]testmoqs.Results } sequence uint32 - doFn moqUsual_RepeatedIds_doFn - doReturnFn moqUsual_RepeatedIds_doReturnFn + doFn moqUsual_PassByMap_doFn + doReturnFn moqUsual_PassByMap_doReturnFn }{sequence: sequence, doReturnFn: fn}) return r } -func (r *moqUsual_RepeatedIds_fnRecorder) findResults() { +func (r *moqUsual_PassByMap_fnRecorder) findResults() { r.moq.scene.T.Helper() if r.results != nil { r.results.repeat.Increment(r.moq.scene.T) @@ -11903,8 +16028,8 @@ func (r *moqUsual_RepeatedIds_fnRecorder) findResults() { anyCount := bits.OnesCount64(r.anyParams) insertAt := -1 - var results *moqUsual_RepeatedIds_resultsByParams - for n, res := range r.moq.resultsByParams_RepeatedIds { + var results *moqUsual_PassByMap_resultsByParams + for n, res := range r.moq.resultsByParams_PassByMap { if res.anyParams == r.anyParams { results = &res break @@ -11914,24 +16039,24 @@ func (r *moqUsual_RepeatedIds_fnRecorder) findResults() { } } if results == nil { - results = &moqUsual_RepeatedIds_resultsByParams{ + results = &moqUsual_PassByMap_resultsByParams{ anyCount: anyCount, anyParams: r.anyParams, - results: map[moqUsual_RepeatedIds_paramsKey]*moqUsual_RepeatedIds_results{}, + results: map[moqUsual_PassByMap_paramsKey]*moqUsual_PassByMap_results{}, } - r.moq.resultsByParams_RepeatedIds = append(r.moq.resultsByParams_RepeatedIds, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_RepeatedIds) { - copy(r.moq.resultsByParams_RepeatedIds[insertAt+1:], r.moq.resultsByParams_RepeatedIds[insertAt:0]) - r.moq.resultsByParams_RepeatedIds[insertAt] = *results + r.moq.resultsByParams_PassByMap = append(r.moq.resultsByParams_PassByMap, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_PassByMap) { + copy(r.moq.resultsByParams_PassByMap[insertAt+1:], r.moq.resultsByParams_PassByMap[insertAt:0]) + r.moq.resultsByParams_PassByMap[insertAt] = *results } } - paramsKey := r.moq.paramsKey_RepeatedIds(r.params, r.anyParams) + paramsKey := r.moq.paramsKey_PassByMap(r.params, r.anyParams) var ok bool r.results, ok = results.results[paramsKey] if !ok { - r.results = &moqUsual_RepeatedIds_results{ + r.results = &moqUsual_PassByMap_results{ params: r.params, results: nil, index: 0, @@ -11943,7 +16068,7 @@ func (r *moqUsual_RepeatedIds_fnRecorder) findResults() { r.results.repeat.Increment(r.moq.scene.T) } -func (r *moqUsual_RepeatedIds_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_RepeatedIds_fnRecorder { +func (r *moqUsual_PassByMap_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_PassByMap_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") @@ -11955,12 +16080,11 @@ func (r *moqUsual_RepeatedIds_fnRecorder) repeat(repeaters ...moq.Repeater) *moq if r.sequence { last = struct { values *struct { - sResult1, sResult2 string - err error + result1 map[string]testmoqs.Results } sequence uint32 - doFn moqUsual_RepeatedIds_doFn - doReturnFn moqUsual_RepeatedIds_doReturnFn + doFn moqUsual_PassByMap_doFn + doReturnFn moqUsual_PassByMap_doReturnFn }{ values: last.values, sequence: r.moq.scene.NextRecorderSequence(), @@ -11971,110 +16095,72 @@ func (r *moqUsual_RepeatedIds_fnRecorder) repeat(repeaters ...moq.Repeater) *moq return r } -func (m *moqUsual) prettyParams_RepeatedIds(params moqUsual_RepeatedIds_params) string { - return fmt.Sprintf("RepeatedIds(%#v, %#v, %#v)", params.sParam1, params.sParam2, params.bParam) +func (m *moqUsual) prettyParams_PassByMap(params moqUsual_PassByMap_params) string { + return fmt.Sprintf("PassByMap(%#v)", params.p) } -func (m *moqUsual) paramsKey_RepeatedIds(params moqUsual_RepeatedIds_params, anyParams uint64) moqUsual_RepeatedIds_paramsKey { +func (m *moqUsual) paramsKey_PassByMap(params moqUsual_PassByMap_params, anyParams uint64) moqUsual_PassByMap_paramsKey { m.scene.T.Helper() - var sParam1Used string - var sParam1UsedHash hash.Hash + var pUsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.runtime.parameterIndexing.RepeatedIds.sParam1 == moq.ParamIndexByValue { - sParam1Used = params.sParam1 - } else { - sParam1UsedHash = hash.DeepHash(params.sParam1) - } - } - var sParam2Used string - var sParam2UsedHash hash.Hash - if anyParams&(1<<1) == 0 { - if m.runtime.parameterIndexing.RepeatedIds.sParam2 == moq.ParamIndexByValue { - sParam2Used = params.sParam2 - } else { - sParam2UsedHash = hash.DeepHash(params.sParam2) - } - } - var bParamUsed bool - var bParamUsedHash hash.Hash - if anyParams&(1<<2) == 0 { - if m.runtime.parameterIndexing.RepeatedIds.bParam == moq.ParamIndexByValue { - bParamUsed = params.bParam - } else { - bParamUsedHash = hash.DeepHash(params.bParam) + if m.runtime.parameterIndexing.PassByMap.p == moq.ParamIndexByValue { + m.scene.T.Fatalf("The p parameter of the PassByMap function can't be indexed by value") } + pUsedHash = hash.DeepHash(params.p) } - return moqUsual_RepeatedIds_paramsKey{ - params: struct { - sParam1, sParam2 string - bParam bool - }{ - sParam1: sParam1Used, - sParam2: sParam2Used, - bParam: bParamUsed, - }, - hashes: struct { - sParam1, sParam2 hash.Hash - bParam hash.Hash - }{ - sParam1: sParam1UsedHash, - sParam2: sParam2UsedHash, - bParam: bParamUsedHash, + return moqUsual_PassByMap_paramsKey{ + params: struct{}{}, + hashes: struct{ p hash.Hash }{ + p: pUsedHash, }, } } -func (m *moqUsual_recorder) Times(sParam string, times bool) *moqUsual_Times_fnRecorder { - return &moqUsual_Times_fnRecorder{ - params: moqUsual_Times_params{ - sParam: sParam, - times: times, +func (m *moqUsual_recorder) PassByReference(p *testmoqs.Params) *moqUsual_PassByReference_fnRecorder { + return &moqUsual_PassByReference_fnRecorder{ + params: moqUsual_PassByReference_params{ + p: p, }, sequence: m.moq.config.Sequence == moq.SeqDefaultOn, moq: m.moq, } } -func (r *moqUsual_Times_fnRecorder) any() *moqUsual_Times_anyParams { +func (r *moqUsual_PassByReference_fnRecorder) any() *moqUsual_PassByReference_anyParams { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Times(r.params)) + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByReference(r.params)) return nil } - return &moqUsual_Times_anyParams{recorder: r} + return &moqUsual_PassByReference_anyParams{recorder: r} } -func (a *moqUsual_Times_anyParams) sParam() *moqUsual_Times_fnRecorder { +func (a *moqUsual_PassByReference_anyParams) p() *moqUsual_PassByReference_fnRecorder { a.recorder.anyParams |= 1 << 0 return a.recorder } -func (a *moqUsual_Times_anyParams) times() *moqUsual_Times_fnRecorder { - a.recorder.anyParams |= 1 << 1 - return a.recorder -} - -func (r *moqUsual_Times_fnRecorder) seq() *moqUsual_Times_fnRecorder { +func (r *moqUsual_PassByReference_fnRecorder) seq() *moqUsual_PassByReference_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Times(r.params)) + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByReference(r.params)) return nil } r.sequence = true return r } -func (r *moqUsual_Times_fnRecorder) noSeq() *moqUsual_Times_fnRecorder { +func (r *moqUsual_PassByReference_fnRecorder) noSeq() *moqUsual_PassByReference_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Times(r.params)) + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByReference(r.params)) return nil } r.sequence = false return r } -func (r *moqUsual_Times_fnRecorder) returnResults(sResult string, err error) *moqUsual_Times_fnRecorder { +func (r *moqUsual_PassByReference_fnRecorder) returnResults(result1 *testmoqs.Results) *moqUsual_PassByReference_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -12085,26 +16171,23 @@ func (r *moqUsual_Times_fnRecorder) returnResults(sResult string, err error) *mo r.results.results = append(r.results.results, struct { values *struct { - sResult string - err error + result1 *testmoqs.Results } sequence uint32 - doFn moqUsual_Times_doFn - doReturnFn moqUsual_Times_doReturnFn + doFn moqUsual_PassByReference_doFn + doReturnFn moqUsual_PassByReference_doReturnFn }{ values: &struct { - sResult string - err error + result1 *testmoqs.Results }{ - sResult: sResult, - err: err, + result1: result1, }, sequence: sequence, }) return r } -func (r *moqUsual_Times_fnRecorder) andDo(fn moqUsual_Times_doFn) *moqUsual_Times_fnRecorder { +func (r *moqUsual_PassByReference_fnRecorder) andDo(fn moqUsual_PassByReference_doFn) *moqUsual_PassByReference_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") @@ -12115,7 +16198,7 @@ func (r *moqUsual_Times_fnRecorder) andDo(fn moqUsual_Times_doFn) *moqUsual_Time return r } -func (r *moqUsual_Times_fnRecorder) doReturnResults(fn moqUsual_Times_doReturnFn) *moqUsual_Times_fnRecorder { +func (r *moqUsual_PassByReference_fnRecorder) doReturnResults(fn moqUsual_PassByReference_doReturnFn) *moqUsual_PassByReference_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -12126,17 +16209,16 @@ func (r *moqUsual_Times_fnRecorder) doReturnResults(fn moqUsual_Times_doReturnFn r.results.results = append(r.results.results, struct { values *struct { - sResult string - err error + result1 *testmoqs.Results } sequence uint32 - doFn moqUsual_Times_doFn - doReturnFn moqUsual_Times_doReturnFn + doFn moqUsual_PassByReference_doFn + doReturnFn moqUsual_PassByReference_doReturnFn }{sequence: sequence, doReturnFn: fn}) return r } -func (r *moqUsual_Times_fnRecorder) findResults() { +func (r *moqUsual_PassByReference_fnRecorder) findResults() { r.moq.scene.T.Helper() if r.results != nil { r.results.repeat.Increment(r.moq.scene.T) @@ -12145,8 +16227,8 @@ func (r *moqUsual_Times_fnRecorder) findResults() { anyCount := bits.OnesCount64(r.anyParams) insertAt := -1 - var results *moqUsual_Times_resultsByParams - for n, res := range r.moq.resultsByParams_Times { + var results *moqUsual_PassByReference_resultsByParams + for n, res := range r.moq.resultsByParams_PassByReference { if res.anyParams == r.anyParams { results = &res break @@ -12156,24 +16238,24 @@ func (r *moqUsual_Times_fnRecorder) findResults() { } } if results == nil { - results = &moqUsual_Times_resultsByParams{ + results = &moqUsual_PassByReference_resultsByParams{ anyCount: anyCount, anyParams: r.anyParams, - results: map[moqUsual_Times_paramsKey]*moqUsual_Times_results{}, + results: map[moqUsual_PassByReference_paramsKey]*moqUsual_PassByReference_results{}, } - r.moq.resultsByParams_Times = append(r.moq.resultsByParams_Times, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_Times) { - copy(r.moq.resultsByParams_Times[insertAt+1:], r.moq.resultsByParams_Times[insertAt:0]) - r.moq.resultsByParams_Times[insertAt] = *results + r.moq.resultsByParams_PassByReference = append(r.moq.resultsByParams_PassByReference, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_PassByReference) { + copy(r.moq.resultsByParams_PassByReference[insertAt+1:], r.moq.resultsByParams_PassByReference[insertAt:0]) + r.moq.resultsByParams_PassByReference[insertAt] = *results } } - paramsKey := r.moq.paramsKey_Times(r.params, r.anyParams) + paramsKey := r.moq.paramsKey_PassByReference(r.params, r.anyParams) var ok bool r.results, ok = results.results[paramsKey] if !ok { - r.results = &moqUsual_Times_results{ + r.results = &moqUsual_PassByReference_results{ params: r.params, results: nil, index: 0, @@ -12185,7 +16267,7 @@ func (r *moqUsual_Times_fnRecorder) findResults() { r.results.repeat.Increment(r.moq.scene.T) } -func (r *moqUsual_Times_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_Times_fnRecorder { +func (r *moqUsual_PassByReference_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_PassByReference_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") @@ -12197,12 +16279,11 @@ func (r *moqUsual_Times_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_ if r.sequence { last = struct { values *struct { - sResult string - err error + result1 *testmoqs.Results } sequence uint32 - doFn moqUsual_Times_doFn - doReturnFn moqUsual_Times_doReturnFn + doFn moqUsual_PassByReference_doFn + doReturnFn moqUsual_PassByReference_doReturnFn }{ values: last.values, sequence: r.moq.scene.NextRecorderSequence(), @@ -12213,141 +16294,76 @@ func (r *moqUsual_Times_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_ return r } -func (m *moqUsual) prettyParams_Times(params moqUsual_Times_params) string { - return fmt.Sprintf("Times(%#v, %#v)", params.sParam, params.times) +func (m *moqUsual) prettyParams_PassByReference(params moqUsual_PassByReference_params) string { + return fmt.Sprintf("PassByReference(%#v)", params.p) } -func (m *moqUsual) paramsKey_Times(params moqUsual_Times_params, anyParams uint64) moqUsual_Times_paramsKey { +func (m *moqUsual) paramsKey_PassByReference(params moqUsual_PassByReference_params, anyParams uint64) moqUsual_PassByReference_paramsKey { m.scene.T.Helper() - var sParamUsed string - var sParamUsedHash hash.Hash + var pUsed *testmoqs.Params + var pUsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.runtime.parameterIndexing.Times.sParam == moq.ParamIndexByValue { - sParamUsed = params.sParam - } else { - sParamUsedHash = hash.DeepHash(params.sParam) - } - } - var timesUsed bool - var timesUsedHash hash.Hash - if anyParams&(1<<1) == 0 { - if m.runtime.parameterIndexing.Times.times == moq.ParamIndexByValue { - timesUsed = params.times + if m.runtime.parameterIndexing.PassByReference.p == moq.ParamIndexByValue { + pUsed = params.p } else { - timesUsedHash = hash.DeepHash(params.times) + pUsedHash = hash.DeepHash(params.p) } } - return moqUsual_Times_paramsKey{ - params: struct { - sParam string - times bool - }{ - sParam: sParamUsed, - times: timesUsed, - }, - hashes: struct { - sParam hash.Hash - times hash.Hash - }{ - sParam: sParamUsedHash, - times: timesUsedHash, + return moqUsual_PassByReference_paramsKey{ + params: struct{ p *testmoqs.Params }{ + p: pUsed, + }, + hashes: struct{ p hash.Hash }{ + p: pUsedHash, }, } } -func (m *moqUsual_recorder) DifficultParamNames(param1, param2 bool, param3 string, param, param5, param6 int, param7, param8, param9 float32) *moqUsual_DifficultParamNames_fnRecorder { - return &moqUsual_DifficultParamNames_fnRecorder{ - params: moqUsual_DifficultParamNames_params{ - param1: param1, - param2: param2, - param3: param3, - param: param, - param5: param5, - param6: param6, - param7: param7, - param8: param8, - param9: param9, +func (m *moqUsual_recorder) PassBySlice(p []testmoqs.Params) *moqUsual_PassBySlice_fnRecorder { + return &moqUsual_PassBySlice_fnRecorder{ + params: moqUsual_PassBySlice_params{ + p: p, }, sequence: m.moq.config.Sequence == moq.SeqDefaultOn, moq: m.moq, } } -func (r *moqUsual_DifficultParamNames_fnRecorder) any() *moqUsual_DifficultParamNames_anyParams { +func (r *moqUsual_PassBySlice_fnRecorder) any() *moqUsual_PassBySlice_anyParams { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_DifficultParamNames(r.params)) + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassBySlice(r.params)) return nil } - return &moqUsual_DifficultParamNames_anyParams{recorder: r} + return &moqUsual_PassBySlice_anyParams{recorder: r} } -func (a *moqUsual_DifficultParamNames_anyParams) param1() *moqUsual_DifficultParamNames_fnRecorder { +func (a *moqUsual_PassBySlice_anyParams) p() *moqUsual_PassBySlice_fnRecorder { a.recorder.anyParams |= 1 << 0 return a.recorder } -func (a *moqUsual_DifficultParamNames_anyParams) param2() *moqUsual_DifficultParamNames_fnRecorder { - a.recorder.anyParams |= 1 << 1 - return a.recorder -} - -func (a *moqUsual_DifficultParamNames_anyParams) param3() *moqUsual_DifficultParamNames_fnRecorder { - a.recorder.anyParams |= 1 << 2 - return a.recorder -} - -func (a *moqUsual_DifficultParamNames_anyParams) param() *moqUsual_DifficultParamNames_fnRecorder { - a.recorder.anyParams |= 1 << 3 - return a.recorder -} - -func (a *moqUsual_DifficultParamNames_anyParams) param5() *moqUsual_DifficultParamNames_fnRecorder { - a.recorder.anyParams |= 1 << 4 - return a.recorder -} - -func (a *moqUsual_DifficultParamNames_anyParams) param6() *moqUsual_DifficultParamNames_fnRecorder { - a.recorder.anyParams |= 1 << 5 - return a.recorder -} - -func (a *moqUsual_DifficultParamNames_anyParams) param7() *moqUsual_DifficultParamNames_fnRecorder { - a.recorder.anyParams |= 1 << 6 - return a.recorder -} - -func (a *moqUsual_DifficultParamNames_anyParams) param8() *moqUsual_DifficultParamNames_fnRecorder { - a.recorder.anyParams |= 1 << 7 - return a.recorder -} - -func (a *moqUsual_DifficultParamNames_anyParams) param9() *moqUsual_DifficultParamNames_fnRecorder { - a.recorder.anyParams |= 1 << 8 - return a.recorder -} - -func (r *moqUsual_DifficultParamNames_fnRecorder) seq() *moqUsual_DifficultParamNames_fnRecorder { +func (r *moqUsual_PassBySlice_fnRecorder) seq() *moqUsual_PassBySlice_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_DifficultParamNames(r.params)) + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassBySlice(r.params)) return nil } r.sequence = true return r } -func (r *moqUsual_DifficultParamNames_fnRecorder) noSeq() *moqUsual_DifficultParamNames_fnRecorder { +func (r *moqUsual_PassBySlice_fnRecorder) noSeq() *moqUsual_PassBySlice_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_DifficultParamNames(r.params)) + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassBySlice(r.params)) return nil } r.sequence = false return r } -func (r *moqUsual_DifficultParamNames_fnRecorder) returnResults() *moqUsual_DifficultParamNames_fnRecorder { +func (r *moqUsual_PassBySlice_fnRecorder) returnResults(result1 []testmoqs.Results) *moqUsual_PassBySlice_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -12357,18 +16373,24 @@ func (r *moqUsual_DifficultParamNames_fnRecorder) returnResults() *moqUsual_Diff } r.results.results = append(r.results.results, struct { - values *struct{} + values *struct { + result1 []testmoqs.Results + } sequence uint32 - doFn moqUsual_DifficultParamNames_doFn - doReturnFn moqUsual_DifficultParamNames_doReturnFn + doFn moqUsual_PassBySlice_doFn + doReturnFn moqUsual_PassBySlice_doReturnFn }{ - values: &struct{}{}, + values: &struct { + result1 []testmoqs.Results + }{ + result1: result1, + }, sequence: sequence, }) return r } -func (r *moqUsual_DifficultParamNames_fnRecorder) andDo(fn moqUsual_DifficultParamNames_doFn) *moqUsual_DifficultParamNames_fnRecorder { +func (r *moqUsual_PassBySlice_fnRecorder) andDo(fn moqUsual_PassBySlice_doFn) *moqUsual_PassBySlice_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") @@ -12379,7 +16401,7 @@ func (r *moqUsual_DifficultParamNames_fnRecorder) andDo(fn moqUsual_DifficultPar return r } -func (r *moqUsual_DifficultParamNames_fnRecorder) doReturnResults(fn moqUsual_DifficultParamNames_doReturnFn) *moqUsual_DifficultParamNames_fnRecorder { +func (r *moqUsual_PassBySlice_fnRecorder) doReturnResults(fn moqUsual_PassBySlice_doReturnFn) *moqUsual_PassBySlice_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -12389,15 +16411,17 @@ func (r *moqUsual_DifficultParamNames_fnRecorder) doReturnResults(fn moqUsual_Di } r.results.results = append(r.results.results, struct { - values *struct{} + values *struct { + result1 []testmoqs.Results + } sequence uint32 - doFn moqUsual_DifficultParamNames_doFn - doReturnFn moqUsual_DifficultParamNames_doReturnFn + doFn moqUsual_PassBySlice_doFn + doReturnFn moqUsual_PassBySlice_doReturnFn }{sequence: sequence, doReturnFn: fn}) return r } -func (r *moqUsual_DifficultParamNames_fnRecorder) findResults() { +func (r *moqUsual_PassBySlice_fnRecorder) findResults() { r.moq.scene.T.Helper() if r.results != nil { r.results.repeat.Increment(r.moq.scene.T) @@ -12406,8 +16430,8 @@ func (r *moqUsual_DifficultParamNames_fnRecorder) findResults() { anyCount := bits.OnesCount64(r.anyParams) insertAt := -1 - var results *moqUsual_DifficultParamNames_resultsByParams - for n, res := range r.moq.resultsByParams_DifficultParamNames { + var results *moqUsual_PassBySlice_resultsByParams + for n, res := range r.moq.resultsByParams_PassBySlice { if res.anyParams == r.anyParams { results = &res break @@ -12417,24 +16441,24 @@ func (r *moqUsual_DifficultParamNames_fnRecorder) findResults() { } } if results == nil { - results = &moqUsual_DifficultParamNames_resultsByParams{ + results = &moqUsual_PassBySlice_resultsByParams{ anyCount: anyCount, anyParams: r.anyParams, - results: map[moqUsual_DifficultParamNames_paramsKey]*moqUsual_DifficultParamNames_results{}, + results: map[moqUsual_PassBySlice_paramsKey]*moqUsual_PassBySlice_results{}, } - r.moq.resultsByParams_DifficultParamNames = append(r.moq.resultsByParams_DifficultParamNames, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_DifficultParamNames) { - copy(r.moq.resultsByParams_DifficultParamNames[insertAt+1:], r.moq.resultsByParams_DifficultParamNames[insertAt:0]) - r.moq.resultsByParams_DifficultParamNames[insertAt] = *results + r.moq.resultsByParams_PassBySlice = append(r.moq.resultsByParams_PassBySlice, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_PassBySlice) { + copy(r.moq.resultsByParams_PassBySlice[insertAt+1:], r.moq.resultsByParams_PassBySlice[insertAt:0]) + r.moq.resultsByParams_PassBySlice[insertAt] = *results } } - paramsKey := r.moq.paramsKey_DifficultParamNames(r.params, r.anyParams) + paramsKey := r.moq.paramsKey_PassBySlice(r.params, r.anyParams) var ok bool r.results, ok = results.results[paramsKey] if !ok { - r.results = &moqUsual_DifficultParamNames_results{ + r.results = &moqUsual_PassBySlice_results{ params: r.params, results: nil, index: 0, @@ -12446,7 +16470,7 @@ func (r *moqUsual_DifficultParamNames_fnRecorder) findResults() { r.results.repeat.Increment(r.moq.scene.T) } -func (r *moqUsual_DifficultParamNames_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_DifficultParamNames_fnRecorder { +func (r *moqUsual_PassBySlice_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_PassBySlice_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") @@ -12457,10 +16481,12 @@ func (r *moqUsual_DifficultParamNames_fnRecorder) repeat(repeaters ...moq.Repeat for n := 0; n < r.results.repeat.ResultCount-1; n++ { if r.sequence { last = struct { - values *struct{} + values *struct { + result1 []testmoqs.Results + } sequence uint32 - doFn moqUsual_DifficultParamNames_doFn - doReturnFn moqUsual_DifficultParamNames_doReturnFn + doFn moqUsual_PassBySlice_doFn + doReturnFn moqUsual_PassBySlice_doReturnFn }{ values: last.values, sequence: r.moq.scene.NextRecorderSequence(), @@ -12471,167 +16497,72 @@ func (r *moqUsual_DifficultParamNames_fnRecorder) repeat(repeaters ...moq.Repeat return r } -func (m *moqUsual) prettyParams_DifficultParamNames(params moqUsual_DifficultParamNames_params) string { - return fmt.Sprintf("DifficultParamNames(%#v, %#v, %#v, %#v, %#v, %#v, %#v, %#v, %#v)", params.param1, params.param2, params.param3, params.param, params.param5, params.param6, params.param7, params.param8, params.param9) +func (m *moqUsual) prettyParams_PassBySlice(params moqUsual_PassBySlice_params) string { + return fmt.Sprintf("PassBySlice(%#v)", params.p) } -func (m *moqUsual) paramsKey_DifficultParamNames(params moqUsual_DifficultParamNames_params, anyParams uint64) moqUsual_DifficultParamNames_paramsKey { +func (m *moqUsual) paramsKey_PassBySlice(params moqUsual_PassBySlice_params, anyParams uint64) moqUsual_PassBySlice_paramsKey { m.scene.T.Helper() - var param1Used bool - var param1UsedHash hash.Hash + var pUsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.runtime.parameterIndexing.DifficultParamNames.param1 == moq.ParamIndexByValue { - param1Used = params.param1 - } else { - param1UsedHash = hash.DeepHash(params.param1) - } - } - var param2Used bool - var param2UsedHash hash.Hash - if anyParams&(1<<1) == 0 { - if m.runtime.parameterIndexing.DifficultParamNames.param2 == moq.ParamIndexByValue { - param2Used = params.param2 - } else { - param2UsedHash = hash.DeepHash(params.param2) - } - } - var param3Used string - var param3UsedHash hash.Hash - if anyParams&(1<<2) == 0 { - if m.runtime.parameterIndexing.DifficultParamNames.param3 == moq.ParamIndexByValue { - param3Used = params.param3 - } else { - param3UsedHash = hash.DeepHash(params.param3) - } - } - var paramUsed int - var paramUsedHash hash.Hash - if anyParams&(1<<3) == 0 { - if m.runtime.parameterIndexing.DifficultParamNames.param == moq.ParamIndexByValue { - paramUsed = params.param - } else { - paramUsedHash = hash.DeepHash(params.param) - } - } - var param5Used int - var param5UsedHash hash.Hash - if anyParams&(1<<4) == 0 { - if m.runtime.parameterIndexing.DifficultParamNames.param5 == moq.ParamIndexByValue { - param5Used = params.param5 - } else { - param5UsedHash = hash.DeepHash(params.param5) - } - } - var param6Used int - var param6UsedHash hash.Hash - if anyParams&(1<<5) == 0 { - if m.runtime.parameterIndexing.DifficultParamNames.param6 == moq.ParamIndexByValue { - param6Used = params.param6 - } else { - param6UsedHash = hash.DeepHash(params.param6) - } - } - var param7Used float32 - var param7UsedHash hash.Hash - if anyParams&(1<<6) == 0 { - if m.runtime.parameterIndexing.DifficultParamNames.param7 == moq.ParamIndexByValue { - param7Used = params.param7 - } else { - param7UsedHash = hash.DeepHash(params.param7) - } - } - var param8Used float32 - var param8UsedHash hash.Hash - if anyParams&(1<<7) == 0 { - if m.runtime.parameterIndexing.DifficultParamNames.param8 == moq.ParamIndexByValue { - param8Used = params.param8 - } else { - param8UsedHash = hash.DeepHash(params.param8) - } - } - var param9Used float32 - var param9UsedHash hash.Hash - if anyParams&(1<<8) == 0 { - if m.runtime.parameterIndexing.DifficultParamNames.param9 == moq.ParamIndexByValue { - param9Used = params.param9 - } else { - param9UsedHash = hash.DeepHash(params.param9) + if m.runtime.parameterIndexing.PassBySlice.p == moq.ParamIndexByValue { + m.scene.T.Fatalf("The p parameter of the PassBySlice function can't be indexed by value") } + pUsedHash = hash.DeepHash(params.p) } - return moqUsual_DifficultParamNames_paramsKey{ - params: struct { - param1, param2 bool - param3 string - param, param5, param6 int - param7, param8, param9 float32 - }{ - param1: param1Used, - param2: param2Used, - param3: param3Used, - param: paramUsed, - param5: param5Used, - param6: param6Used, - param7: param7Used, - param8: param8Used, - param9: param9Used, - }, - hashes: struct { - param1, param2 hash.Hash - param3 hash.Hash - param, param5, param6 hash.Hash - param7, param8, param9 hash.Hash - }{ - param1: param1UsedHash, - param2: param2UsedHash, - param3: param3UsedHash, - param: paramUsedHash, - param5: param5UsedHash, - param6: param6UsedHash, - param7: param7UsedHash, - param8: param8UsedHash, - param9: param9UsedHash, + return moqUsual_PassBySlice_paramsKey{ + params: struct{}{}, + hashes: struct{ p hash.Hash }{ + p: pUsedHash, }, } } -func (m *moqUsual_recorder) DifficultResultNames() *moqUsual_DifficultResultNames_fnRecorder { - return &moqUsual_DifficultResultNames_fnRecorder{ - params: moqUsual_DifficultResultNames_params{}, +func (m *moqUsual_recorder) PassByValue(p testmoqs.Params) *moqUsual_PassByValue_fnRecorder { + return &moqUsual_PassByValue_fnRecorder{ + params: moqUsual_PassByValue_params{ + p: p, + }, sequence: m.moq.config.Sequence == moq.SeqDefaultOn, moq: m.moq, } } -func (r *moqUsual_DifficultResultNames_fnRecorder) any() *moqUsual_DifficultResultNames_anyParams { +func (r *moqUsual_PassByValue_fnRecorder) any() *moqUsual_PassByValue_anyParams { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_DifficultResultNames(r.params)) + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByValue(r.params)) return nil } - return &moqUsual_DifficultResultNames_anyParams{recorder: r} + return &moqUsual_PassByValue_anyParams{recorder: r} } -func (r *moqUsual_DifficultResultNames_fnRecorder) seq() *moqUsual_DifficultResultNames_fnRecorder { +func (a *moqUsual_PassByValue_anyParams) p() *moqUsual_PassByValue_fnRecorder { + a.recorder.anyParams |= 1 << 0 + return a.recorder +} + +func (r *moqUsual_PassByValue_fnRecorder) seq() *moqUsual_PassByValue_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_DifficultResultNames(r.params)) + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByValue(r.params)) return nil } r.sequence = true return r } -func (r *moqUsual_DifficultResultNames_fnRecorder) noSeq() *moqUsual_DifficultResultNames_fnRecorder { +func (r *moqUsual_PassByValue_fnRecorder) noSeq() *moqUsual_PassByValue_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_DifficultResultNames(r.params)) + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByValue(r.params)) return nil } r.sequence = false return r } -func (r *moqUsual_DifficultResultNames_fnRecorder) returnResults(result1, result2 string, result3 error, param, result5, result6 int, result7, result8, result9 float32) *moqUsual_DifficultResultNames_fnRecorder { +func (r *moqUsual_PassByValue_fnRecorder) returnResults(result1 testmoqs.Results) *moqUsual_PassByValue_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -12642,37 +16573,23 @@ func (r *moqUsual_DifficultResultNames_fnRecorder) returnResults(result1, result r.results.results = append(r.results.results, struct { values *struct { - result1, result2 string - result3 error - param, result5, result6 int - result7, result8, result9 float32 + result1 testmoqs.Results } sequence uint32 - doFn moqUsual_DifficultResultNames_doFn - doReturnFn moqUsual_DifficultResultNames_doReturnFn + doFn moqUsual_PassByValue_doFn + doReturnFn moqUsual_PassByValue_doReturnFn }{ values: &struct { - result1, result2 string - result3 error - param, result5, result6 int - result7, result8, result9 float32 + result1 testmoqs.Results }{ result1: result1, - result2: result2, - result3: result3, - param: param, - result5: result5, - result6: result6, - result7: result7, - result8: result8, - result9: result9, }, sequence: sequence, }) return r } -func (r *moqUsual_DifficultResultNames_fnRecorder) andDo(fn moqUsual_DifficultResultNames_doFn) *moqUsual_DifficultResultNames_fnRecorder { +func (r *moqUsual_PassByValue_fnRecorder) andDo(fn moqUsual_PassByValue_doFn) *moqUsual_PassByValue_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") @@ -12683,7 +16600,7 @@ func (r *moqUsual_DifficultResultNames_fnRecorder) andDo(fn moqUsual_DifficultRe return r } -func (r *moqUsual_DifficultResultNames_fnRecorder) doReturnResults(fn moqUsual_DifficultResultNames_doReturnFn) *moqUsual_DifficultResultNames_fnRecorder { +func (r *moqUsual_PassByValue_fnRecorder) doReturnResults(fn moqUsual_PassByValue_doReturnFn) *moqUsual_PassByValue_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -12694,19 +16611,16 @@ func (r *moqUsual_DifficultResultNames_fnRecorder) doReturnResults(fn moqUsual_D r.results.results = append(r.results.results, struct { values *struct { - result1, result2 string - result3 error - param, result5, result6 int - result7, result8, result9 float32 + result1 testmoqs.Results } sequence uint32 - doFn moqUsual_DifficultResultNames_doFn - doReturnFn moqUsual_DifficultResultNames_doReturnFn + doFn moqUsual_PassByValue_doFn + doReturnFn moqUsual_PassByValue_doReturnFn }{sequence: sequence, doReturnFn: fn}) return r } -func (r *moqUsual_DifficultResultNames_fnRecorder) findResults() { +func (r *moqUsual_PassByValue_fnRecorder) findResults() { r.moq.scene.T.Helper() if r.results != nil { r.results.repeat.Increment(r.moq.scene.T) @@ -12715,8 +16629,8 @@ func (r *moqUsual_DifficultResultNames_fnRecorder) findResults() { anyCount := bits.OnesCount64(r.anyParams) insertAt := -1 - var results *moqUsual_DifficultResultNames_resultsByParams - for n, res := range r.moq.resultsByParams_DifficultResultNames { + var results *moqUsual_PassByValue_resultsByParams + for n, res := range r.moq.resultsByParams_PassByValue { if res.anyParams == r.anyParams { results = &res break @@ -12726,24 +16640,24 @@ func (r *moqUsual_DifficultResultNames_fnRecorder) findResults() { } } if results == nil { - results = &moqUsual_DifficultResultNames_resultsByParams{ + results = &moqUsual_PassByValue_resultsByParams{ anyCount: anyCount, anyParams: r.anyParams, - results: map[moqUsual_DifficultResultNames_paramsKey]*moqUsual_DifficultResultNames_results{}, + results: map[moqUsual_PassByValue_paramsKey]*moqUsual_PassByValue_results{}, } - r.moq.resultsByParams_DifficultResultNames = append(r.moq.resultsByParams_DifficultResultNames, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_DifficultResultNames) { - copy(r.moq.resultsByParams_DifficultResultNames[insertAt+1:], r.moq.resultsByParams_DifficultResultNames[insertAt:0]) - r.moq.resultsByParams_DifficultResultNames[insertAt] = *results + r.moq.resultsByParams_PassByValue = append(r.moq.resultsByParams_PassByValue, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_PassByValue) { + copy(r.moq.resultsByParams_PassByValue[insertAt+1:], r.moq.resultsByParams_PassByValue[insertAt:0]) + r.moq.resultsByParams_PassByValue[insertAt] = *results } } - paramsKey := r.moq.paramsKey_DifficultResultNames(r.params, r.anyParams) + paramsKey := r.moq.paramsKey_PassByValue(r.params, r.anyParams) var ok bool r.results, ok = results.results[paramsKey] if !ok { - r.results = &moqUsual_DifficultResultNames_results{ + r.results = &moqUsual_PassByValue_results{ params: r.params, results: nil, index: 0, @@ -12755,7 +16669,7 @@ func (r *moqUsual_DifficultResultNames_fnRecorder) findResults() { r.results.repeat.Increment(r.moq.scene.T) } -func (r *moqUsual_DifficultResultNames_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_DifficultResultNames_fnRecorder { +func (r *moqUsual_PassByValue_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_PassByValue_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") @@ -12767,14 +16681,11 @@ func (r *moqUsual_DifficultResultNames_fnRecorder) repeat(repeaters ...moq.Repea if r.sequence { last = struct { values *struct { - result1, result2 string - result3 error - param, result5, result6 int - result7, result8, result9 float32 + result1 testmoqs.Results } sequence uint32 - doFn moqUsual_DifficultResultNames_doFn - doReturnFn moqUsual_DifficultResultNames_doReturnFn + doFn moqUsual_PassByValue_doFn + doReturnFn moqUsual_PassByValue_doReturnFn }{ values: last.values, sequence: r.moq.scene.NextRecorderSequence(), @@ -12785,63 +16696,76 @@ func (r *moqUsual_DifficultResultNames_fnRecorder) repeat(repeaters ...moq.Repea return r } -func (m *moqUsual) prettyParams_DifficultResultNames(params moqUsual_DifficultResultNames_params) string { - return fmt.Sprintf("DifficultResultNames()") +func (m *moqUsual) prettyParams_PassByValue(params moqUsual_PassByValue_params) string { + return fmt.Sprintf("PassByValue(%#v)", params.p) } -func (m *moqUsual) paramsKey_DifficultResultNames(params moqUsual_DifficultResultNames_params, anyParams uint64) moqUsual_DifficultResultNames_paramsKey { +func (m *moqUsual) paramsKey_PassByValue(params moqUsual_PassByValue_params, anyParams uint64) moqUsual_PassByValue_paramsKey { m.scene.T.Helper() - return moqUsual_DifficultResultNames_paramsKey{ - params: struct{}{}, - hashes: struct{}{}, + var pUsed testmoqs.Params + var pUsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.runtime.parameterIndexing.PassByValue.p == moq.ParamIndexByValue { + pUsed = params.p + } else { + pUsedHash = hash.DeepHash(params.p) + } + } + return moqUsual_PassByValue_paramsKey{ + params: struct{ p testmoqs.Params }{ + p: pUsed, + }, + hashes: struct{ p hash.Hash }{ + p: pUsedHash, + }, } } -func (m *moqUsual_recorder) PassByArray(p [3]testmoqs.Params) *moqUsual_PassByArray_fnRecorder { - return &moqUsual_PassByArray_fnRecorder{ - params: moqUsual_PassByArray_params{ - p: p, +func (m *moqUsual_recorder) InterfaceParam(w io.Writer) *moqUsual_InterfaceParam_fnRecorder { + return &moqUsual_InterfaceParam_fnRecorder{ + params: moqUsual_InterfaceParam_params{ + w: w, }, sequence: m.moq.config.Sequence == moq.SeqDefaultOn, moq: m.moq, } } -func (r *moqUsual_PassByArray_fnRecorder) any() *moqUsual_PassByArray_anyParams { +func (r *moqUsual_InterfaceParam_fnRecorder) any() *moqUsual_InterfaceParam_anyParams { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByArray(r.params)) + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_InterfaceParam(r.params)) return nil } - return &moqUsual_PassByArray_anyParams{recorder: r} + return &moqUsual_InterfaceParam_anyParams{recorder: r} } -func (a *moqUsual_PassByArray_anyParams) p() *moqUsual_PassByArray_fnRecorder { +func (a *moqUsual_InterfaceParam_anyParams) w() *moqUsual_InterfaceParam_fnRecorder { a.recorder.anyParams |= 1 << 0 return a.recorder } -func (r *moqUsual_PassByArray_fnRecorder) seq() *moqUsual_PassByArray_fnRecorder { +func (r *moqUsual_InterfaceParam_fnRecorder) seq() *moqUsual_InterfaceParam_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByArray(r.params)) + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_InterfaceParam(r.params)) return nil } r.sequence = true return r } -func (r *moqUsual_PassByArray_fnRecorder) noSeq() *moqUsual_PassByArray_fnRecorder { +func (r *moqUsual_InterfaceParam_fnRecorder) noSeq() *moqUsual_InterfaceParam_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByArray(r.params)) + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_InterfaceParam(r.params)) return nil } r.sequence = false return r } -func (r *moqUsual_PassByArray_fnRecorder) returnResults(result1 [3]testmoqs.Results) *moqUsual_PassByArray_fnRecorder { +func (r *moqUsual_InterfaceParam_fnRecorder) returnResults(sResult string, err error) *moqUsual_InterfaceParam_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -12852,23 +16776,26 @@ func (r *moqUsual_PassByArray_fnRecorder) returnResults(result1 [3]testmoqs.Resu r.results.results = append(r.results.results, struct { values *struct { - result1 [3]testmoqs.Results + sResult string + err error } sequence uint32 - doFn moqUsual_PassByArray_doFn - doReturnFn moqUsual_PassByArray_doReturnFn + doFn moqUsual_InterfaceParam_doFn + doReturnFn moqUsual_InterfaceParam_doReturnFn }{ values: &struct { - result1 [3]testmoqs.Results + sResult string + err error }{ - result1: result1, + sResult: sResult, + err: err, }, sequence: sequence, }) return r } -func (r *moqUsual_PassByArray_fnRecorder) andDo(fn moqUsual_PassByArray_doFn) *moqUsual_PassByArray_fnRecorder { +func (r *moqUsual_InterfaceParam_fnRecorder) andDo(fn moqUsual_InterfaceParam_doFn) *moqUsual_InterfaceParam_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") @@ -12879,7 +16806,7 @@ func (r *moqUsual_PassByArray_fnRecorder) andDo(fn moqUsual_PassByArray_doFn) *m return r } -func (r *moqUsual_PassByArray_fnRecorder) doReturnResults(fn moqUsual_PassByArray_doReturnFn) *moqUsual_PassByArray_fnRecorder { +func (r *moqUsual_InterfaceParam_fnRecorder) doReturnResults(fn moqUsual_InterfaceParam_doReturnFn) *moqUsual_InterfaceParam_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -12890,16 +16817,17 @@ func (r *moqUsual_PassByArray_fnRecorder) doReturnResults(fn moqUsual_PassByArra r.results.results = append(r.results.results, struct { values *struct { - result1 [3]testmoqs.Results + sResult string + err error } sequence uint32 - doFn moqUsual_PassByArray_doFn - doReturnFn moqUsual_PassByArray_doReturnFn + doFn moqUsual_InterfaceParam_doFn + doReturnFn moqUsual_InterfaceParam_doReturnFn }{sequence: sequence, doReturnFn: fn}) return r } -func (r *moqUsual_PassByArray_fnRecorder) findResults() { +func (r *moqUsual_InterfaceParam_fnRecorder) findResults() { r.moq.scene.T.Helper() if r.results != nil { r.results.repeat.Increment(r.moq.scene.T) @@ -12908,8 +16836,8 @@ func (r *moqUsual_PassByArray_fnRecorder) findResults() { anyCount := bits.OnesCount64(r.anyParams) insertAt := -1 - var results *moqUsual_PassByArray_resultsByParams - for n, res := range r.moq.resultsByParams_PassByArray { + var results *moqUsual_InterfaceParam_resultsByParams + for n, res := range r.moq.resultsByParams_InterfaceParam { if res.anyParams == r.anyParams { results = &res break @@ -12919,24 +16847,24 @@ func (r *moqUsual_PassByArray_fnRecorder) findResults() { } } if results == nil { - results = &moqUsual_PassByArray_resultsByParams{ + results = &moqUsual_InterfaceParam_resultsByParams{ anyCount: anyCount, anyParams: r.anyParams, - results: map[moqUsual_PassByArray_paramsKey]*moqUsual_PassByArray_results{}, + results: map[moqUsual_InterfaceParam_paramsKey]*moqUsual_InterfaceParam_results{}, } - r.moq.resultsByParams_PassByArray = append(r.moq.resultsByParams_PassByArray, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_PassByArray) { - copy(r.moq.resultsByParams_PassByArray[insertAt+1:], r.moq.resultsByParams_PassByArray[insertAt:0]) - r.moq.resultsByParams_PassByArray[insertAt] = *results + r.moq.resultsByParams_InterfaceParam = append(r.moq.resultsByParams_InterfaceParam, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_InterfaceParam) { + copy(r.moq.resultsByParams_InterfaceParam[insertAt+1:], r.moq.resultsByParams_InterfaceParam[insertAt:0]) + r.moq.resultsByParams_InterfaceParam[insertAt] = *results } } - paramsKey := r.moq.paramsKey_PassByArray(r.params, r.anyParams) + paramsKey := r.moq.paramsKey_InterfaceParam(r.params, r.anyParams) var ok bool r.results, ok = results.results[paramsKey] if !ok { - r.results = &moqUsual_PassByArray_results{ + r.results = &moqUsual_InterfaceParam_results{ params: r.params, results: nil, index: 0, @@ -12948,7 +16876,7 @@ func (r *moqUsual_PassByArray_fnRecorder) findResults() { r.results.repeat.Increment(r.moq.scene.T) } -func (r *moqUsual_PassByArray_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_PassByArray_fnRecorder { +func (r *moqUsual_InterfaceParam_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_InterfaceParam_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") @@ -12960,11 +16888,12 @@ func (r *moqUsual_PassByArray_fnRecorder) repeat(repeaters ...moq.Repeater) *moq if r.sequence { last = struct { values *struct { - result1 [3]testmoqs.Results + sResult string + err error } sequence uint32 - doFn moqUsual_PassByArray_doFn - doReturnFn moqUsual_PassByArray_doReturnFn + doFn moqUsual_InterfaceParam_doFn + doReturnFn moqUsual_InterfaceParam_doReturnFn }{ values: last.values, sequence: r.moq.scene.NextRecorderSequence(), @@ -12975,76 +16904,82 @@ func (r *moqUsual_PassByArray_fnRecorder) repeat(repeaters ...moq.Repeater) *moq return r } -func (m *moqUsual) prettyParams_PassByArray(params moqUsual_PassByArray_params) string { - return fmt.Sprintf("PassByArray(%#v)", params.p) +func (m *moqUsual) prettyParams_InterfaceParam(params moqUsual_InterfaceParam_params) string { + return fmt.Sprintf("InterfaceParam(%#v)", params.w) } -func (m *moqUsual) paramsKey_PassByArray(params moqUsual_PassByArray_params, anyParams uint64) moqUsual_PassByArray_paramsKey { +func (m *moqUsual) paramsKey_InterfaceParam(params moqUsual_InterfaceParam_params, anyParams uint64) moqUsual_InterfaceParam_paramsKey { m.scene.T.Helper() - var pUsed [3]testmoqs.Params - var pUsedHash hash.Hash + var wUsed io.Writer + var wUsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.runtime.parameterIndexing.PassByArray.p == moq.ParamIndexByValue { - pUsed = params.p + if m.runtime.parameterIndexing.InterfaceParam.w == moq.ParamIndexByValue { + wUsed = params.w } else { - pUsedHash = hash.DeepHash(params.p) + wUsedHash = hash.DeepHash(params.w) } } - return moqUsual_PassByArray_paramsKey{ - params: struct{ p [3]testmoqs.Params }{ - p: pUsed, + return moqUsual_InterfaceParam_paramsKey{ + params: struct{ w io.Writer }{ + w: wUsed, }, - hashes: struct{ p hash.Hash }{ - p: pUsedHash, + hashes: struct{ w hash.Hash }{ + w: wUsedHash, }, } } -func (m *moqUsual_recorder) PassByChan(p chan testmoqs.Params) *moqUsual_PassByChan_fnRecorder { - return &moqUsual_PassByChan_fnRecorder{ - params: moqUsual_PassByChan_params{ - p: p, +func (m *moqUsual_recorder) InterfaceResult(sParam string, bParam bool) *moqUsual_InterfaceResult_fnRecorder { + return &moqUsual_InterfaceResult_fnRecorder{ + params: moqUsual_InterfaceResult_params{ + sParam: sParam, + bParam: bParam, }, sequence: m.moq.config.Sequence == moq.SeqDefaultOn, moq: m.moq, } } -func (r *moqUsual_PassByChan_fnRecorder) any() *moqUsual_PassByChan_anyParams { +func (r *moqUsual_InterfaceResult_fnRecorder) any() *moqUsual_InterfaceResult_anyParams { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByChan(r.params)) + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_InterfaceResult(r.params)) return nil } - return &moqUsual_PassByChan_anyParams{recorder: r} + return &moqUsual_InterfaceResult_anyParams{recorder: r} } -func (a *moqUsual_PassByChan_anyParams) p() *moqUsual_PassByChan_fnRecorder { +func (a *moqUsual_InterfaceResult_anyParams) sParam() *moqUsual_InterfaceResult_fnRecorder { a.recorder.anyParams |= 1 << 0 return a.recorder } -func (r *moqUsual_PassByChan_fnRecorder) seq() *moqUsual_PassByChan_fnRecorder { +func (a *moqUsual_InterfaceResult_anyParams) bParam() *moqUsual_InterfaceResult_fnRecorder { + a.recorder.anyParams |= 1 << 1 + return a.recorder +} + +func (r *moqUsual_InterfaceResult_fnRecorder) seq() *moqUsual_InterfaceResult_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByChan(r.params)) + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_InterfaceResult(r.params)) return nil } r.sequence = true return r } -func (r *moqUsual_PassByChan_fnRecorder) noSeq() *moqUsual_PassByChan_fnRecorder { +func (r *moqUsual_InterfaceResult_fnRecorder) noSeq() *moqUsual_InterfaceResult_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByChan(r.params)) + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_InterfaceResult(r.params)) return nil } r.sequence = false return r } -func (r *moqUsual_PassByChan_fnRecorder) returnResults(result1 chan testmoqs.Results) *moqUsual_PassByChan_fnRecorder { +func (r *moqUsual_InterfaceResult_fnRecorder) returnResults(result1 io.Reader) *moqUsual_InterfaceResult_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -13054,16 +16989,12 @@ func (r *moqUsual_PassByChan_fnRecorder) returnResults(result1 chan testmoqs.Res } r.results.results = append(r.results.results, struct { - values *struct { - result1 chan testmoqs.Results - } + values *struct{ result1 io.Reader } sequence uint32 - doFn moqUsual_PassByChan_doFn - doReturnFn moqUsual_PassByChan_doReturnFn + doFn moqUsual_InterfaceResult_doFn + doReturnFn moqUsual_InterfaceResult_doReturnFn }{ - values: &struct { - result1 chan testmoqs.Results - }{ + values: &struct{ result1 io.Reader }{ result1: result1, }, sequence: sequence, @@ -13071,7 +17002,7 @@ func (r *moqUsual_PassByChan_fnRecorder) returnResults(result1 chan testmoqs.Res return r } -func (r *moqUsual_PassByChan_fnRecorder) andDo(fn moqUsual_PassByChan_doFn) *moqUsual_PassByChan_fnRecorder { +func (r *moqUsual_InterfaceResult_fnRecorder) andDo(fn moqUsual_InterfaceResult_doFn) *moqUsual_InterfaceResult_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") @@ -13082,7 +17013,7 @@ func (r *moqUsual_PassByChan_fnRecorder) andDo(fn moqUsual_PassByChan_doFn) *moq return r } -func (r *moqUsual_PassByChan_fnRecorder) doReturnResults(fn moqUsual_PassByChan_doReturnFn) *moqUsual_PassByChan_fnRecorder { +func (r *moqUsual_InterfaceResult_fnRecorder) doReturnResults(fn moqUsual_InterfaceResult_doReturnFn) *moqUsual_InterfaceResult_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -13092,17 +17023,15 @@ func (r *moqUsual_PassByChan_fnRecorder) doReturnResults(fn moqUsual_PassByChan_ } r.results.results = append(r.results.results, struct { - values *struct { - result1 chan testmoqs.Results - } + values *struct{ result1 io.Reader } sequence uint32 - doFn moqUsual_PassByChan_doFn - doReturnFn moqUsual_PassByChan_doReturnFn + doFn moqUsual_InterfaceResult_doFn + doReturnFn moqUsual_InterfaceResult_doReturnFn }{sequence: sequence, doReturnFn: fn}) return r } -func (r *moqUsual_PassByChan_fnRecorder) findResults() { +func (r *moqUsual_InterfaceResult_fnRecorder) findResults() { r.moq.scene.T.Helper() if r.results != nil { r.results.repeat.Increment(r.moq.scene.T) @@ -13111,8 +17040,8 @@ func (r *moqUsual_PassByChan_fnRecorder) findResults() { anyCount := bits.OnesCount64(r.anyParams) insertAt := -1 - var results *moqUsual_PassByChan_resultsByParams - for n, res := range r.moq.resultsByParams_PassByChan { + var results *moqUsual_InterfaceResult_resultsByParams + for n, res := range r.moq.resultsByParams_InterfaceResult { if res.anyParams == r.anyParams { results = &res break @@ -13122,24 +17051,24 @@ func (r *moqUsual_PassByChan_fnRecorder) findResults() { } } if results == nil { - results = &moqUsual_PassByChan_resultsByParams{ + results = &moqUsual_InterfaceResult_resultsByParams{ anyCount: anyCount, anyParams: r.anyParams, - results: map[moqUsual_PassByChan_paramsKey]*moqUsual_PassByChan_results{}, + results: map[moqUsual_InterfaceResult_paramsKey]*moqUsual_InterfaceResult_results{}, } - r.moq.resultsByParams_PassByChan = append(r.moq.resultsByParams_PassByChan, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_PassByChan) { - copy(r.moq.resultsByParams_PassByChan[insertAt+1:], r.moq.resultsByParams_PassByChan[insertAt:0]) - r.moq.resultsByParams_PassByChan[insertAt] = *results + r.moq.resultsByParams_InterfaceResult = append(r.moq.resultsByParams_InterfaceResult, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_InterfaceResult) { + copy(r.moq.resultsByParams_InterfaceResult[insertAt+1:], r.moq.resultsByParams_InterfaceResult[insertAt:0]) + r.moq.resultsByParams_InterfaceResult[insertAt] = *results } } - paramsKey := r.moq.paramsKey_PassByChan(r.params, r.anyParams) + paramsKey := r.moq.paramsKey_InterfaceResult(r.params, r.anyParams) var ok bool r.results, ok = results.results[paramsKey] if !ok { - r.results = &moqUsual_PassByChan_results{ + r.results = &moqUsual_InterfaceResult_results{ params: r.params, results: nil, index: 0, @@ -13151,7 +17080,7 @@ func (r *moqUsual_PassByChan_fnRecorder) findResults() { r.results.repeat.Increment(r.moq.scene.T) } -func (r *moqUsual_PassByChan_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_PassByChan_fnRecorder { +func (r *moqUsual_InterfaceResult_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_InterfaceResult_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") @@ -13162,12 +17091,10 @@ func (r *moqUsual_PassByChan_fnRecorder) repeat(repeaters ...moq.Repeater) *moqU for n := 0; n < r.results.repeat.ResultCount-1; n++ { if r.sequence { last = struct { - values *struct { - result1 chan testmoqs.Results - } + values *struct{ result1 io.Reader } sequence uint32 - doFn moqUsual_PassByChan_doFn - doReturnFn moqUsual_PassByChan_doReturnFn + doFn moqUsual_InterfaceResult_doFn + doReturnFn moqUsual_InterfaceResult_doReturnFn }{ values: last.values, sequence: r.moq.scene.NextRecorderSequence(), @@ -13178,76 +17105,93 @@ func (r *moqUsual_PassByChan_fnRecorder) repeat(repeaters ...moq.Repeater) *moqU return r } -func (m *moqUsual) prettyParams_PassByChan(params moqUsual_PassByChan_params) string { - return fmt.Sprintf("PassByChan(%#v)", params.p) +func (m *moqUsual) prettyParams_InterfaceResult(params moqUsual_InterfaceResult_params) string { + return fmt.Sprintf("InterfaceResult(%#v, %#v)", params.sParam, params.bParam) } -func (m *moqUsual) paramsKey_PassByChan(params moqUsual_PassByChan_params, anyParams uint64) moqUsual_PassByChan_paramsKey { +func (m *moqUsual) paramsKey_InterfaceResult(params moqUsual_InterfaceResult_params, anyParams uint64) moqUsual_InterfaceResult_paramsKey { m.scene.T.Helper() - var pUsed chan testmoqs.Params - var pUsedHash hash.Hash + var sParamUsed string + var sParamUsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.runtime.parameterIndexing.PassByChan.p == moq.ParamIndexByValue { - pUsed = params.p + if m.runtime.parameterIndexing.InterfaceResult.sParam == moq.ParamIndexByValue { + sParamUsed = params.sParam } else { - pUsedHash = hash.DeepHash(params.p) + sParamUsedHash = hash.DeepHash(params.sParam) } } - return moqUsual_PassByChan_paramsKey{ - params: struct{ p chan testmoqs.Params }{ - p: pUsed, + var bParamUsed bool + var bParamUsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.runtime.parameterIndexing.InterfaceResult.bParam == moq.ParamIndexByValue { + bParamUsed = params.bParam + } else { + bParamUsedHash = hash.DeepHash(params.bParam) + } + } + return moqUsual_InterfaceResult_paramsKey{ + params: struct { + sParam string + bParam bool + }{ + sParam: sParamUsed, + bParam: bParamUsed, }, - hashes: struct{ p hash.Hash }{ - p: pUsedHash, + hashes: struct { + sParam hash.Hash + bParam hash.Hash + }{ + sParam: sParamUsedHash, + bParam: bParamUsedHash, }, } } -func (m *moqUsual_recorder) PassByEllipsis(p ...testmoqs.Params) *moqUsual_PassByEllipsis_fnRecorder { - return &moqUsual_PassByEllipsis_fnRecorder{ - params: moqUsual_PassByEllipsis_params{ - p: p, +func (m *moqUsual_recorder) FnParam(fn func()) *moqUsual_FnParam_fnRecorder { + return &moqUsual_FnParam_fnRecorder{ + params: moqUsual_FnParam_params{ + fn: fn, }, sequence: m.moq.config.Sequence == moq.SeqDefaultOn, moq: m.moq, } } -func (r *moqUsual_PassByEllipsis_fnRecorder) any() *moqUsual_PassByEllipsis_anyParams { +func (r *moqUsual_FnParam_fnRecorder) any() *moqUsual_FnParam_anyParams { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByEllipsis(r.params)) + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_FnParam(r.params)) return nil } - return &moqUsual_PassByEllipsis_anyParams{recorder: r} + return &moqUsual_FnParam_anyParams{recorder: r} } -func (a *moqUsual_PassByEllipsis_anyParams) p() *moqUsual_PassByEllipsis_fnRecorder { +func (a *moqUsual_FnParam_anyParams) fn() *moqUsual_FnParam_fnRecorder { a.recorder.anyParams |= 1 << 0 return a.recorder } -func (r *moqUsual_PassByEllipsis_fnRecorder) seq() *moqUsual_PassByEllipsis_fnRecorder { +func (r *moqUsual_FnParam_fnRecorder) seq() *moqUsual_FnParam_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByEllipsis(r.params)) + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_FnParam(r.params)) return nil } r.sequence = true return r } -func (r *moqUsual_PassByEllipsis_fnRecorder) noSeq() *moqUsual_PassByEllipsis_fnRecorder { +func (r *moqUsual_FnParam_fnRecorder) noSeq() *moqUsual_FnParam_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByEllipsis(r.params)) + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_FnParam(r.params)) return nil } r.sequence = false return r } -func (r *moqUsual_PassByEllipsis_fnRecorder) returnResults(result1 string, result2 error) *moqUsual_PassByEllipsis_fnRecorder { +func (r *moqUsual_FnParam_fnRecorder) returnResults() *moqUsual_FnParam_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -13257,27 +17201,18 @@ func (r *moqUsual_PassByEllipsis_fnRecorder) returnResults(result1 string, resul } r.results.results = append(r.results.results, struct { - values *struct { - result1 string - result2 error - } + values *struct{} sequence uint32 - doFn moqUsual_PassByEllipsis_doFn - doReturnFn moqUsual_PassByEllipsis_doReturnFn + doFn moqUsual_FnParam_doFn + doReturnFn moqUsual_FnParam_doReturnFn }{ - values: &struct { - result1 string - result2 error - }{ - result1: result1, - result2: result2, - }, + values: &struct{}{}, sequence: sequence, }) return r } -func (r *moqUsual_PassByEllipsis_fnRecorder) andDo(fn moqUsual_PassByEllipsis_doFn) *moqUsual_PassByEllipsis_fnRecorder { +func (r *moqUsual_FnParam_fnRecorder) andDo(fn moqUsual_FnParam_doFn) *moqUsual_FnParam_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") @@ -13288,7 +17223,7 @@ func (r *moqUsual_PassByEllipsis_fnRecorder) andDo(fn moqUsual_PassByEllipsis_do return r } -func (r *moqUsual_PassByEllipsis_fnRecorder) doReturnResults(fn moqUsual_PassByEllipsis_doReturnFn) *moqUsual_PassByEllipsis_fnRecorder { +func (r *moqUsual_FnParam_fnRecorder) doReturnResults(fn moqUsual_FnParam_doReturnFn) *moqUsual_FnParam_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -13298,18 +17233,15 @@ func (r *moqUsual_PassByEllipsis_fnRecorder) doReturnResults(fn moqUsual_PassByE } r.results.results = append(r.results.results, struct { - values *struct { - result1 string - result2 error - } + values *struct{} sequence uint32 - doFn moqUsual_PassByEllipsis_doFn - doReturnFn moqUsual_PassByEllipsis_doReturnFn + doFn moqUsual_FnParam_doFn + doReturnFn moqUsual_FnParam_doReturnFn }{sequence: sequence, doReturnFn: fn}) return r } -func (r *moqUsual_PassByEllipsis_fnRecorder) findResults() { +func (r *moqUsual_FnParam_fnRecorder) findResults() { r.moq.scene.T.Helper() if r.results != nil { r.results.repeat.Increment(r.moq.scene.T) @@ -13318,8 +17250,8 @@ func (r *moqUsual_PassByEllipsis_fnRecorder) findResults() { anyCount := bits.OnesCount64(r.anyParams) insertAt := -1 - var results *moqUsual_PassByEllipsis_resultsByParams - for n, res := range r.moq.resultsByParams_PassByEllipsis { + var results *moqUsual_FnParam_resultsByParams + for n, res := range r.moq.resultsByParams_FnParam { if res.anyParams == r.anyParams { results = &res break @@ -13329,24 +17261,24 @@ func (r *moqUsual_PassByEllipsis_fnRecorder) findResults() { } } if results == nil { - results = &moqUsual_PassByEllipsis_resultsByParams{ + results = &moqUsual_FnParam_resultsByParams{ anyCount: anyCount, anyParams: r.anyParams, - results: map[moqUsual_PassByEllipsis_paramsKey]*moqUsual_PassByEllipsis_results{}, + results: map[moqUsual_FnParam_paramsKey]*moqUsual_FnParam_results{}, } - r.moq.resultsByParams_PassByEllipsis = append(r.moq.resultsByParams_PassByEllipsis, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_PassByEllipsis) { - copy(r.moq.resultsByParams_PassByEllipsis[insertAt+1:], r.moq.resultsByParams_PassByEllipsis[insertAt:0]) - r.moq.resultsByParams_PassByEllipsis[insertAt] = *results + r.moq.resultsByParams_FnParam = append(r.moq.resultsByParams_FnParam, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_FnParam) { + copy(r.moq.resultsByParams_FnParam[insertAt+1:], r.moq.resultsByParams_FnParam[insertAt:0]) + r.moq.resultsByParams_FnParam[insertAt] = *results } } - paramsKey := r.moq.paramsKey_PassByEllipsis(r.params, r.anyParams) + paramsKey := r.moq.paramsKey_FnParam(r.params, r.anyParams) var ok bool r.results, ok = results.results[paramsKey] if !ok { - r.results = &moqUsual_PassByEllipsis_results{ + r.results = &moqUsual_FnParam_results{ params: r.params, results: nil, index: 0, @@ -13358,7 +17290,7 @@ func (r *moqUsual_PassByEllipsis_fnRecorder) findResults() { r.results.repeat.Increment(r.moq.scene.T) } -func (r *moqUsual_PassByEllipsis_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_PassByEllipsis_fnRecorder { +func (r *moqUsual_FnParam_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_FnParam_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") @@ -13369,13 +17301,10 @@ func (r *moqUsual_PassByEllipsis_fnRecorder) repeat(repeaters ...moq.Repeater) * for n := 0; n < r.results.repeat.ResultCount-1; n++ { if r.sequence { last = struct { - values *struct { - result1 string - result2 error - } + values *struct{} sequence uint32 - doFn moqUsual_PassByEllipsis_doFn - doReturnFn moqUsual_PassByEllipsis_doReturnFn + doFn moqUsual_FnParam_doFn + doReturnFn moqUsual_FnParam_doReturnFn }{ values: last.values, sequence: r.moq.scene.NextRecorderSequence(), @@ -13386,72 +17315,72 @@ func (r *moqUsual_PassByEllipsis_fnRecorder) repeat(repeaters ...moq.Repeater) * return r } -func (m *moqUsual) prettyParams_PassByEllipsis(params moqUsual_PassByEllipsis_params) string { - return fmt.Sprintf("PassByEllipsis(%#v)", params.p) +func (m *moqUsual) prettyParams_FnParam(params moqUsual_FnParam_params) string { + return fmt.Sprintf("FnParam(%#v)", moq.FnString(params.fn)) } -func (m *moqUsual) paramsKey_PassByEllipsis(params moqUsual_PassByEllipsis_params, anyParams uint64) moqUsual_PassByEllipsis_paramsKey { +func (m *moqUsual) paramsKey_FnParam(params moqUsual_FnParam_params, anyParams uint64) moqUsual_FnParam_paramsKey { m.scene.T.Helper() - var pUsedHash hash.Hash + var fnUsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.runtime.parameterIndexing.PassByEllipsis.p == moq.ParamIndexByValue { - m.scene.T.Fatalf("The p parameter of the PassByEllipsis function can't be indexed by value") + if m.runtime.parameterIndexing.FnParam.fn == moq.ParamIndexByValue { + m.scene.T.Fatalf("The fn parameter of the FnParam function can't be indexed by value") } - pUsedHash = hash.DeepHash(params.p) + fnUsedHash = hash.DeepHash(params.fn) } - return moqUsual_PassByEllipsis_paramsKey{ + return moqUsual_FnParam_paramsKey{ params: struct{}{}, - hashes: struct{ p hash.Hash }{ - p: pUsedHash, + hashes: struct{ fn hash.Hash }{ + fn: fnUsedHash, }, } } -func (m *moqUsual_recorder) PassByMap(p map[string]testmoqs.Params) *moqUsual_PassByMap_fnRecorder { - return &moqUsual_PassByMap_fnRecorder{ - params: moqUsual_PassByMap_params{ - p: p, +func (m *moqUsual_recorder) Other(param1 other.Params) *moqUsual_Other_fnRecorder { + return &moqUsual_Other_fnRecorder{ + params: moqUsual_Other_params{ + param1: param1, }, sequence: m.moq.config.Sequence == moq.SeqDefaultOn, moq: m.moq, } } -func (r *moqUsual_PassByMap_fnRecorder) any() *moqUsual_PassByMap_anyParams { +func (r *moqUsual_Other_fnRecorder) any() *moqUsual_Other_anyParams { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByMap(r.params)) + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Other(r.params)) return nil } - return &moqUsual_PassByMap_anyParams{recorder: r} + return &moqUsual_Other_anyParams{recorder: r} } -func (a *moqUsual_PassByMap_anyParams) p() *moqUsual_PassByMap_fnRecorder { +func (a *moqUsual_Other_anyParams) param1() *moqUsual_Other_fnRecorder { a.recorder.anyParams |= 1 << 0 return a.recorder } -func (r *moqUsual_PassByMap_fnRecorder) seq() *moqUsual_PassByMap_fnRecorder { +func (r *moqUsual_Other_fnRecorder) seq() *moqUsual_Other_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByMap(r.params)) + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Other(r.params)) return nil } r.sequence = true return r } -func (r *moqUsual_PassByMap_fnRecorder) noSeq() *moqUsual_PassByMap_fnRecorder { +func (r *moqUsual_Other_fnRecorder) noSeq() *moqUsual_Other_fnRecorder { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByMap(r.params)) + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Other(r.params)) return nil } r.sequence = false return r } -func (r *moqUsual_PassByMap_fnRecorder) returnResults(result1 map[string]testmoqs.Results) *moqUsual_PassByMap_fnRecorder { +func (r *moqUsual_Other_fnRecorder) returnResults(result1 other.Results) *moqUsual_Other_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -13462,14 +17391,14 @@ func (r *moqUsual_PassByMap_fnRecorder) returnResults(result1 map[string]testmoq r.results.results = append(r.results.results, struct { values *struct { - result1 map[string]testmoqs.Results + result1 other.Results } sequence uint32 - doFn moqUsual_PassByMap_doFn - doReturnFn moqUsual_PassByMap_doReturnFn + doFn moqUsual_Other_doFn + doReturnFn moqUsual_Other_doReturnFn }{ values: &struct { - result1 map[string]testmoqs.Results + result1 other.Results }{ result1: result1, }, @@ -13478,7 +17407,7 @@ func (r *moqUsual_PassByMap_fnRecorder) returnResults(result1 map[string]testmoq return r } -func (r *moqUsual_PassByMap_fnRecorder) andDo(fn moqUsual_PassByMap_doFn) *moqUsual_PassByMap_fnRecorder { +func (r *moqUsual_Other_fnRecorder) andDo(fn moqUsual_Other_doFn) *moqUsual_Other_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") @@ -13489,7 +17418,7 @@ func (r *moqUsual_PassByMap_fnRecorder) andDo(fn moqUsual_PassByMap_doFn) *moqUs return r } -func (r *moqUsual_PassByMap_fnRecorder) doReturnResults(fn moqUsual_PassByMap_doReturnFn) *moqUsual_PassByMap_fnRecorder { +func (r *moqUsual_Other_fnRecorder) doReturnResults(fn moqUsual_Other_doReturnFn) *moqUsual_Other_fnRecorder { r.moq.scene.T.Helper() r.findResults() @@ -13500,16 +17429,16 @@ func (r *moqUsual_PassByMap_fnRecorder) doReturnResults(fn moqUsual_PassByMap_do r.results.results = append(r.results.results, struct { values *struct { - result1 map[string]testmoqs.Results + result1 other.Results } sequence uint32 - doFn moqUsual_PassByMap_doFn - doReturnFn moqUsual_PassByMap_doReturnFn + doFn moqUsual_Other_doFn + doReturnFn moqUsual_Other_doReturnFn }{sequence: sequence, doReturnFn: fn}) return r } -func (r *moqUsual_PassByMap_fnRecorder) findResults() { +func (r *moqUsual_Other_fnRecorder) findResults() { r.moq.scene.T.Helper() if r.results != nil { r.results.repeat.Increment(r.moq.scene.T) @@ -13518,8 +17447,8 @@ func (r *moqUsual_PassByMap_fnRecorder) findResults() { anyCount := bits.OnesCount64(r.anyParams) insertAt := -1 - var results *moqUsual_PassByMap_resultsByParams - for n, res := range r.moq.resultsByParams_PassByMap { + var results *moqUsual_Other_resultsByParams + for n, res := range r.moq.resultsByParams_Other { if res.anyParams == r.anyParams { results = &res break @@ -13529,24 +17458,24 @@ func (r *moqUsual_PassByMap_fnRecorder) findResults() { } } if results == nil { - results = &moqUsual_PassByMap_resultsByParams{ + results = &moqUsual_Other_resultsByParams{ anyCount: anyCount, anyParams: r.anyParams, - results: map[moqUsual_PassByMap_paramsKey]*moqUsual_PassByMap_results{}, + results: map[moqUsual_Other_paramsKey]*moqUsual_Other_results{}, } - r.moq.resultsByParams_PassByMap = append(r.moq.resultsByParams_PassByMap, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_PassByMap) { - copy(r.moq.resultsByParams_PassByMap[insertAt+1:], r.moq.resultsByParams_PassByMap[insertAt:0]) - r.moq.resultsByParams_PassByMap[insertAt] = *results + r.moq.resultsByParams_Other = append(r.moq.resultsByParams_Other, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_Other) { + copy(r.moq.resultsByParams_Other[insertAt+1:], r.moq.resultsByParams_Other[insertAt:0]) + r.moq.resultsByParams_Other[insertAt] = *results } } - paramsKey := r.moq.paramsKey_PassByMap(r.params, r.anyParams) + paramsKey := r.moq.paramsKey_Other(r.params, r.anyParams) var ok bool r.results, ok = results.results[paramsKey] if !ok { - r.results = &moqUsual_PassByMap_results{ + r.results = &moqUsual_Other_results{ params: r.params, results: nil, index: 0, @@ -13558,7 +17487,7 @@ func (r *moqUsual_PassByMap_fnRecorder) findResults() { r.results.repeat.Increment(r.moq.scene.T) } -func (r *moqUsual_PassByMap_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_PassByMap_fnRecorder { +func (r *moqUsual_Other_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_Other_fnRecorder { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") @@ -13570,290 +17499,495 @@ func (r *moqUsual_PassByMap_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUs if r.sequence { last = struct { values *struct { - result1 map[string]testmoqs.Results + result1 other.Results } sequence uint32 - doFn moqUsual_PassByMap_doFn - doReturnFn moqUsual_PassByMap_doReturnFn + doFn moqUsual_Other_doFn + doReturnFn moqUsual_Other_doReturnFn }{ values: last.values, sequence: r.moq.scene.NextRecorderSequence(), } } - r.results.results = append(r.results.results, last) + r.results.results = append(r.results.results, last) + } + return r +} + +func (m *moqUsual) prettyParams_Other(params moqUsual_Other_params) string { + return fmt.Sprintf("Other(%#v)", params.param1) +} + +func (m *moqUsual) paramsKey_Other(params moqUsual_Other_params, anyParams uint64) moqUsual_Other_paramsKey { + m.scene.T.Helper() + var param1Used other.Params + var param1UsedHash hash.Hash + if anyParams&(1<<0) == 0 { + if m.runtime.parameterIndexing.Other.param1 == moq.ParamIndexByValue { + param1Used = params.param1 + } else { + param1UsedHash = hash.DeepHash(params.param1) + } + } + return moqUsual_Other_paramsKey{ + params: struct{ param1 other.Params }{ + param1: param1Used, + }, + hashes: struct{ param1 hash.Hash }{ + param1: param1UsedHash, + }, + } +} + +// Reset resets the state of the moq +func (m *moqUsual) Reset() { + m.resultsByParams_Usual = nil + m.resultsByParams_NoNames = nil + m.resultsByParams_NoResults = nil + m.resultsByParams_NoParams = nil + m.resultsByParams_Nothing = nil + m.resultsByParams_Variadic = nil + m.resultsByParams_RepeatedIds = nil + m.resultsByParams_Times = nil + m.resultsByParams_DifficultParamNames = nil + m.resultsByParams_DifficultResultNames = nil + m.resultsByParams_PassByArray = nil + m.resultsByParams_PassByChan = nil + m.resultsByParams_PassByEllipsis = nil + m.resultsByParams_PassByMap = nil + m.resultsByParams_PassByReference = nil + m.resultsByParams_PassBySlice = nil + m.resultsByParams_PassByValue = nil + m.resultsByParams_InterfaceParam = nil + m.resultsByParams_InterfaceResult = nil + m.resultsByParams_FnParam = nil + m.resultsByParams_Other = nil +} + +// AssertExpectationsMet asserts that all expectations have been met +func (m *moqUsual) AssertExpectationsMet() { + m.scene.T.Helper() + for _, res := range m.resultsByParams_Usual { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_Usual(results.params)) + } + } + } + for _, res := range m.resultsByParams_NoNames { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_NoNames(results.params)) + } + } + } + for _, res := range m.resultsByParams_NoResults { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_NoResults(results.params)) + } + } + } + for _, res := range m.resultsByParams_NoParams { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_NoParams(results.params)) + } + } + } + for _, res := range m.resultsByParams_Nothing { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_Nothing(results.params)) + } + } + } + for _, res := range m.resultsByParams_Variadic { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_Variadic(results.params)) + } + } + } + for _, res := range m.resultsByParams_RepeatedIds { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_RepeatedIds(results.params)) + } + } + } + for _, res := range m.resultsByParams_Times { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_Times(results.params)) + } + } + } + for _, res := range m.resultsByParams_DifficultParamNames { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_DifficultParamNames(results.params)) + } + } + } + for _, res := range m.resultsByParams_DifficultResultNames { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_DifficultResultNames(results.params)) + } + } + } + for _, res := range m.resultsByParams_PassByArray { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_PassByArray(results.params)) + } + } + } + for _, res := range m.resultsByParams_PassByChan { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_PassByChan(results.params)) + } + } + } + for _, res := range m.resultsByParams_PassByEllipsis { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_PassByEllipsis(results.params)) + } + } + } + for _, res := range m.resultsByParams_PassByMap { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_PassByMap(results.params)) + } + } + } + for _, res := range m.resultsByParams_PassByReference { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_PassByReference(results.params)) + } + } + } + for _, res := range m.resultsByParams_PassBySlice { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_PassBySlice(results.params)) + } + } + } + for _, res := range m.resultsByParams_PassByValue { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_PassByValue(results.params)) + } + } + } + for _, res := range m.resultsByParams_InterfaceParam { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_InterfaceParam(results.params)) + } + } + } + for _, res := range m.resultsByParams_InterfaceResult { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_InterfaceResult(results.params)) + } + } + } + for _, res := range m.resultsByParams_FnParam { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_FnParam(results.params)) + } + } + } + for _, res := range m.resultsByParams_Other { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_Other(results.params)) + } + } } - return r } -func (m *moqUsual) prettyParams_PassByMap(params moqUsual_PassByMap_params) string { - return fmt.Sprintf("PassByMap(%#v)", params.p) -} +// The following type assertion assures that testmoqs.GenericParams is mocked +// completely +var _ testmoqs.GenericParams[any, any] = (*moqGenericParams_mock[any, any])(nil) -func (m *moqUsual) paramsKey_PassByMap(params moqUsual_PassByMap_params, anyParams uint64) moqUsual_PassByMap_paramsKey { - m.scene.T.Helper() - var pUsedHash hash.Hash - if anyParams&(1<<0) == 0 { - if m.runtime.parameterIndexing.PassByMap.p == moq.ParamIndexByValue { - m.scene.T.Fatalf("The p parameter of the PassByMap function can't be indexed by value") +// moqGenericParams holds the state of a moq of the GenericParams type +type moqGenericParams[S, B any] struct { + scene *moq.Scene + config moq.Config + moq *moqGenericParams_mock[S, B] + + resultsByParams_Usual []moqGenericParams_Usual_resultsByParams[S, B] + + runtime struct { + parameterIndexing struct { + Usual struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } } - pUsedHash = hash.DeepHash(params.p) - } - return moqUsual_PassByMap_paramsKey{ - params: struct{}{}, - hashes: struct{ p hash.Hash }{ - p: pUsedHash, - }, } + // moqGenericParams_mock isolates the mock interface of the GenericParams type } -func (m *moqUsual_recorder) PassByReference(p *testmoqs.Params) *moqUsual_PassByReference_fnRecorder { - return &moqUsual_PassByReference_fnRecorder{ - params: moqUsual_PassByReference_params{ - p: p, - }, - sequence: m.moq.config.Sequence == moq.SeqDefaultOn, - moq: m.moq, - } +type moqGenericParams_mock[S, B any] struct { + moq *moqGenericParams[S, B] } -func (r *moqUsual_PassByReference_fnRecorder) any() *moqUsual_PassByReference_anyParams { - r.moq.scene.T.Helper() - if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByReference(r.params)) - return nil - } - return &moqUsual_PassByReference_anyParams{recorder: r} +// moqGenericParams_recorder isolates the recorder interface of the +// GenericParams type +type moqGenericParams_recorder[S, B any] struct { + moq *moqGenericParams[S, B] } -func (a *moqUsual_PassByReference_anyParams) p() *moqUsual_PassByReference_fnRecorder { - a.recorder.anyParams |= 1 << 0 - return a.recorder +// moqGenericParams_Usual_params holds the params of the GenericParams type +type moqGenericParams_Usual_params[S, B any] struct { + param1 S + param2 B } -func (r *moqUsual_PassByReference_fnRecorder) seq() *moqUsual_PassByReference_fnRecorder { - r.moq.scene.T.Helper() - if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByReference(r.params)) - return nil +// moqGenericParams_Usual_paramsKey holds the map key params of the +// GenericParams type +type moqGenericParams_Usual_paramsKey[S, B any] struct { + params struct{} + hashes struct { + param1 hash.Hash + param2 hash.Hash } - r.sequence = true - return r } -func (r *moqUsual_PassByReference_fnRecorder) noSeq() *moqUsual_PassByReference_fnRecorder { - r.moq.scene.T.Helper() - if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByReference(r.params)) - return nil - } - r.sequence = false - return r +// moqGenericParams_Usual_resultsByParams contains the results for a given set +// of parameters for the GenericParams type +type moqGenericParams_Usual_resultsByParams[S, B any] struct { + anyCount int + anyParams uint64 + results map[moqGenericParams_Usual_paramsKey[S, B]]*moqGenericParams_Usual_results[S, B] } -func (r *moqUsual_PassByReference_fnRecorder) returnResults(result1 *testmoqs.Results) *moqUsual_PassByReference_fnRecorder { - r.moq.scene.T.Helper() - r.findResults() +// moqGenericParams_Usual_doFn defines the type of function needed when calling +// andDo for the GenericParams type +type moqGenericParams_Usual_doFn[S, B any] func(S, B) - var sequence uint32 - if r.sequence { - sequence = r.moq.scene.NextRecorderSequence() - } +// moqGenericParams_Usual_doReturnFn defines the type of function needed when +// calling doReturnResults for the GenericParams type +type moqGenericParams_Usual_doReturnFn[S, B any] func(S, B) (string, error) - r.results.results = append(r.results.results, struct { +// moqGenericParams_Usual_results holds the results of the GenericParams type +type moqGenericParams_Usual_results[S, B any] struct { + params moqGenericParams_Usual_params[S, B] + results []struct { values *struct { - result1 *testmoqs.Results + result1 string + result2 error } sequence uint32 - doFn moqUsual_PassByReference_doFn - doReturnFn moqUsual_PassByReference_doReturnFn - }{ - values: &struct { - result1 *testmoqs.Results - }{ - result1: result1, - }, - sequence: sequence, - }) - return r + doFn moqGenericParams_Usual_doFn[S, B] + doReturnFn moqGenericParams_Usual_doReturnFn[S, B] + } + index uint32 + repeat *moq.RepeatVal } -func (r *moqUsual_PassByReference_fnRecorder) andDo(fn moqUsual_PassByReference_doFn) *moqUsual_PassByReference_fnRecorder { - r.moq.scene.T.Helper() - if r.results == nil { - r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") - return nil - } - last := &r.results.results[len(r.results.results)-1] - last.doFn = fn - return r +// moqGenericParams_Usual_fnRecorder routes recorded function calls to the +// moqGenericParams moq +type moqGenericParams_Usual_fnRecorder[S, B any] struct { + params moqGenericParams_Usual_params[S, B] + anyParams uint64 + sequence bool + results *moqGenericParams_Usual_results[S, B] + moq *moqGenericParams[S, B] } -func (r *moqUsual_PassByReference_fnRecorder) doReturnResults(fn moqUsual_PassByReference_doReturnFn) *moqUsual_PassByReference_fnRecorder { - r.moq.scene.T.Helper() - r.findResults() +// moqGenericParams_Usual_anyParams isolates the any params functions of the +// GenericParams type +type moqGenericParams_Usual_anyParams[S, B any] struct { + recorder *moqGenericParams_Usual_fnRecorder[S, B] +} - var sequence uint32 - if r.sequence { - sequence = r.moq.scene.NextRecorderSequence() +// newMoqGenericParams creates a new moq of the GenericParams type +func newMoqGenericParams[S, B any](scene *moq.Scene, config *moq.Config) *moqGenericParams[S, B] { + if config == nil { + config = &moq.Config{} } + m := &moqGenericParams[S, B]{ + scene: scene, + config: *config, + moq: &moqGenericParams_mock[S, B]{}, - r.results.results = append(r.results.results, struct { - values *struct { - result1 *testmoqs.Results - } - sequence uint32 - doFn moqUsual_PassByReference_doFn - doReturnFn moqUsual_PassByReference_doReturnFn - }{sequence: sequence, doReturnFn: fn}) - return r + runtime: struct { + parameterIndexing struct { + Usual struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } + } + }{parameterIndexing: struct { + Usual struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } + }{ + Usual: struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + }{ + param1: moq.ParamIndexByHash, + param2: moq.ParamIndexByHash, + }, + }}, + } + m.moq.moq = m + + scene.AddMoq(m) + return m } -func (r *moqUsual_PassByReference_fnRecorder) findResults() { - r.moq.scene.T.Helper() - if r.results != nil { - r.results.repeat.Increment(r.moq.scene.T) - return - } +// mock returns the mock implementation of the GenericParams type +func (m *moqGenericParams[S, B]) mock() *moqGenericParams_mock[S, B] { return m.moq } - anyCount := bits.OnesCount64(r.anyParams) - insertAt := -1 - var results *moqUsual_PassByReference_resultsByParams - for n, res := range r.moq.resultsByParams_PassByReference { - if res.anyParams == r.anyParams { - results = &res +func (m *moqGenericParams_mock[S, B]) Usual(param1 S, param2 B) (result1 string, result2 error) { + m.moq.scene.T.Helper() + params := moqGenericParams_Usual_params[S, B]{ + param1: param1, + param2: param2, + } + var results *moqGenericParams_Usual_results[S, B] + for _, resultsByParams := range m.moq.resultsByParams_Usual { + paramsKey := m.moq.paramsKey_Usual(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { break } - if res.anyCount > anyCount { - insertAt = n - } } if results == nil { - results = &moqUsual_PassByReference_resultsByParams{ - anyCount: anyCount, - anyParams: r.anyParams, - results: map[moqUsual_PassByReference_paramsKey]*moqUsual_PassByReference_results{}, - } - r.moq.resultsByParams_PassByReference = append(r.moq.resultsByParams_PassByReference, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_PassByReference) { - copy(r.moq.resultsByParams_PassByReference[insertAt+1:], r.moq.resultsByParams_PassByReference[insertAt:0]) - r.moq.resultsByParams_PassByReference[insertAt] = *results + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_Usual(params)) } + return } - paramsKey := r.moq.paramsKey_PassByReference(r.params, r.anyParams) - - var ok bool - r.results, ok = results.results[paramsKey] - if !ok { - r.results = &moqUsual_PassByReference_results{ - params: r.params, - results: nil, - index: 0, - repeat: &moq.RepeatVal{}, + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_Usual(params)) + } + return } - results.results[paramsKey] = r.results + i = results.repeat.ResultCount - 1 } - r.results.repeat.Increment(r.moq.scene.T) -} - -func (r *moqUsual_PassByReference_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_PassByReference_fnRecorder { - r.moq.scene.T.Helper() - if r.results == nil { - r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") - return nil - } - r.results.repeat.Repeat(r.moq.scene.T, repeaters) - last := r.results.results[len(r.results.results)-1] - for n := 0; n < r.results.repeat.ResultCount-1; n++ { - if r.sequence { - last = struct { - values *struct { - result1 *testmoqs.Results - } - sequence uint32 - doFn moqUsual_PassByReference_doFn - doReturnFn moqUsual_PassByReference_doReturnFn - }{ - values: last.values, - sequence: r.moq.scene.NextRecorderSequence(), - } + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_Usual(params)) } - r.results.results = append(r.results.results, last) } - return r -} -func (m *moqUsual) prettyParams_PassByReference(params moqUsual_PassByReference_params) string { - return fmt.Sprintf("PassByReference(%#v)", params.p) -} + if result.doFn != nil { + result.doFn(param1, param2) + } -func (m *moqUsual) paramsKey_PassByReference(params moqUsual_PassByReference_params, anyParams uint64) moqUsual_PassByReference_paramsKey { - m.scene.T.Helper() - var pUsed *testmoqs.Params - var pUsedHash hash.Hash - if anyParams&(1<<0) == 0 { - if m.runtime.parameterIndexing.PassByReference.p == moq.ParamIndexByValue { - pUsed = params.p - } else { - pUsedHash = hash.DeepHash(params.p) - } + if result.values != nil { + result1 = result.values.result1 + result2 = result.values.result2 } - return moqUsual_PassByReference_paramsKey{ - params: struct{ p *testmoqs.Params }{ - p: pUsed, - }, - hashes: struct{ p hash.Hash }{ - p: pUsedHash, - }, + if result.doReturnFn != nil { + result1, result2 = result.doReturnFn(param1, param2) } + return } -func (m *moqUsual_recorder) PassBySlice(p []testmoqs.Params) *moqUsual_PassBySlice_fnRecorder { - return &moqUsual_PassBySlice_fnRecorder{ - params: moqUsual_PassBySlice_params{ - p: p, +// onCall returns the recorder implementation of the GenericParams type +func (m *moqGenericParams[S, B]) onCall() *moqGenericParams_recorder[S, B] { + return &moqGenericParams_recorder[S, B]{ + moq: m, + } +} + +func (m *moqGenericParams_recorder[S, B]) Usual(param1 S, param2 B) *moqGenericParams_Usual_fnRecorder[S, B] { + return &moqGenericParams_Usual_fnRecorder[S, B]{ + params: moqGenericParams_Usual_params[S, B]{ + param1: param1, + param2: param2, }, sequence: m.moq.config.Sequence == moq.SeqDefaultOn, moq: m.moq, } } -func (r *moqUsual_PassBySlice_fnRecorder) any() *moqUsual_PassBySlice_anyParams { +func (r *moqGenericParams_Usual_fnRecorder[S, B]) any() *moqGenericParams_Usual_anyParams[S, B] { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassBySlice(r.params)) + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) return nil } - return &moqUsual_PassBySlice_anyParams{recorder: r} + return &moqGenericParams_Usual_anyParams[S, B]{recorder: r} } -func (a *moqUsual_PassBySlice_anyParams) p() *moqUsual_PassBySlice_fnRecorder { +func (a *moqGenericParams_Usual_anyParams[S, B]) param1() *moqGenericParams_Usual_fnRecorder[S, B] { a.recorder.anyParams |= 1 << 0 return a.recorder } -func (r *moqUsual_PassBySlice_fnRecorder) seq() *moqUsual_PassBySlice_fnRecorder { +func (a *moqGenericParams_Usual_anyParams[S, B]) param2() *moqGenericParams_Usual_fnRecorder[S, B] { + a.recorder.anyParams |= 1 << 1 + return a.recorder +} + +func (r *moqGenericParams_Usual_fnRecorder[S, B]) seq() *moqGenericParams_Usual_fnRecorder[S, B] { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassBySlice(r.params)) + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) return nil } r.sequence = true return r } -func (r *moqUsual_PassBySlice_fnRecorder) noSeq() *moqUsual_PassBySlice_fnRecorder { +func (r *moqGenericParams_Usual_fnRecorder[S, B]) noSeq() *moqGenericParams_Usual_fnRecorder[S, B] { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassBySlice(r.params)) + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) return nil } r.sequence = false return r } -func (r *moqUsual_PassBySlice_fnRecorder) returnResults(result1 []testmoqs.Results) *moqUsual_PassBySlice_fnRecorder { +func (r *moqGenericParams_Usual_fnRecorder[S, B]) returnResults(result1 string, result2 error) *moqGenericParams_Usual_fnRecorder[S, B] { r.moq.scene.T.Helper() r.findResults() @@ -13864,23 +17998,26 @@ func (r *moqUsual_PassBySlice_fnRecorder) returnResults(result1 []testmoqs.Resul r.results.results = append(r.results.results, struct { values *struct { - result1 []testmoqs.Results + result1 string + result2 error } sequence uint32 - doFn moqUsual_PassBySlice_doFn - doReturnFn moqUsual_PassBySlice_doReturnFn + doFn moqGenericParams_Usual_doFn[S, B] + doReturnFn moqGenericParams_Usual_doReturnFn[S, B] }{ values: &struct { - result1 []testmoqs.Results + result1 string + result2 error }{ result1: result1, + result2: result2, }, sequence: sequence, }) return r } -func (r *moqUsual_PassBySlice_fnRecorder) andDo(fn moqUsual_PassBySlice_doFn) *moqUsual_PassBySlice_fnRecorder { +func (r *moqGenericParams_Usual_fnRecorder[S, B]) andDo(fn moqGenericParams_Usual_doFn[S, B]) *moqGenericParams_Usual_fnRecorder[S, B] { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") @@ -13891,7 +18028,7 @@ func (r *moqUsual_PassBySlice_fnRecorder) andDo(fn moqUsual_PassBySlice_doFn) *m return r } -func (r *moqUsual_PassBySlice_fnRecorder) doReturnResults(fn moqUsual_PassBySlice_doReturnFn) *moqUsual_PassBySlice_fnRecorder { +func (r *moqGenericParams_Usual_fnRecorder[S, B]) doReturnResults(fn moqGenericParams_Usual_doReturnFn[S, B]) *moqGenericParams_Usual_fnRecorder[S, B] { r.moq.scene.T.Helper() r.findResults() @@ -13902,16 +18039,17 @@ func (r *moqUsual_PassBySlice_fnRecorder) doReturnResults(fn moqUsual_PassBySlic r.results.results = append(r.results.results, struct { values *struct { - result1 []testmoqs.Results + result1 string + result2 error } sequence uint32 - doFn moqUsual_PassBySlice_doFn - doReturnFn moqUsual_PassBySlice_doReturnFn + doFn moqGenericParams_Usual_doFn[S, B] + doReturnFn moqGenericParams_Usual_doReturnFn[S, B] }{sequence: sequence, doReturnFn: fn}) return r } -func (r *moqUsual_PassBySlice_fnRecorder) findResults() { +func (r *moqGenericParams_Usual_fnRecorder[S, B]) findResults() { r.moq.scene.T.Helper() if r.results != nil { r.results.repeat.Increment(r.moq.scene.T) @@ -13920,8 +18058,8 @@ func (r *moqUsual_PassBySlice_fnRecorder) findResults() { anyCount := bits.OnesCount64(r.anyParams) insertAt := -1 - var results *moqUsual_PassBySlice_resultsByParams - for n, res := range r.moq.resultsByParams_PassBySlice { + var results *moqGenericParams_Usual_resultsByParams[S, B] + for n, res := range r.moq.resultsByParams_Usual { if res.anyParams == r.anyParams { results = &res break @@ -13931,24 +18069,24 @@ func (r *moqUsual_PassBySlice_fnRecorder) findResults() { } } if results == nil { - results = &moqUsual_PassBySlice_resultsByParams{ + results = &moqGenericParams_Usual_resultsByParams[S, B]{ anyCount: anyCount, anyParams: r.anyParams, - results: map[moqUsual_PassBySlice_paramsKey]*moqUsual_PassBySlice_results{}, + results: map[moqGenericParams_Usual_paramsKey[S, B]]*moqGenericParams_Usual_results[S, B]{}, } - r.moq.resultsByParams_PassBySlice = append(r.moq.resultsByParams_PassBySlice, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_PassBySlice) { - copy(r.moq.resultsByParams_PassBySlice[insertAt+1:], r.moq.resultsByParams_PassBySlice[insertAt:0]) - r.moq.resultsByParams_PassBySlice[insertAt] = *results + r.moq.resultsByParams_Usual = append(r.moq.resultsByParams_Usual, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_Usual) { + copy(r.moq.resultsByParams_Usual[insertAt+1:], r.moq.resultsByParams_Usual[insertAt:0]) + r.moq.resultsByParams_Usual[insertAt] = *results } } - paramsKey := r.moq.paramsKey_PassBySlice(r.params, r.anyParams) + paramsKey := r.moq.paramsKey_Usual(r.params, r.anyParams) var ok bool r.results, ok = results.results[paramsKey] if !ok { - r.results = &moqUsual_PassBySlice_results{ + r.results = &moqGenericParams_Usual_results[S, B]{ params: r.params, results: nil, index: 0, @@ -13960,7 +18098,7 @@ func (r *moqUsual_PassBySlice_fnRecorder) findResults() { r.results.repeat.Increment(r.moq.scene.T) } -func (r *moqUsual_PassBySlice_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_PassBySlice_fnRecorder { +func (r *moqGenericParams_Usual_fnRecorder[S, B]) repeat(repeaters ...moq.Repeater) *moqGenericParams_Usual_fnRecorder[S, B] { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") @@ -13972,11 +18110,12 @@ func (r *moqUsual_PassBySlice_fnRecorder) repeat(repeaters ...moq.Repeater) *moq if r.sequence { last = struct { values *struct { - result1 []testmoqs.Results + result1 string + result2 error } sequence uint32 - doFn moqUsual_PassBySlice_doFn - doReturnFn moqUsual_PassBySlice_doReturnFn + doFn moqGenericParams_Usual_doFn[S, B] + doReturnFn moqGenericParams_Usual_doReturnFn[S, B] }{ values: last.values, sequence: r.moq.scene.NextRecorderSequence(), @@ -13987,72 +18126,310 @@ func (r *moqUsual_PassBySlice_fnRecorder) repeat(repeaters ...moq.Repeater) *moq return r } -func (m *moqUsual) prettyParams_PassBySlice(params moqUsual_PassBySlice_params) string { - return fmt.Sprintf("PassBySlice(%#v)", params.p) +func (m *moqGenericParams[S, B]) prettyParams_Usual(params moqGenericParams_Usual_params[S, B]) string { + return fmt.Sprintf("Usual(%#v, %#v)", params.param1, params.param2) } -func (m *moqUsual) paramsKey_PassBySlice(params moqUsual_PassBySlice_params, anyParams uint64) moqUsual_PassBySlice_paramsKey { +func (m *moqGenericParams[S, B]) paramsKey_Usual(params moqGenericParams_Usual_params[S, B], anyParams uint64) moqGenericParams_Usual_paramsKey[S, B] { m.scene.T.Helper() - var pUsedHash hash.Hash + var param1UsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.runtime.parameterIndexing.PassBySlice.p == moq.ParamIndexByValue { - m.scene.T.Fatalf("The p parameter of the PassBySlice function can't be indexed by value") + if m.runtime.parameterIndexing.Usual.param1 == moq.ParamIndexByValue { + m.scene.T.Fatalf("The param1 parameter of the Usual function can't be indexed by value") } - pUsedHash = hash.DeepHash(params.p) + param1UsedHash = hash.DeepHash(params.param1) } - return moqUsual_PassBySlice_paramsKey{ + var param2UsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.runtime.parameterIndexing.Usual.param2 == moq.ParamIndexByValue { + m.scene.T.Fatalf("The param2 parameter of the Usual function can't be indexed by value") + } + param2UsedHash = hash.DeepHash(params.param2) + } + return moqGenericParams_Usual_paramsKey[S, B]{ params: struct{}{}, - hashes: struct{ p hash.Hash }{ - p: pUsedHash, + hashes: struct { + param1 hash.Hash + param2 hash.Hash + }{ + param1: param1UsedHash, + param2: param2UsedHash, }, } } -func (m *moqUsual_recorder) PassByValue(p testmoqs.Params) *moqUsual_PassByValue_fnRecorder { - return &moqUsual_PassByValue_fnRecorder{ - params: moqUsual_PassByValue_params{ - p: p, +// Reset resets the state of the moq +func (m *moqGenericParams[S, B]) Reset() { m.resultsByParams_Usual = nil } + +// AssertExpectationsMet asserts that all expectations have been met +func (m *moqGenericParams[S, B]) AssertExpectationsMet() { + m.scene.T.Helper() + for _, res := range m.resultsByParams_Usual { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_Usual(results.params)) + } + } + } +} + +// The following type assertion assures that testmoqs.PartialGenericParams is +// mocked completely +var _ testmoqs.PartialGenericParams[any] = (*moqPartialGenericParams_mock[any])(nil) + +// moqPartialGenericParams holds the state of a moq of the PartialGenericParams +// type +type moqPartialGenericParams[S any] struct { + scene *moq.Scene + config moq.Config + moq *moqPartialGenericParams_mock[S] + + resultsByParams_Usual []moqPartialGenericParams_Usual_resultsByParams[S] + + runtime struct { + parameterIndexing struct { + Usual struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } + } + } + // moqPartialGenericParams_mock isolates the mock interface of the +} + +// PartialGenericParams type +type moqPartialGenericParams_mock[S any] struct { + moq *moqPartialGenericParams[S] +} + +// moqPartialGenericParams_recorder isolates the recorder interface of the +// PartialGenericParams type +type moqPartialGenericParams_recorder[S any] struct { + moq *moqPartialGenericParams[S] +} + +// moqPartialGenericParams_Usual_params holds the params of the +// PartialGenericParams type +type moqPartialGenericParams_Usual_params[S any] struct { + param1 S + param2 bool +} + +// moqPartialGenericParams_Usual_paramsKey holds the map key params of the +// PartialGenericParams type +type moqPartialGenericParams_Usual_paramsKey[S any] struct { + params struct{ param2 bool } + hashes struct { + param1 hash.Hash + param2 hash.Hash + } +} + +// moqPartialGenericParams_Usual_resultsByParams contains the results for a +// given set of parameters for the PartialGenericParams type +type moqPartialGenericParams_Usual_resultsByParams[S any] struct { + anyCount int + anyParams uint64 + results map[moqPartialGenericParams_Usual_paramsKey[S]]*moqPartialGenericParams_Usual_results[S] +} + +// moqPartialGenericParams_Usual_doFn defines the type of function needed when +// calling andDo for the PartialGenericParams type +type moqPartialGenericParams_Usual_doFn[S any] func(S, bool) + +// moqPartialGenericParams_Usual_doReturnFn defines the type of function needed +// when calling doReturnResults for the PartialGenericParams type +type moqPartialGenericParams_Usual_doReturnFn[S any] func(S, bool) (string, error) + +// moqPartialGenericParams_Usual_results holds the results of the +// PartialGenericParams type +type moqPartialGenericParams_Usual_results[S any] struct { + params moqPartialGenericParams_Usual_params[S] + results []struct { + values *struct { + result1 string + result2 error + } + sequence uint32 + doFn moqPartialGenericParams_Usual_doFn[S] + doReturnFn moqPartialGenericParams_Usual_doReturnFn[S] + } + index uint32 + repeat *moq.RepeatVal +} + +// moqPartialGenericParams_Usual_fnRecorder routes recorded function calls to +// the moqPartialGenericParams moq +type moqPartialGenericParams_Usual_fnRecorder[S any] struct { + params moqPartialGenericParams_Usual_params[S] + anyParams uint64 + sequence bool + results *moqPartialGenericParams_Usual_results[S] + moq *moqPartialGenericParams[S] +} + +// moqPartialGenericParams_Usual_anyParams isolates the any params functions of +// the PartialGenericParams type +type moqPartialGenericParams_Usual_anyParams[S any] struct { + recorder *moqPartialGenericParams_Usual_fnRecorder[S] +} + +// newMoqPartialGenericParams creates a new moq of the PartialGenericParams +// type +func newMoqPartialGenericParams[S any](scene *moq.Scene, config *moq.Config) *moqPartialGenericParams[S] { + if config == nil { + config = &moq.Config{} + } + m := &moqPartialGenericParams[S]{ + scene: scene, + config: *config, + moq: &moqPartialGenericParams_mock[S]{}, + + runtime: struct { + parameterIndexing struct { + Usual struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } + } + }{parameterIndexing: struct { + Usual struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } + }{ + Usual: struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + }{ + param1: moq.ParamIndexByHash, + param2: moq.ParamIndexByValue, + }, + }}, + } + m.moq.moq = m + + scene.AddMoq(m) + return m +} + +// mock returns the mock implementation of the PartialGenericParams type +func (m *moqPartialGenericParams[S]) mock() *moqPartialGenericParams_mock[S] { return m.moq } + +func (m *moqPartialGenericParams_mock[S]) Usual(param1 S, param2 bool) (result1 string, result2 error) { + m.moq.scene.T.Helper() + params := moqPartialGenericParams_Usual_params[S]{ + param1: param1, + param2: param2, + } + var results *moqPartialGenericParams_Usual_results[S] + for _, resultsByParams := range m.moq.resultsByParams_Usual { + paramsKey := m.moq.paramsKey_Usual(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_Usual(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_Usual(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_Usual(params)) + } + } + + if result.doFn != nil { + result.doFn(param1, param2) + } + + if result.values != nil { + result1 = result.values.result1 + result2 = result.values.result2 + } + if result.doReturnFn != nil { + result1, result2 = result.doReturnFn(param1, param2) + } + return +} + +// onCall returns the recorder implementation of the PartialGenericParams type +func (m *moqPartialGenericParams[S]) onCall() *moqPartialGenericParams_recorder[S] { + return &moqPartialGenericParams_recorder[S]{ + moq: m, + } +} + +func (m *moqPartialGenericParams_recorder[S]) Usual(param1 S, param2 bool) *moqPartialGenericParams_Usual_fnRecorder[S] { + return &moqPartialGenericParams_Usual_fnRecorder[S]{ + params: moqPartialGenericParams_Usual_params[S]{ + param1: param1, + param2: param2, }, sequence: m.moq.config.Sequence == moq.SeqDefaultOn, moq: m.moq, } } -func (r *moqUsual_PassByValue_fnRecorder) any() *moqUsual_PassByValue_anyParams { +func (r *moqPartialGenericParams_Usual_fnRecorder[S]) any() *moqPartialGenericParams_Usual_anyParams[S] { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByValue(r.params)) + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) return nil } - return &moqUsual_PassByValue_anyParams{recorder: r} + return &moqPartialGenericParams_Usual_anyParams[S]{recorder: r} } -func (a *moqUsual_PassByValue_anyParams) p() *moqUsual_PassByValue_fnRecorder { +func (a *moqPartialGenericParams_Usual_anyParams[S]) param1() *moqPartialGenericParams_Usual_fnRecorder[S] { a.recorder.anyParams |= 1 << 0 return a.recorder } -func (r *moqUsual_PassByValue_fnRecorder) seq() *moqUsual_PassByValue_fnRecorder { +func (a *moqPartialGenericParams_Usual_anyParams[S]) param2() *moqPartialGenericParams_Usual_fnRecorder[S] { + a.recorder.anyParams |= 1 << 1 + return a.recorder +} + +func (r *moqPartialGenericParams_Usual_fnRecorder[S]) seq() *moqPartialGenericParams_Usual_fnRecorder[S] { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByValue(r.params)) + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) return nil } r.sequence = true return r } -func (r *moqUsual_PassByValue_fnRecorder) noSeq() *moqUsual_PassByValue_fnRecorder { +func (r *moqPartialGenericParams_Usual_fnRecorder[S]) noSeq() *moqPartialGenericParams_Usual_fnRecorder[S] { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_PassByValue(r.params)) + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) return nil } r.sequence = false return r } -func (r *moqUsual_PassByValue_fnRecorder) returnResults(result1 testmoqs.Results) *moqUsual_PassByValue_fnRecorder { +func (r *moqPartialGenericParams_Usual_fnRecorder[S]) returnResults(result1 string, result2 error) *moqPartialGenericParams_Usual_fnRecorder[S] { r.moq.scene.T.Helper() r.findResults() @@ -14063,23 +18440,26 @@ func (r *moqUsual_PassByValue_fnRecorder) returnResults(result1 testmoqs.Results r.results.results = append(r.results.results, struct { values *struct { - result1 testmoqs.Results + result1 string + result2 error } sequence uint32 - doFn moqUsual_PassByValue_doFn - doReturnFn moqUsual_PassByValue_doReturnFn + doFn moqPartialGenericParams_Usual_doFn[S] + doReturnFn moqPartialGenericParams_Usual_doReturnFn[S] }{ values: &struct { - result1 testmoqs.Results + result1 string + result2 error }{ result1: result1, + result2: result2, }, sequence: sequence, }) return r } -func (r *moqUsual_PassByValue_fnRecorder) andDo(fn moqUsual_PassByValue_doFn) *moqUsual_PassByValue_fnRecorder { +func (r *moqPartialGenericParams_Usual_fnRecorder[S]) andDo(fn moqPartialGenericParams_Usual_doFn[S]) *moqPartialGenericParams_Usual_fnRecorder[S] { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") @@ -14090,7 +18470,7 @@ func (r *moqUsual_PassByValue_fnRecorder) andDo(fn moqUsual_PassByValue_doFn) *m return r } -func (r *moqUsual_PassByValue_fnRecorder) doReturnResults(fn moqUsual_PassByValue_doReturnFn) *moqUsual_PassByValue_fnRecorder { +func (r *moqPartialGenericParams_Usual_fnRecorder[S]) doReturnResults(fn moqPartialGenericParams_Usual_doReturnFn[S]) *moqPartialGenericParams_Usual_fnRecorder[S] { r.moq.scene.T.Helper() r.findResults() @@ -14101,16 +18481,17 @@ func (r *moqUsual_PassByValue_fnRecorder) doReturnResults(fn moqUsual_PassByValu r.results.results = append(r.results.results, struct { values *struct { - result1 testmoqs.Results + result1 string + result2 error } sequence uint32 - doFn moqUsual_PassByValue_doFn - doReturnFn moqUsual_PassByValue_doReturnFn + doFn moqPartialGenericParams_Usual_doFn[S] + doReturnFn moqPartialGenericParams_Usual_doReturnFn[S] }{sequence: sequence, doReturnFn: fn}) return r } -func (r *moqUsual_PassByValue_fnRecorder) findResults() { +func (r *moqPartialGenericParams_Usual_fnRecorder[S]) findResults() { r.moq.scene.T.Helper() if r.results != nil { r.results.repeat.Increment(r.moq.scene.T) @@ -14119,8 +18500,8 @@ func (r *moqUsual_PassByValue_fnRecorder) findResults() { anyCount := bits.OnesCount64(r.anyParams) insertAt := -1 - var results *moqUsual_PassByValue_resultsByParams - for n, res := range r.moq.resultsByParams_PassByValue { + var results *moqPartialGenericParams_Usual_resultsByParams[S] + for n, res := range r.moq.resultsByParams_Usual { if res.anyParams == r.anyParams { results = &res break @@ -14130,24 +18511,24 @@ func (r *moqUsual_PassByValue_fnRecorder) findResults() { } } if results == nil { - results = &moqUsual_PassByValue_resultsByParams{ + results = &moqPartialGenericParams_Usual_resultsByParams[S]{ anyCount: anyCount, anyParams: r.anyParams, - results: map[moqUsual_PassByValue_paramsKey]*moqUsual_PassByValue_results{}, + results: map[moqPartialGenericParams_Usual_paramsKey[S]]*moqPartialGenericParams_Usual_results[S]{}, } - r.moq.resultsByParams_PassByValue = append(r.moq.resultsByParams_PassByValue, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_PassByValue) { - copy(r.moq.resultsByParams_PassByValue[insertAt+1:], r.moq.resultsByParams_PassByValue[insertAt:0]) - r.moq.resultsByParams_PassByValue[insertAt] = *results + r.moq.resultsByParams_Usual = append(r.moq.resultsByParams_Usual, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_Usual) { + copy(r.moq.resultsByParams_Usual[insertAt+1:], r.moq.resultsByParams_Usual[insertAt:0]) + r.moq.resultsByParams_Usual[insertAt] = *results } } - paramsKey := r.moq.paramsKey_PassByValue(r.params, r.anyParams) + paramsKey := r.moq.paramsKey_Usual(r.params, r.anyParams) var ok bool r.results, ok = results.results[paramsKey] if !ok { - r.results = &moqUsual_PassByValue_results{ + r.results = &moqPartialGenericParams_Usual_results[S]{ params: r.params, results: nil, index: 0, @@ -14159,7 +18540,7 @@ func (r *moqUsual_PassByValue_fnRecorder) findResults() { r.results.repeat.Increment(r.moq.scene.T) } -func (r *moqUsual_PassByValue_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_PassByValue_fnRecorder { +func (r *moqPartialGenericParams_Usual_fnRecorder[S]) repeat(repeaters ...moq.Repeater) *moqPartialGenericParams_Usual_fnRecorder[S] { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") @@ -14171,11 +18552,12 @@ func (r *moqUsual_PassByValue_fnRecorder) repeat(repeaters ...moq.Repeater) *moq if r.sequence { last = struct { values *struct { - result1 testmoqs.Results + result1 string + result2 error } sequence uint32 - doFn moqUsual_PassByValue_doFn - doReturnFn moqUsual_PassByValue_doReturnFn + doFn moqPartialGenericParams_Usual_doFn[S] + doReturnFn moqPartialGenericParams_Usual_doReturnFn[S] }{ values: last.values, sequence: r.moq.scene.NextRecorderSequence(), @@ -14186,76 +18568,313 @@ func (r *moqUsual_PassByValue_fnRecorder) repeat(repeaters ...moq.Repeater) *moq return r } -func (m *moqUsual) prettyParams_PassByValue(params moqUsual_PassByValue_params) string { - return fmt.Sprintf("PassByValue(%#v)", params.p) +func (m *moqPartialGenericParams[S]) prettyParams_Usual(params moqPartialGenericParams_Usual_params[S]) string { + return fmt.Sprintf("Usual(%#v, %#v)", params.param1, params.param2) } -func (m *moqUsual) paramsKey_PassByValue(params moqUsual_PassByValue_params, anyParams uint64) moqUsual_PassByValue_paramsKey { +func (m *moqPartialGenericParams[S]) paramsKey_Usual(params moqPartialGenericParams_Usual_params[S], anyParams uint64) moqPartialGenericParams_Usual_paramsKey[S] { m.scene.T.Helper() - var pUsed testmoqs.Params - var pUsedHash hash.Hash + var param1UsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.runtime.parameterIndexing.PassByValue.p == moq.ParamIndexByValue { - pUsed = params.p + if m.runtime.parameterIndexing.Usual.param1 == moq.ParamIndexByValue { + m.scene.T.Fatalf("The param1 parameter of the Usual function can't be indexed by value") + } + param1UsedHash = hash.DeepHash(params.param1) + } + var param2Used bool + var param2UsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.runtime.parameterIndexing.Usual.param2 == moq.ParamIndexByValue { + param2Used = params.param2 } else { - pUsedHash = hash.DeepHash(params.p) + param2UsedHash = hash.DeepHash(params.param2) } } - return moqUsual_PassByValue_paramsKey{ - params: struct{ p testmoqs.Params }{ - p: pUsed, + return moqPartialGenericParams_Usual_paramsKey[S]{ + params: struct{ param2 bool }{ + param2: param2Used, }, - hashes: struct{ p hash.Hash }{ - p: pUsedHash, + hashes: struct { + param1 hash.Hash + param2 hash.Hash + }{ + param1: param1UsedHash, + param2: param2UsedHash, }, } } -func (m *moqUsual_recorder) InterfaceParam(w io.Writer) *moqUsual_InterfaceParam_fnRecorder { - return &moqUsual_InterfaceParam_fnRecorder{ - params: moqUsual_InterfaceParam_params{ - w: w, +// Reset resets the state of the moq +func (m *moqPartialGenericParams[S]) Reset() { m.resultsByParams_Usual = nil } + +// AssertExpectationsMet asserts that all expectations have been met +func (m *moqPartialGenericParams[S]) AssertExpectationsMet() { + m.scene.T.Helper() + for _, res := range m.resultsByParams_Usual { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_Usual(results.params)) + } + } + } +} + +// The following type assertion assures that testmoqs.GenericResults is mocked +// completely +var _ testmoqs.GenericResults[string, error] = (*moqGenericResults_mock[string, error])(nil) + +// moqGenericResults holds the state of a moq of the GenericResults type +type moqGenericResults[S ~string, E error] struct { + scene *moq.Scene + config moq.Config + moq *moqGenericResults_mock[S, E] + + resultsByParams_Usual []moqGenericResults_Usual_resultsByParams[S, E] + + runtime struct { + parameterIndexing struct { + Usual struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } + } + } + // moqGenericResults_mock isolates the mock interface of the GenericResults +} + +// type +type moqGenericResults_mock[S ~string, E error] struct { + moq *moqGenericResults[S, E] +} + +// moqGenericResults_recorder isolates the recorder interface of the +// GenericResults type +type moqGenericResults_recorder[S ~string, E error] struct { + moq *moqGenericResults[S, E] +} + +// moqGenericResults_Usual_params holds the params of the GenericResults type +type moqGenericResults_Usual_params[S ~string, E error] struct { + param1 string + param2 bool +} + +// moqGenericResults_Usual_paramsKey holds the map key params of the +// GenericResults type +type moqGenericResults_Usual_paramsKey[S ~string, E error] struct { + params struct { + param1 string + param2 bool + } + hashes struct { + param1 hash.Hash + param2 hash.Hash + } +} + +// moqGenericResults_Usual_resultsByParams contains the results for a given set +// of parameters for the GenericResults type +type moqGenericResults_Usual_resultsByParams[S ~string, E error] struct { + anyCount int + anyParams uint64 + results map[moqGenericResults_Usual_paramsKey[S, E]]*moqGenericResults_Usual_results[S, E] +} + +// moqGenericResults_Usual_doFn defines the type of function needed when +// calling andDo for the GenericResults type +type moqGenericResults_Usual_doFn[S ~string, E error] func(string, bool) + +// moqGenericResults_Usual_doReturnFn defines the type of function needed when +// calling doReturnResults for the GenericResults type +type moqGenericResults_Usual_doReturnFn[S ~string, E error] func(string, bool) (S, E) + +// moqGenericResults_Usual_results holds the results of the GenericResults type +type moqGenericResults_Usual_results[S ~string, E error] struct { + params moqGenericResults_Usual_params[S, E] + results []struct { + values *struct { + result1 S + result2 E + } + sequence uint32 + doFn moqGenericResults_Usual_doFn[S, E] + doReturnFn moqGenericResults_Usual_doReturnFn[S, E] + } + index uint32 + repeat *moq.RepeatVal +} + +// moqGenericResults_Usual_fnRecorder routes recorded function calls to the +// moqGenericResults moq +type moqGenericResults_Usual_fnRecorder[S ~string, E error] struct { + params moqGenericResults_Usual_params[S, E] + anyParams uint64 + sequence bool + results *moqGenericResults_Usual_results[S, E] + moq *moqGenericResults[S, E] +} + +// moqGenericResults_Usual_anyParams isolates the any params functions of the +// GenericResults type +type moqGenericResults_Usual_anyParams[S ~string, E error] struct { + recorder *moqGenericResults_Usual_fnRecorder[S, E] +} + +// newMoqGenericResults creates a new moq of the GenericResults type +func newMoqGenericResults[S ~string, E error](scene *moq.Scene, config *moq.Config) *moqGenericResults[S, E] { + if config == nil { + config = &moq.Config{} + } + m := &moqGenericResults[S, E]{ + scene: scene, + config: *config, + moq: &moqGenericResults_mock[S, E]{}, + + runtime: struct { + parameterIndexing struct { + Usual struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } + } + }{parameterIndexing: struct { + Usual struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } + }{ + Usual: struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + }{ + param1: moq.ParamIndexByValue, + param2: moq.ParamIndexByValue, + }, + }}, + } + m.moq.moq = m + + scene.AddMoq(m) + return m +} + +// mock returns the mock implementation of the GenericResults type +func (m *moqGenericResults[S, E]) mock() *moqGenericResults_mock[S, E] { return m.moq } + +func (m *moqGenericResults_mock[S, E]) Usual(param1 string, param2 bool) (result1 S, result2 E) { + m.moq.scene.T.Helper() + params := moqGenericResults_Usual_params[S, E]{ + param1: param1, + param2: param2, + } + var results *moqGenericResults_Usual_results[S, E] + for _, resultsByParams := range m.moq.resultsByParams_Usual { + paramsKey := m.moq.paramsKey_Usual(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_Usual(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_Usual(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_Usual(params)) + } + } + + if result.doFn != nil { + result.doFn(param1, param2) + } + + if result.values != nil { + result1 = result.values.result1 + result2 = result.values.result2 + } + if result.doReturnFn != nil { + result1, result2 = result.doReturnFn(param1, param2) + } + return +} + +// onCall returns the recorder implementation of the GenericResults type +func (m *moqGenericResults[S, E]) onCall() *moqGenericResults_recorder[S, E] { + return &moqGenericResults_recorder[S, E]{ + moq: m, + } +} + +func (m *moqGenericResults_recorder[S, E]) Usual(param1 string, param2 bool) *moqGenericResults_Usual_fnRecorder[S, E] { + return &moqGenericResults_Usual_fnRecorder[S, E]{ + params: moqGenericResults_Usual_params[S, E]{ + param1: param1, + param2: param2, }, sequence: m.moq.config.Sequence == moq.SeqDefaultOn, moq: m.moq, } } -func (r *moqUsual_InterfaceParam_fnRecorder) any() *moqUsual_InterfaceParam_anyParams { +func (r *moqGenericResults_Usual_fnRecorder[S, E]) any() *moqGenericResults_Usual_anyParams[S, E] { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_InterfaceParam(r.params)) + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) return nil } - return &moqUsual_InterfaceParam_anyParams{recorder: r} + return &moqGenericResults_Usual_anyParams[S, E]{recorder: r} } -func (a *moqUsual_InterfaceParam_anyParams) w() *moqUsual_InterfaceParam_fnRecorder { +func (a *moqGenericResults_Usual_anyParams[S, E]) param1() *moqGenericResults_Usual_fnRecorder[S, E] { a.recorder.anyParams |= 1 << 0 return a.recorder } -func (r *moqUsual_InterfaceParam_fnRecorder) seq() *moqUsual_InterfaceParam_fnRecorder { +func (a *moqGenericResults_Usual_anyParams[S, E]) param2() *moqGenericResults_Usual_fnRecorder[S, E] { + a.recorder.anyParams |= 1 << 1 + return a.recorder +} + +func (r *moqGenericResults_Usual_fnRecorder[S, E]) seq() *moqGenericResults_Usual_fnRecorder[S, E] { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_InterfaceParam(r.params)) + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) return nil } r.sequence = true return r } -func (r *moqUsual_InterfaceParam_fnRecorder) noSeq() *moqUsual_InterfaceParam_fnRecorder { +func (r *moqGenericResults_Usual_fnRecorder[S, E]) noSeq() *moqGenericResults_Usual_fnRecorder[S, E] { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_InterfaceParam(r.params)) + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) return nil } r.sequence = false return r } -func (r *moqUsual_InterfaceParam_fnRecorder) returnResults(sResult string, err error) *moqUsual_InterfaceParam_fnRecorder { +func (r *moqGenericResults_Usual_fnRecorder[S, E]) returnResults(result1 S, result2 E) *moqGenericResults_Usual_fnRecorder[S, E] { r.moq.scene.T.Helper() r.findResults() @@ -14266,26 +18885,26 @@ func (r *moqUsual_InterfaceParam_fnRecorder) returnResults(sResult string, err e r.results.results = append(r.results.results, struct { values *struct { - sResult string - err error + result1 S + result2 E } sequence uint32 - doFn moqUsual_InterfaceParam_doFn - doReturnFn moqUsual_InterfaceParam_doReturnFn + doFn moqGenericResults_Usual_doFn[S, E] + doReturnFn moqGenericResults_Usual_doReturnFn[S, E] }{ values: &struct { - sResult string - err error + result1 S + result2 E }{ - sResult: sResult, - err: err, + result1: result1, + result2: result2, }, sequence: sequence, }) return r } -func (r *moqUsual_InterfaceParam_fnRecorder) andDo(fn moqUsual_InterfaceParam_doFn) *moqUsual_InterfaceParam_fnRecorder { +func (r *moqGenericResults_Usual_fnRecorder[S, E]) andDo(fn moqGenericResults_Usual_doFn[S, E]) *moqGenericResults_Usual_fnRecorder[S, E] { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") @@ -14296,7 +18915,7 @@ func (r *moqUsual_InterfaceParam_fnRecorder) andDo(fn moqUsual_InterfaceParam_do return r } -func (r *moqUsual_InterfaceParam_fnRecorder) doReturnResults(fn moqUsual_InterfaceParam_doReturnFn) *moqUsual_InterfaceParam_fnRecorder { +func (r *moqGenericResults_Usual_fnRecorder[S, E]) doReturnResults(fn moqGenericResults_Usual_doReturnFn[S, E]) *moqGenericResults_Usual_fnRecorder[S, E] { r.moq.scene.T.Helper() r.findResults() @@ -14307,17 +18926,17 @@ func (r *moqUsual_InterfaceParam_fnRecorder) doReturnResults(fn moqUsual_Interfa r.results.results = append(r.results.results, struct { values *struct { - sResult string - err error + result1 S + result2 E } sequence uint32 - doFn moqUsual_InterfaceParam_doFn - doReturnFn moqUsual_InterfaceParam_doReturnFn + doFn moqGenericResults_Usual_doFn[S, E] + doReturnFn moqGenericResults_Usual_doReturnFn[S, E] }{sequence: sequence, doReturnFn: fn}) return r } -func (r *moqUsual_InterfaceParam_fnRecorder) findResults() { +func (r *moqGenericResults_Usual_fnRecorder[S, E]) findResults() { r.moq.scene.T.Helper() if r.results != nil { r.results.repeat.Increment(r.moq.scene.T) @@ -14326,8 +18945,8 @@ func (r *moqUsual_InterfaceParam_fnRecorder) findResults() { anyCount := bits.OnesCount64(r.anyParams) insertAt := -1 - var results *moqUsual_InterfaceParam_resultsByParams - for n, res := range r.moq.resultsByParams_InterfaceParam { + var results *moqGenericResults_Usual_resultsByParams[S, E] + for n, res := range r.moq.resultsByParams_Usual { if res.anyParams == r.anyParams { results = &res break @@ -14337,24 +18956,24 @@ func (r *moqUsual_InterfaceParam_fnRecorder) findResults() { } } if results == nil { - results = &moqUsual_InterfaceParam_resultsByParams{ + results = &moqGenericResults_Usual_resultsByParams[S, E]{ anyCount: anyCount, anyParams: r.anyParams, - results: map[moqUsual_InterfaceParam_paramsKey]*moqUsual_InterfaceParam_results{}, + results: map[moqGenericResults_Usual_paramsKey[S, E]]*moqGenericResults_Usual_results[S, E]{}, } - r.moq.resultsByParams_InterfaceParam = append(r.moq.resultsByParams_InterfaceParam, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_InterfaceParam) { - copy(r.moq.resultsByParams_InterfaceParam[insertAt+1:], r.moq.resultsByParams_InterfaceParam[insertAt:0]) - r.moq.resultsByParams_InterfaceParam[insertAt] = *results + r.moq.resultsByParams_Usual = append(r.moq.resultsByParams_Usual, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_Usual) { + copy(r.moq.resultsByParams_Usual[insertAt+1:], r.moq.resultsByParams_Usual[insertAt:0]) + r.moq.resultsByParams_Usual[insertAt] = *results } } - paramsKey := r.moq.paramsKey_InterfaceParam(r.params, r.anyParams) + paramsKey := r.moq.paramsKey_Usual(r.params, r.anyParams) var ok bool r.results, ok = results.results[paramsKey] if !ok { - r.results = &moqUsual_InterfaceParam_results{ + r.results = &moqGenericResults_Usual_results[S, E]{ params: r.params, results: nil, index: 0, @@ -14366,7 +18985,7 @@ func (r *moqUsual_InterfaceParam_fnRecorder) findResults() { r.results.repeat.Increment(r.moq.scene.T) } -func (r *moqUsual_InterfaceParam_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_InterfaceParam_fnRecorder { +func (r *moqGenericResults_Usual_fnRecorder[S, E]) repeat(repeaters ...moq.Repeater) *moqGenericResults_Usual_fnRecorder[S, E] { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") @@ -14378,12 +18997,12 @@ func (r *moqUsual_InterfaceParam_fnRecorder) repeat(repeaters ...moq.Repeater) * if r.sequence { last = struct { values *struct { - sResult string - err error + result1 S + result2 E } sequence uint32 - doFn moqUsual_InterfaceParam_doFn - doReturnFn moqUsual_InterfaceParam_doReturnFn + doFn moqGenericResults_Usual_doFn[S, E] + doReturnFn moqGenericResults_Usual_doReturnFn[S, E] }{ values: last.values, sequence: r.moq.scene.NextRecorderSequence(), @@ -14394,82 +19013,323 @@ func (r *moqUsual_InterfaceParam_fnRecorder) repeat(repeaters ...moq.Repeater) * return r } -func (m *moqUsual) prettyParams_InterfaceParam(params moqUsual_InterfaceParam_params) string { - return fmt.Sprintf("InterfaceParam(%#v)", params.w) +func (m *moqGenericResults[S, E]) prettyParams_Usual(params moqGenericResults_Usual_params[S, E]) string { + return fmt.Sprintf("Usual(%#v, %#v)", params.param1, params.param2) } -func (m *moqUsual) paramsKey_InterfaceParam(params moqUsual_InterfaceParam_params, anyParams uint64) moqUsual_InterfaceParam_paramsKey { +func (m *moqGenericResults[S, E]) paramsKey_Usual(params moqGenericResults_Usual_params[S, E], anyParams uint64) moqGenericResults_Usual_paramsKey[S, E] { m.scene.T.Helper() - var wUsed io.Writer - var wUsedHash hash.Hash + var param1Used string + var param1UsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.runtime.parameterIndexing.InterfaceParam.w == moq.ParamIndexByValue { - wUsed = params.w + if m.runtime.parameterIndexing.Usual.param1 == moq.ParamIndexByValue { + param1Used = params.param1 } else { - wUsedHash = hash.DeepHash(params.w) + param1UsedHash = hash.DeepHash(params.param1) } } - return moqUsual_InterfaceParam_paramsKey{ - params: struct{ w io.Writer }{ - w: wUsed, + var param2Used bool + var param2UsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.runtime.parameterIndexing.Usual.param2 == moq.ParamIndexByValue { + param2Used = params.param2 + } else { + param2UsedHash = hash.DeepHash(params.param2) + } + } + return moqGenericResults_Usual_paramsKey[S, E]{ + params: struct { + param1 string + param2 bool + }{ + param1: param1Used, + param2: param2Used, }, - hashes: struct{ w hash.Hash }{ - w: wUsedHash, + hashes: struct { + param1 hash.Hash + param2 hash.Hash + }{ + param1: param1UsedHash, + param2: param2UsedHash, }, } } -func (m *moqUsual_recorder) InterfaceResult(sParam string, bParam bool) *moqUsual_InterfaceResult_fnRecorder { - return &moqUsual_InterfaceResult_fnRecorder{ - params: moqUsual_InterfaceResult_params{ - sParam: sParam, - bParam: bParam, +// Reset resets the state of the moq +func (m *moqGenericResults[S, E]) Reset() { m.resultsByParams_Usual = nil } + +// AssertExpectationsMet asserts that all expectations have been met +func (m *moqGenericResults[S, E]) AssertExpectationsMet() { + m.scene.T.Helper() + for _, res := range m.resultsByParams_Usual { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_Usual(results.params)) + } + } + } +} + +// The following type assertion assures that testmoqs.PartialGenericResults is +// mocked completely +var _ testmoqs.PartialGenericResults[string] = (*moqPartialGenericResults_mock[string])(nil) + +// moqPartialGenericResults holds the state of a moq of the +// PartialGenericResults type +type moqPartialGenericResults[S ~string] struct { + scene *moq.Scene + config moq.Config + moq *moqPartialGenericResults_mock[S] + + resultsByParams_Usual []moqPartialGenericResults_Usual_resultsByParams[S] + + runtime struct { + parameterIndexing struct { + Usual struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } + } + } + // moqPartialGenericResults_mock isolates the mock interface of the +} + +// PartialGenericResults type +type moqPartialGenericResults_mock[S ~string] struct { + moq *moqPartialGenericResults[S] +} + +// moqPartialGenericResults_recorder isolates the recorder interface of the +// PartialGenericResults type +type moqPartialGenericResults_recorder[S ~string] struct { + moq *moqPartialGenericResults[S] +} + +// moqPartialGenericResults_Usual_params holds the params of the +// PartialGenericResults type +type moqPartialGenericResults_Usual_params[S ~string] struct { + param1 string + param2 bool +} + +// moqPartialGenericResults_Usual_paramsKey holds the map key params of the +// PartialGenericResults type +type moqPartialGenericResults_Usual_paramsKey[S ~string] struct { + params struct { + param1 string + param2 bool + } + hashes struct { + param1 hash.Hash + param2 hash.Hash + } +} + +// moqPartialGenericResults_Usual_resultsByParams contains the results for a +// given set of parameters for the PartialGenericResults type +type moqPartialGenericResults_Usual_resultsByParams[S ~string] struct { + anyCount int + anyParams uint64 + results map[moqPartialGenericResults_Usual_paramsKey[S]]*moqPartialGenericResults_Usual_results[S] +} + +// moqPartialGenericResults_Usual_doFn defines the type of function needed when +// calling andDo for the PartialGenericResults type +type moqPartialGenericResults_Usual_doFn[S ~string] func(string, bool) + +// moqPartialGenericResults_Usual_doReturnFn defines the type of function +// needed when calling doReturnResults for the PartialGenericResults type +type moqPartialGenericResults_Usual_doReturnFn[S ~string] func(string, bool) (S, error) + +// moqPartialGenericResults_Usual_results holds the results of the +// PartialGenericResults type +type moqPartialGenericResults_Usual_results[S ~string] struct { + params moqPartialGenericResults_Usual_params[S] + results []struct { + values *struct { + result1 S + result2 error + } + sequence uint32 + doFn moqPartialGenericResults_Usual_doFn[S] + doReturnFn moqPartialGenericResults_Usual_doReturnFn[S] + } + index uint32 + repeat *moq.RepeatVal +} + +// moqPartialGenericResults_Usual_fnRecorder routes recorded function calls to +// the moqPartialGenericResults moq +type moqPartialGenericResults_Usual_fnRecorder[S ~string] struct { + params moqPartialGenericResults_Usual_params[S] + anyParams uint64 + sequence bool + results *moqPartialGenericResults_Usual_results[S] + moq *moqPartialGenericResults[S] +} + +// moqPartialGenericResults_Usual_anyParams isolates the any params functions +// of the PartialGenericResults type +type moqPartialGenericResults_Usual_anyParams[S ~string] struct { + recorder *moqPartialGenericResults_Usual_fnRecorder[S] +} + +// newMoqPartialGenericResults creates a new moq of the PartialGenericResults +// type +func newMoqPartialGenericResults[S ~string](scene *moq.Scene, config *moq.Config) *moqPartialGenericResults[S] { + if config == nil { + config = &moq.Config{} + } + m := &moqPartialGenericResults[S]{ + scene: scene, + config: *config, + moq: &moqPartialGenericResults_mock[S]{}, + + runtime: struct { + parameterIndexing struct { + Usual struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } + } + }{parameterIndexing: struct { + Usual struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + } + }{ + Usual: struct { + param1 moq.ParamIndexing + param2 moq.ParamIndexing + }{ + param1: moq.ParamIndexByValue, + param2: moq.ParamIndexByValue, + }, + }}, + } + m.moq.moq = m + + scene.AddMoq(m) + return m +} + +// mock returns the mock implementation of the PartialGenericResults type +func (m *moqPartialGenericResults[S]) mock() *moqPartialGenericResults_mock[S] { return m.moq } + +func (m *moqPartialGenericResults_mock[S]) Usual(param1 string, param2 bool) (result1 S, result2 error) { + m.moq.scene.T.Helper() + params := moqPartialGenericResults_Usual_params[S]{ + param1: param1, + param2: param2, + } + var results *moqPartialGenericResults_Usual_results[S] + for _, resultsByParams := range m.moq.resultsByParams_Usual { + paramsKey := m.moq.paramsKey_Usual(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_Usual(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_Usual(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_Usual(params)) + } + } + + if result.doFn != nil { + result.doFn(param1, param2) + } + + if result.values != nil { + result1 = result.values.result1 + result2 = result.values.result2 + } + if result.doReturnFn != nil { + result1, result2 = result.doReturnFn(param1, param2) + } + return +} + +// onCall returns the recorder implementation of the PartialGenericResults type +func (m *moqPartialGenericResults[S]) onCall() *moqPartialGenericResults_recorder[S] { + return &moqPartialGenericResults_recorder[S]{ + moq: m, + } +} + +func (m *moqPartialGenericResults_recorder[S]) Usual(param1 string, param2 bool) *moqPartialGenericResults_Usual_fnRecorder[S] { + return &moqPartialGenericResults_Usual_fnRecorder[S]{ + params: moqPartialGenericResults_Usual_params[S]{ + param1: param1, + param2: param2, }, sequence: m.moq.config.Sequence == moq.SeqDefaultOn, moq: m.moq, } } -func (r *moqUsual_InterfaceResult_fnRecorder) any() *moqUsual_InterfaceResult_anyParams { +func (r *moqPartialGenericResults_Usual_fnRecorder[S]) any() *moqPartialGenericResults_Usual_anyParams[S] { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_InterfaceResult(r.params)) + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) return nil } - return &moqUsual_InterfaceResult_anyParams{recorder: r} + return &moqPartialGenericResults_Usual_anyParams[S]{recorder: r} } -func (a *moqUsual_InterfaceResult_anyParams) sParam() *moqUsual_InterfaceResult_fnRecorder { +func (a *moqPartialGenericResults_Usual_anyParams[S]) param1() *moqPartialGenericResults_Usual_fnRecorder[S] { a.recorder.anyParams |= 1 << 0 return a.recorder } -func (a *moqUsual_InterfaceResult_anyParams) bParam() *moqUsual_InterfaceResult_fnRecorder { +func (a *moqPartialGenericResults_Usual_anyParams[S]) param2() *moqPartialGenericResults_Usual_fnRecorder[S] { a.recorder.anyParams |= 1 << 1 return a.recorder } -func (r *moqUsual_InterfaceResult_fnRecorder) seq() *moqUsual_InterfaceResult_fnRecorder { +func (r *moqPartialGenericResults_Usual_fnRecorder[S]) seq() *moqPartialGenericResults_Usual_fnRecorder[S] { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_InterfaceResult(r.params)) + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) return nil } r.sequence = true return r } -func (r *moqUsual_InterfaceResult_fnRecorder) noSeq() *moqUsual_InterfaceResult_fnRecorder { +func (r *moqPartialGenericResults_Usual_fnRecorder[S]) noSeq() *moqPartialGenericResults_Usual_fnRecorder[S] { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_InterfaceResult(r.params)) + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) return nil } r.sequence = false return r } -func (r *moqUsual_InterfaceResult_fnRecorder) returnResults(result1 io.Reader) *moqUsual_InterfaceResult_fnRecorder { +func (r *moqPartialGenericResults_Usual_fnRecorder[S]) returnResults(result1 S, result2 error) *moqPartialGenericResults_Usual_fnRecorder[S] { r.moq.scene.T.Helper() r.findResults() @@ -14479,20 +19339,27 @@ func (r *moqUsual_InterfaceResult_fnRecorder) returnResults(result1 io.Reader) * } r.results.results = append(r.results.results, struct { - values *struct{ result1 io.Reader } + values *struct { + result1 S + result2 error + } sequence uint32 - doFn moqUsual_InterfaceResult_doFn - doReturnFn moqUsual_InterfaceResult_doReturnFn + doFn moqPartialGenericResults_Usual_doFn[S] + doReturnFn moqPartialGenericResults_Usual_doReturnFn[S] }{ - values: &struct{ result1 io.Reader }{ + values: &struct { + result1 S + result2 error + }{ result1: result1, + result2: result2, }, sequence: sequence, }) return r } -func (r *moqUsual_InterfaceResult_fnRecorder) andDo(fn moqUsual_InterfaceResult_doFn) *moqUsual_InterfaceResult_fnRecorder { +func (r *moqPartialGenericResults_Usual_fnRecorder[S]) andDo(fn moqPartialGenericResults_Usual_doFn[S]) *moqPartialGenericResults_Usual_fnRecorder[S] { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") @@ -14503,7 +19370,7 @@ func (r *moqUsual_InterfaceResult_fnRecorder) andDo(fn moqUsual_InterfaceResult_ return r } -func (r *moqUsual_InterfaceResult_fnRecorder) doReturnResults(fn moqUsual_InterfaceResult_doReturnFn) *moqUsual_InterfaceResult_fnRecorder { +func (r *moqPartialGenericResults_Usual_fnRecorder[S]) doReturnResults(fn moqPartialGenericResults_Usual_doReturnFn[S]) *moqPartialGenericResults_Usual_fnRecorder[S] { r.moq.scene.T.Helper() r.findResults() @@ -14513,15 +19380,18 @@ func (r *moqUsual_InterfaceResult_fnRecorder) doReturnResults(fn moqUsual_Interf } r.results.results = append(r.results.results, struct { - values *struct{ result1 io.Reader } + values *struct { + result1 S + result2 error + } sequence uint32 - doFn moqUsual_InterfaceResult_doFn - doReturnFn moqUsual_InterfaceResult_doReturnFn + doFn moqPartialGenericResults_Usual_doFn[S] + doReturnFn moqPartialGenericResults_Usual_doReturnFn[S] }{sequence: sequence, doReturnFn: fn}) return r } -func (r *moqUsual_InterfaceResult_fnRecorder) findResults() { +func (r *moqPartialGenericResults_Usual_fnRecorder[S]) findResults() { r.moq.scene.T.Helper() if r.results != nil { r.results.repeat.Increment(r.moq.scene.T) @@ -14530,8 +19400,8 @@ func (r *moqUsual_InterfaceResult_fnRecorder) findResults() { anyCount := bits.OnesCount64(r.anyParams) insertAt := -1 - var results *moqUsual_InterfaceResult_resultsByParams - for n, res := range r.moq.resultsByParams_InterfaceResult { + var results *moqPartialGenericResults_Usual_resultsByParams[S] + for n, res := range r.moq.resultsByParams_Usual { if res.anyParams == r.anyParams { results = &res break @@ -14541,24 +19411,24 @@ func (r *moqUsual_InterfaceResult_fnRecorder) findResults() { } } if results == nil { - results = &moqUsual_InterfaceResult_resultsByParams{ + results = &moqPartialGenericResults_Usual_resultsByParams[S]{ anyCount: anyCount, anyParams: r.anyParams, - results: map[moqUsual_InterfaceResult_paramsKey]*moqUsual_InterfaceResult_results{}, + results: map[moqPartialGenericResults_Usual_paramsKey[S]]*moqPartialGenericResults_Usual_results[S]{}, } - r.moq.resultsByParams_InterfaceResult = append(r.moq.resultsByParams_InterfaceResult, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_InterfaceResult) { - copy(r.moq.resultsByParams_InterfaceResult[insertAt+1:], r.moq.resultsByParams_InterfaceResult[insertAt:0]) - r.moq.resultsByParams_InterfaceResult[insertAt] = *results + r.moq.resultsByParams_Usual = append(r.moq.resultsByParams_Usual, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_Usual) { + copy(r.moq.resultsByParams_Usual[insertAt+1:], r.moq.resultsByParams_Usual[insertAt:0]) + r.moq.resultsByParams_Usual[insertAt] = *results } } - paramsKey := r.moq.paramsKey_InterfaceResult(r.params, r.anyParams) + paramsKey := r.moq.paramsKey_Usual(r.params, r.anyParams) var ok bool r.results, ok = results.results[paramsKey] if !ok { - r.results = &moqUsual_InterfaceResult_results{ + r.results = &moqPartialGenericResults_Usual_results[S]{ params: r.params, results: nil, index: 0, @@ -14570,7 +19440,7 @@ func (r *moqUsual_InterfaceResult_fnRecorder) findResults() { r.results.repeat.Increment(r.moq.scene.T) } -func (r *moqUsual_InterfaceResult_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_InterfaceResult_fnRecorder { +func (r *moqPartialGenericResults_Usual_fnRecorder[S]) repeat(repeaters ...moq.Repeater) *moqPartialGenericResults_Usual_fnRecorder[S] { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") @@ -14581,10 +19451,13 @@ func (r *moqUsual_InterfaceResult_fnRecorder) repeat(repeaters ...moq.Repeater) for n := 0; n < r.results.repeat.ResultCount-1; n++ { if r.sequence { last = struct { - values *struct{ result1 io.Reader } + values *struct { + result1 S + result2 error + } sequence uint32 - doFn moqUsual_InterfaceResult_doFn - doReturnFn moqUsual_InterfaceResult_doReturnFn + doFn moqPartialGenericResults_Usual_doFn[S] + doReturnFn moqPartialGenericResults_Usual_doReturnFn[S] }{ values: last.values, sequence: r.moq.scene.NextRecorderSequence(), @@ -14595,93 +19468,302 @@ func (r *moqUsual_InterfaceResult_fnRecorder) repeat(repeaters ...moq.Repeater) return r } -func (m *moqUsual) prettyParams_InterfaceResult(params moqUsual_InterfaceResult_params) string { - return fmt.Sprintf("InterfaceResult(%#v, %#v)", params.sParam, params.bParam) +func (m *moqPartialGenericResults[S]) prettyParams_Usual(params moqPartialGenericResults_Usual_params[S]) string { + return fmt.Sprintf("Usual(%#v, %#v)", params.param1, params.param2) } -func (m *moqUsual) paramsKey_InterfaceResult(params moqUsual_InterfaceResult_params, anyParams uint64) moqUsual_InterfaceResult_paramsKey { +func (m *moqPartialGenericResults[S]) paramsKey_Usual(params moqPartialGenericResults_Usual_params[S], anyParams uint64) moqPartialGenericResults_Usual_paramsKey[S] { m.scene.T.Helper() - var sParamUsed string - var sParamUsedHash hash.Hash + var param1Used string + var param1UsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.runtime.parameterIndexing.InterfaceResult.sParam == moq.ParamIndexByValue { - sParamUsed = params.sParam + if m.runtime.parameterIndexing.Usual.param1 == moq.ParamIndexByValue { + param1Used = params.param1 } else { - sParamUsedHash = hash.DeepHash(params.sParam) + param1UsedHash = hash.DeepHash(params.param1) } } - var bParamUsed bool - var bParamUsedHash hash.Hash + var param2Used bool + var param2UsedHash hash.Hash if anyParams&(1<<1) == 0 { - if m.runtime.parameterIndexing.InterfaceResult.bParam == moq.ParamIndexByValue { - bParamUsed = params.bParam + if m.runtime.parameterIndexing.Usual.param2 == moq.ParamIndexByValue { + param2Used = params.param2 } else { - bParamUsedHash = hash.DeepHash(params.bParam) + param2UsedHash = hash.DeepHash(params.param2) } } - return moqUsual_InterfaceResult_paramsKey{ + return moqPartialGenericResults_Usual_paramsKey[S]{ params: struct { - sParam string - bParam bool + param1 string + param2 bool }{ - sParam: sParamUsed, - bParam: bParamUsed, + param1: param1Used, + param2: param2Used, }, hashes: struct { - sParam hash.Hash - bParam hash.Hash + param1 hash.Hash + param2 hash.Hash }{ - sParam: sParamUsedHash, - bParam: bParamUsedHash, + param1: param1UsedHash, + param2: param2UsedHash, }, } } -func (m *moqUsual_recorder) FnParam(fn func()) *moqUsual_FnParam_fnRecorder { - return &moqUsual_FnParam_fnRecorder{ - params: moqUsual_FnParam_params{ - fn: fn, +// Reset resets the state of the moq +func (m *moqPartialGenericResults[S]) Reset() { m.resultsByParams_Usual = nil } + +// AssertExpectationsMet asserts that all expectations have been met +func (m *moqPartialGenericResults[S]) AssertExpectationsMet() { + m.scene.T.Helper() + for _, res := range m.resultsByParams_Usual { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_Usual(results.params)) + } + } + } +} + +// The following type assertion assures that testmoqs.GenericInterfaceParam is +// mocked completely +var _ testmoqs.GenericInterfaceParam[testmoqs.MyWriter] = (*moqGenericInterfaceParam_mock[testmoqs.MyWriter])(nil) + +// moqGenericInterfaceParam holds the state of a moq of the +// GenericInterfaceParam type +type moqGenericInterfaceParam[W testmoqs.MyWriter] struct { + scene *moq.Scene + config moq.Config + moq *moqGenericInterfaceParam_mock[W] + + resultsByParams_Usual []moqGenericInterfaceParam_Usual_resultsByParams[W] + + runtime struct { + parameterIndexing struct { + Usual struct { + w moq.ParamIndexing + } + } + } + // moqGenericInterfaceParam_mock isolates the mock interface of the +} + +// GenericInterfaceParam type +type moqGenericInterfaceParam_mock[W testmoqs.MyWriter] struct { + moq *moqGenericInterfaceParam[W] +} + +// moqGenericInterfaceParam_recorder isolates the recorder interface of the +// GenericInterfaceParam type +type moqGenericInterfaceParam_recorder[W testmoqs.MyWriter] struct { + moq *moqGenericInterfaceParam[W] +} + +// moqGenericInterfaceParam_Usual_params holds the params of the +// GenericInterfaceParam type +type moqGenericInterfaceParam_Usual_params[W testmoqs.MyWriter] struct{ w W } + +// moqGenericInterfaceParam_Usual_paramsKey holds the map key params of the +// GenericInterfaceParam type +type moqGenericInterfaceParam_Usual_paramsKey[W testmoqs.MyWriter] struct { + params struct{} + hashes struct{ w hash.Hash } +} + +// moqGenericInterfaceParam_Usual_resultsByParams contains the results for a +// given set of parameters for the GenericInterfaceParam type +type moqGenericInterfaceParam_Usual_resultsByParams[W testmoqs.MyWriter] struct { + anyCount int + anyParams uint64 + results map[moqGenericInterfaceParam_Usual_paramsKey[W]]*moqGenericInterfaceParam_Usual_results[W] +} + +// moqGenericInterfaceParam_Usual_doFn defines the type of function needed when +// calling andDo for the GenericInterfaceParam type +type moqGenericInterfaceParam_Usual_doFn[W testmoqs.MyWriter] func(w W) + +// moqGenericInterfaceParam_Usual_doReturnFn defines the type of function +// needed when calling doReturnResults for the GenericInterfaceParam type +type moqGenericInterfaceParam_Usual_doReturnFn[W testmoqs.MyWriter] func(w W) (sResult string, err error) + +// moqGenericInterfaceParam_Usual_results holds the results of the +// GenericInterfaceParam type +type moqGenericInterfaceParam_Usual_results[W testmoqs.MyWriter] struct { + params moqGenericInterfaceParam_Usual_params[W] + results []struct { + values *struct { + sResult string + err error + } + sequence uint32 + doFn moqGenericInterfaceParam_Usual_doFn[W] + doReturnFn moqGenericInterfaceParam_Usual_doReturnFn[W] + } + index uint32 + repeat *moq.RepeatVal +} + +// moqGenericInterfaceParam_Usual_fnRecorder routes recorded function calls to +// the moqGenericInterfaceParam moq +type moqGenericInterfaceParam_Usual_fnRecorder[W testmoqs.MyWriter] struct { + params moqGenericInterfaceParam_Usual_params[W] + anyParams uint64 + sequence bool + results *moqGenericInterfaceParam_Usual_results[W] + moq *moqGenericInterfaceParam[W] +} + +// moqGenericInterfaceParam_Usual_anyParams isolates the any params functions +// of the GenericInterfaceParam type +type moqGenericInterfaceParam_Usual_anyParams[W testmoqs.MyWriter] struct { + recorder *moqGenericInterfaceParam_Usual_fnRecorder[W] +} + +// newMoqGenericInterfaceParam creates a new moq of the GenericInterfaceParam +// type +func newMoqGenericInterfaceParam[W testmoqs.MyWriter](scene *moq.Scene, config *moq.Config) *moqGenericInterfaceParam[W] { + if config == nil { + config = &moq.Config{} + } + m := &moqGenericInterfaceParam[W]{ + scene: scene, + config: *config, + moq: &moqGenericInterfaceParam_mock[W]{}, + + runtime: struct { + parameterIndexing struct { + Usual struct { + w moq.ParamIndexing + } + } + }{parameterIndexing: struct { + Usual struct { + w moq.ParamIndexing + } + }{ + Usual: struct { + w moq.ParamIndexing + }{ + w: moq.ParamIndexByHash, + }, + }}, + } + m.moq.moq = m + + scene.AddMoq(m) + return m +} + +// mock returns the mock implementation of the GenericInterfaceParam type +func (m *moqGenericInterfaceParam[W]) mock() *moqGenericInterfaceParam_mock[W] { return m.moq } + +func (m *moqGenericInterfaceParam_mock[W]) Usual(w W) (sResult string, err error) { + m.moq.scene.T.Helper() + params := moqGenericInterfaceParam_Usual_params[W]{ + w: w, + } + var results *moqGenericInterfaceParam_Usual_results[W] + for _, resultsByParams := range m.moq.resultsByParams_Usual { + paramsKey := m.moq.paramsKey_Usual(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_Usual(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_Usual(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_Usual(params)) + } + } + + if result.doFn != nil { + result.doFn(w) + } + + if result.values != nil { + sResult = result.values.sResult + err = result.values.err + } + if result.doReturnFn != nil { + sResult, err = result.doReturnFn(w) + } + return +} + +// onCall returns the recorder implementation of the GenericInterfaceParam type +func (m *moqGenericInterfaceParam[W]) onCall() *moqGenericInterfaceParam_recorder[W] { + return &moqGenericInterfaceParam_recorder[W]{ + moq: m, + } +} + +func (m *moqGenericInterfaceParam_recorder[W]) Usual(w W) *moqGenericInterfaceParam_Usual_fnRecorder[W] { + return &moqGenericInterfaceParam_Usual_fnRecorder[W]{ + params: moqGenericInterfaceParam_Usual_params[W]{ + w: w, }, sequence: m.moq.config.Sequence == moq.SeqDefaultOn, moq: m.moq, } } -func (r *moqUsual_FnParam_fnRecorder) any() *moqUsual_FnParam_anyParams { +func (r *moqGenericInterfaceParam_Usual_fnRecorder[W]) any() *moqGenericInterfaceParam_Usual_anyParams[W] { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_FnParam(r.params)) + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) return nil } - return &moqUsual_FnParam_anyParams{recorder: r} + return &moqGenericInterfaceParam_Usual_anyParams[W]{recorder: r} } -func (a *moqUsual_FnParam_anyParams) fn() *moqUsual_FnParam_fnRecorder { +func (a *moqGenericInterfaceParam_Usual_anyParams[W]) w() *moqGenericInterfaceParam_Usual_fnRecorder[W] { a.recorder.anyParams |= 1 << 0 return a.recorder } -func (r *moqUsual_FnParam_fnRecorder) seq() *moqUsual_FnParam_fnRecorder { +func (r *moqGenericInterfaceParam_Usual_fnRecorder[W]) seq() *moqGenericInterfaceParam_Usual_fnRecorder[W] { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_FnParam(r.params)) + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) return nil } r.sequence = true return r } -func (r *moqUsual_FnParam_fnRecorder) noSeq() *moqUsual_FnParam_fnRecorder { +func (r *moqGenericInterfaceParam_Usual_fnRecorder[W]) noSeq() *moqGenericInterfaceParam_Usual_fnRecorder[W] { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_FnParam(r.params)) + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) return nil } r.sequence = false return r } -func (r *moqUsual_FnParam_fnRecorder) returnResults() *moqUsual_FnParam_fnRecorder { +func (r *moqGenericInterfaceParam_Usual_fnRecorder[W]) returnResults(sResult string, err error) *moqGenericInterfaceParam_Usual_fnRecorder[W] { r.moq.scene.T.Helper() r.findResults() @@ -14691,18 +19773,27 @@ func (r *moqUsual_FnParam_fnRecorder) returnResults() *moqUsual_FnParam_fnRecord } r.results.results = append(r.results.results, struct { - values *struct{} + values *struct { + sResult string + err error + } sequence uint32 - doFn moqUsual_FnParam_doFn - doReturnFn moqUsual_FnParam_doReturnFn + doFn moqGenericInterfaceParam_Usual_doFn[W] + doReturnFn moqGenericInterfaceParam_Usual_doReturnFn[W] }{ - values: &struct{}{}, + values: &struct { + sResult string + err error + }{ + sResult: sResult, + err: err, + }, sequence: sequence, }) return r } -func (r *moqUsual_FnParam_fnRecorder) andDo(fn moqUsual_FnParam_doFn) *moqUsual_FnParam_fnRecorder { +func (r *moqGenericInterfaceParam_Usual_fnRecorder[W]) andDo(fn moqGenericInterfaceParam_Usual_doFn[W]) *moqGenericInterfaceParam_Usual_fnRecorder[W] { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") @@ -14713,7 +19804,7 @@ func (r *moqUsual_FnParam_fnRecorder) andDo(fn moqUsual_FnParam_doFn) *moqUsual_ return r } -func (r *moqUsual_FnParam_fnRecorder) doReturnResults(fn moqUsual_FnParam_doReturnFn) *moqUsual_FnParam_fnRecorder { +func (r *moqGenericInterfaceParam_Usual_fnRecorder[W]) doReturnResults(fn moqGenericInterfaceParam_Usual_doReturnFn[W]) *moqGenericInterfaceParam_Usual_fnRecorder[W] { r.moq.scene.T.Helper() r.findResults() @@ -14723,15 +19814,18 @@ func (r *moqUsual_FnParam_fnRecorder) doReturnResults(fn moqUsual_FnParam_doRetu } r.results.results = append(r.results.results, struct { - values *struct{} + values *struct { + sResult string + err error + } sequence uint32 - doFn moqUsual_FnParam_doFn - doReturnFn moqUsual_FnParam_doReturnFn + doFn moqGenericInterfaceParam_Usual_doFn[W] + doReturnFn moqGenericInterfaceParam_Usual_doReturnFn[W] }{sequence: sequence, doReturnFn: fn}) return r } -func (r *moqUsual_FnParam_fnRecorder) findResults() { +func (r *moqGenericInterfaceParam_Usual_fnRecorder[W]) findResults() { r.moq.scene.T.Helper() if r.results != nil { r.results.repeat.Increment(r.moq.scene.T) @@ -14740,8 +19834,8 @@ func (r *moqUsual_FnParam_fnRecorder) findResults() { anyCount := bits.OnesCount64(r.anyParams) insertAt := -1 - var results *moqUsual_FnParam_resultsByParams - for n, res := range r.moq.resultsByParams_FnParam { + var results *moqGenericInterfaceParam_Usual_resultsByParams[W] + for n, res := range r.moq.resultsByParams_Usual { if res.anyParams == r.anyParams { results = &res break @@ -14751,24 +19845,24 @@ func (r *moqUsual_FnParam_fnRecorder) findResults() { } } if results == nil { - results = &moqUsual_FnParam_resultsByParams{ + results = &moqGenericInterfaceParam_Usual_resultsByParams[W]{ anyCount: anyCount, anyParams: r.anyParams, - results: map[moqUsual_FnParam_paramsKey]*moqUsual_FnParam_results{}, + results: map[moqGenericInterfaceParam_Usual_paramsKey[W]]*moqGenericInterfaceParam_Usual_results[W]{}, } - r.moq.resultsByParams_FnParam = append(r.moq.resultsByParams_FnParam, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_FnParam) { - copy(r.moq.resultsByParams_FnParam[insertAt+1:], r.moq.resultsByParams_FnParam[insertAt:0]) - r.moq.resultsByParams_FnParam[insertAt] = *results + r.moq.resultsByParams_Usual = append(r.moq.resultsByParams_Usual, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_Usual) { + copy(r.moq.resultsByParams_Usual[insertAt+1:], r.moq.resultsByParams_Usual[insertAt:0]) + r.moq.resultsByParams_Usual[insertAt] = *results } } - paramsKey := r.moq.paramsKey_FnParam(r.params, r.anyParams) + paramsKey := r.moq.paramsKey_Usual(r.params, r.anyParams) var ok bool r.results, ok = results.results[paramsKey] if !ok { - r.results = &moqUsual_FnParam_results{ + r.results = &moqGenericInterfaceParam_Usual_results[W]{ params: r.params, results: nil, index: 0, @@ -14780,7 +19874,7 @@ func (r *moqUsual_FnParam_fnRecorder) findResults() { r.results.repeat.Increment(r.moq.scene.T) } -func (r *moqUsual_FnParam_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_FnParam_fnRecorder { +func (r *moqGenericInterfaceParam_Usual_fnRecorder[W]) repeat(repeaters ...moq.Repeater) *moqGenericInterfaceParam_Usual_fnRecorder[W] { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") @@ -14791,10 +19885,13 @@ func (r *moqUsual_FnParam_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsua for n := 0; n < r.results.repeat.ResultCount-1; n++ { if r.sequence { last = struct { - values *struct{} + values *struct { + sResult string + err error + } sequence uint32 - doFn moqUsual_FnParam_doFn - doReturnFn moqUsual_FnParam_doReturnFn + doFn moqGenericInterfaceParam_Usual_doFn[W] + doReturnFn moqGenericInterfaceParam_Usual_doReturnFn[W] }{ values: last.values, sequence: r.moq.scene.NextRecorderSequence(), @@ -14805,72 +19902,299 @@ func (r *moqUsual_FnParam_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsua return r } -func (m *moqUsual) prettyParams_FnParam(params moqUsual_FnParam_params) string { - return fmt.Sprintf("FnParam(%#v)", moq.FnString(params.fn)) +func (m *moqGenericInterfaceParam[W]) prettyParams_Usual(params moqGenericInterfaceParam_Usual_params[W]) string { + return fmt.Sprintf("Usual(%#v)", params.w) } -func (m *moqUsual) paramsKey_FnParam(params moqUsual_FnParam_params, anyParams uint64) moqUsual_FnParam_paramsKey { +func (m *moqGenericInterfaceParam[W]) paramsKey_Usual(params moqGenericInterfaceParam_Usual_params[W], anyParams uint64) moqGenericInterfaceParam_Usual_paramsKey[W] { m.scene.T.Helper() - var fnUsedHash hash.Hash + var wUsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.runtime.parameterIndexing.FnParam.fn == moq.ParamIndexByValue { - m.scene.T.Fatalf("The fn parameter of the FnParam function can't be indexed by value") + if m.runtime.parameterIndexing.Usual.w == moq.ParamIndexByValue { + m.scene.T.Fatalf("The w parameter of the Usual function can't be indexed by value") } - fnUsedHash = hash.DeepHash(params.fn) + wUsedHash = hash.DeepHash(params.w) } - return moqUsual_FnParam_paramsKey{ + return moqGenericInterfaceParam_Usual_paramsKey[W]{ params: struct{}{}, - hashes: struct{ fn hash.Hash }{ - fn: fnUsedHash, + hashes: struct{ w hash.Hash }{ + w: wUsedHash, }, } } -func (m *moqUsual_recorder) Other(param1 other.Params) *moqUsual_Other_fnRecorder { - return &moqUsual_Other_fnRecorder{ - params: moqUsual_Other_params{ - param1: param1, +// Reset resets the state of the moq +func (m *moqGenericInterfaceParam[W]) Reset() { m.resultsByParams_Usual = nil } + +// AssertExpectationsMet asserts that all expectations have been met +func (m *moqGenericInterfaceParam[W]) AssertExpectationsMet() { + m.scene.T.Helper() + for _, res := range m.resultsByParams_Usual { + for _, results := range res.results { + missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) + if missing > 0 { + m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_Usual(results.params)) + } + } + } +} + +// The following type assertion assures that testmoqs.GenericInterfaceResult is +// mocked completely +var _ testmoqs.GenericInterfaceResult[testmoqs.MyReader] = (*moqGenericInterfaceResult_mock[testmoqs.MyReader])(nil) + +// moqGenericInterfaceResult holds the state of a moq of the +// GenericInterfaceResult type +type moqGenericInterfaceResult[R testmoqs.MyReader] struct { + scene *moq.Scene + config moq.Config + moq *moqGenericInterfaceResult_mock[R] + + resultsByParams_Usual []moqGenericInterfaceResult_Usual_resultsByParams[R] + + runtime struct { + parameterIndexing struct { + Usual struct { + sParam moq.ParamIndexing + bParam moq.ParamIndexing + } + } + } + // moqGenericInterfaceResult_mock isolates the mock interface of the +} + +// GenericInterfaceResult type +type moqGenericInterfaceResult_mock[R testmoqs.MyReader] struct { + moq *moqGenericInterfaceResult[R] +} + +// moqGenericInterfaceResult_recorder isolates the recorder interface of the +// GenericInterfaceResult type +type moqGenericInterfaceResult_recorder[R testmoqs.MyReader] struct { + moq *moqGenericInterfaceResult[R] +} + +// moqGenericInterfaceResult_Usual_params holds the params of the +// GenericInterfaceResult type +type moqGenericInterfaceResult_Usual_params[R testmoqs.MyReader] struct { + sParam string + bParam bool +} + +// moqGenericInterfaceResult_Usual_paramsKey holds the map key params of the +// GenericInterfaceResult type +type moqGenericInterfaceResult_Usual_paramsKey[R testmoqs.MyReader] struct { + params struct { + sParam string + bParam bool + } + hashes struct { + sParam hash.Hash + bParam hash.Hash + } +} + +// moqGenericInterfaceResult_Usual_resultsByParams contains the results for a +// given set of parameters for the GenericInterfaceResult type +type moqGenericInterfaceResult_Usual_resultsByParams[R testmoqs.MyReader] struct { + anyCount int + anyParams uint64 + results map[moqGenericInterfaceResult_Usual_paramsKey[R]]*moqGenericInterfaceResult_Usual_results[R] +} + +// moqGenericInterfaceResult_Usual_doFn defines the type of function needed +// when calling andDo for the GenericInterfaceResult type +type moqGenericInterfaceResult_Usual_doFn[R testmoqs.MyReader] func(sParam string, bParam bool) + +// moqGenericInterfaceResult_Usual_doReturnFn defines the type of function +// needed when calling doReturnResults for the GenericInterfaceResult type +type moqGenericInterfaceResult_Usual_doReturnFn[R testmoqs.MyReader] func(sParam string, bParam bool) (r R) + +// moqGenericInterfaceResult_Usual_results holds the results of the +// GenericInterfaceResult type +type moqGenericInterfaceResult_Usual_results[R testmoqs.MyReader] struct { + params moqGenericInterfaceResult_Usual_params[R] + results []struct { + values *struct{ result1 R } + sequence uint32 + doFn moqGenericInterfaceResult_Usual_doFn[R] + doReturnFn moqGenericInterfaceResult_Usual_doReturnFn[R] + } + index uint32 + repeat *moq.RepeatVal +} + +// moqGenericInterfaceResult_Usual_fnRecorder routes recorded function calls to +// the moqGenericInterfaceResult moq +type moqGenericInterfaceResult_Usual_fnRecorder[R testmoqs.MyReader] struct { + params moqGenericInterfaceResult_Usual_params[R] + anyParams uint64 + sequence bool + results *moqGenericInterfaceResult_Usual_results[R] + moq *moqGenericInterfaceResult[R] +} + +// moqGenericInterfaceResult_Usual_anyParams isolates the any params functions +// of the GenericInterfaceResult type +type moqGenericInterfaceResult_Usual_anyParams[R testmoqs.MyReader] struct { + recorder *moqGenericInterfaceResult_Usual_fnRecorder[R] +} + +// newMoqGenericInterfaceResult creates a new moq of the GenericInterfaceResult +// type +func newMoqGenericInterfaceResult[R testmoqs.MyReader](scene *moq.Scene, config *moq.Config) *moqGenericInterfaceResult[R] { + if config == nil { + config = &moq.Config{} + } + m := &moqGenericInterfaceResult[R]{ + scene: scene, + config: *config, + moq: &moqGenericInterfaceResult_mock[R]{}, + + runtime: struct { + parameterIndexing struct { + Usual struct { + sParam moq.ParamIndexing + bParam moq.ParamIndexing + } + } + }{parameterIndexing: struct { + Usual struct { + sParam moq.ParamIndexing + bParam moq.ParamIndexing + } + }{ + Usual: struct { + sParam moq.ParamIndexing + bParam moq.ParamIndexing + }{ + sParam: moq.ParamIndexByValue, + bParam: moq.ParamIndexByValue, + }, + }}, + } + m.moq.moq = m + + scene.AddMoq(m) + return m +} + +// mock returns the mock implementation of the GenericInterfaceResult type +func (m *moqGenericInterfaceResult[R]) mock() *moqGenericInterfaceResult_mock[R] { return m.moq } + +func (m *moqGenericInterfaceResult_mock[R]) Usual(sParam string, bParam bool) (result1 R) { + m.moq.scene.T.Helper() + params := moqGenericInterfaceResult_Usual_params[R]{ + sParam: sParam, + bParam: bParam, + } + var results *moqGenericInterfaceResult_Usual_results[R] + for _, resultsByParams := range m.moq.resultsByParams_Usual { + paramsKey := m.moq.paramsKey_Usual(params, resultsByParams.anyParams) + var ok bool + results, ok = resultsByParams.results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Unexpected call to %s", m.moq.prettyParams_Usual(params)) + } + return + } + + i := int(atomic.AddUint32(&results.index, 1)) - 1 + if i >= results.repeat.ResultCount { + if !results.repeat.AnyTimes { + if m.moq.config.Expectation == moq.Strict { + m.moq.scene.T.Fatalf("Too many calls to %s", m.moq.prettyParams_Usual(params)) + } + return + } + i = results.repeat.ResultCount - 1 + } + + result := results.results[i] + if result.sequence != 0 { + sequence := m.moq.scene.NextMockSequence() + if (!results.repeat.AnyTimes && result.sequence != sequence) || result.sequence > sequence { + m.moq.scene.T.Fatalf("Call sequence does not match call to %s", m.moq.prettyParams_Usual(params)) + } + } + + if result.doFn != nil { + result.doFn(sParam, bParam) + } + + if result.values != nil { + result1 = result.values.result1 + } + if result.doReturnFn != nil { + result1 = result.doReturnFn(sParam, bParam) + } + return +} + +// onCall returns the recorder implementation of the GenericInterfaceResult +// type +func (m *moqGenericInterfaceResult[R]) onCall() *moqGenericInterfaceResult_recorder[R] { + return &moqGenericInterfaceResult_recorder[R]{ + moq: m, + } +} + +func (m *moqGenericInterfaceResult_recorder[R]) Usual(sParam string, bParam bool) *moqGenericInterfaceResult_Usual_fnRecorder[R] { + return &moqGenericInterfaceResult_Usual_fnRecorder[R]{ + params: moqGenericInterfaceResult_Usual_params[R]{ + sParam: sParam, + bParam: bParam, }, sequence: m.moq.config.Sequence == moq.SeqDefaultOn, moq: m.moq, } } -func (r *moqUsual_Other_fnRecorder) any() *moqUsual_Other_anyParams { +func (r *moqGenericInterfaceResult_Usual_fnRecorder[R]) any() *moqGenericInterfaceResult_Usual_anyParams[R] { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Other(r.params)) + r.moq.scene.T.Fatalf("Any functions must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) return nil } - return &moqUsual_Other_anyParams{recorder: r} + return &moqGenericInterfaceResult_Usual_anyParams[R]{recorder: r} } -func (a *moqUsual_Other_anyParams) param1() *moqUsual_Other_fnRecorder { +func (a *moqGenericInterfaceResult_Usual_anyParams[R]) sParam() *moqGenericInterfaceResult_Usual_fnRecorder[R] { a.recorder.anyParams |= 1 << 0 return a.recorder } -func (r *moqUsual_Other_fnRecorder) seq() *moqUsual_Other_fnRecorder { +func (a *moqGenericInterfaceResult_Usual_anyParams[R]) bParam() *moqGenericInterfaceResult_Usual_fnRecorder[R] { + a.recorder.anyParams |= 1 << 1 + return a.recorder +} + +func (r *moqGenericInterfaceResult_Usual_fnRecorder[R]) seq() *moqGenericInterfaceResult_Usual_fnRecorder[R] { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Other(r.params)) + r.moq.scene.T.Fatalf("seq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) return nil } r.sequence = true return r } -func (r *moqUsual_Other_fnRecorder) noSeq() *moqUsual_Other_fnRecorder { +func (r *moqGenericInterfaceResult_Usual_fnRecorder[R]) noSeq() *moqGenericInterfaceResult_Usual_fnRecorder[R] { r.moq.scene.T.Helper() if r.results != nil { - r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Other(r.params)) + r.moq.scene.T.Fatalf("noSeq must be called before returnResults or doReturnResults calls, recording %s", r.moq.prettyParams_Usual(r.params)) return nil } r.sequence = false return r } -func (r *moqUsual_Other_fnRecorder) returnResults(result1 other.Results) *moqUsual_Other_fnRecorder { +func (r *moqGenericInterfaceResult_Usual_fnRecorder[R]) returnResults(result1 R) *moqGenericInterfaceResult_Usual_fnRecorder[R] { r.moq.scene.T.Helper() r.findResults() @@ -14880,16 +20204,12 @@ func (r *moqUsual_Other_fnRecorder) returnResults(result1 other.Results) *moqUsu } r.results.results = append(r.results.results, struct { - values *struct { - result1 other.Results - } - sequence uint32 - doFn moqUsual_Other_doFn - doReturnFn moqUsual_Other_doReturnFn - }{ - values: &struct { - result1 other.Results - }{ + values *struct{ result1 R } + sequence uint32 + doFn moqGenericInterfaceResult_Usual_doFn[R] + doReturnFn moqGenericInterfaceResult_Usual_doReturnFn[R] + }{ + values: &struct{ result1 R }{ result1: result1, }, sequence: sequence, @@ -14897,7 +20217,7 @@ func (r *moqUsual_Other_fnRecorder) returnResults(result1 other.Results) *moqUsu return r } -func (r *moqUsual_Other_fnRecorder) andDo(fn moqUsual_Other_doFn) *moqUsual_Other_fnRecorder { +func (r *moqGenericInterfaceResult_Usual_fnRecorder[R]) andDo(fn moqGenericInterfaceResult_Usual_doFn[R]) *moqGenericInterfaceResult_Usual_fnRecorder[R] { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults must be called before calling andDo") @@ -14908,7 +20228,7 @@ func (r *moqUsual_Other_fnRecorder) andDo(fn moqUsual_Other_doFn) *moqUsual_Othe return r } -func (r *moqUsual_Other_fnRecorder) doReturnResults(fn moqUsual_Other_doReturnFn) *moqUsual_Other_fnRecorder { +func (r *moqGenericInterfaceResult_Usual_fnRecorder[R]) doReturnResults(fn moqGenericInterfaceResult_Usual_doReturnFn[R]) *moqGenericInterfaceResult_Usual_fnRecorder[R] { r.moq.scene.T.Helper() r.findResults() @@ -14918,17 +20238,15 @@ func (r *moqUsual_Other_fnRecorder) doReturnResults(fn moqUsual_Other_doReturnFn } r.results.results = append(r.results.results, struct { - values *struct { - result1 other.Results - } + values *struct{ result1 R } sequence uint32 - doFn moqUsual_Other_doFn - doReturnFn moqUsual_Other_doReturnFn + doFn moqGenericInterfaceResult_Usual_doFn[R] + doReturnFn moqGenericInterfaceResult_Usual_doReturnFn[R] }{sequence: sequence, doReturnFn: fn}) return r } -func (r *moqUsual_Other_fnRecorder) findResults() { +func (r *moqGenericInterfaceResult_Usual_fnRecorder[R]) findResults() { r.moq.scene.T.Helper() if r.results != nil { r.results.repeat.Increment(r.moq.scene.T) @@ -14937,8 +20255,8 @@ func (r *moqUsual_Other_fnRecorder) findResults() { anyCount := bits.OnesCount64(r.anyParams) insertAt := -1 - var results *moqUsual_Other_resultsByParams - for n, res := range r.moq.resultsByParams_Other { + var results *moqGenericInterfaceResult_Usual_resultsByParams[R] + for n, res := range r.moq.resultsByParams_Usual { if res.anyParams == r.anyParams { results = &res break @@ -14948,24 +20266,24 @@ func (r *moqUsual_Other_fnRecorder) findResults() { } } if results == nil { - results = &moqUsual_Other_resultsByParams{ + results = &moqGenericInterfaceResult_Usual_resultsByParams[R]{ anyCount: anyCount, anyParams: r.anyParams, - results: map[moqUsual_Other_paramsKey]*moqUsual_Other_results{}, + results: map[moqGenericInterfaceResult_Usual_paramsKey[R]]*moqGenericInterfaceResult_Usual_results[R]{}, } - r.moq.resultsByParams_Other = append(r.moq.resultsByParams_Other, *results) - if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_Other) { - copy(r.moq.resultsByParams_Other[insertAt+1:], r.moq.resultsByParams_Other[insertAt:0]) - r.moq.resultsByParams_Other[insertAt] = *results + r.moq.resultsByParams_Usual = append(r.moq.resultsByParams_Usual, *results) + if insertAt != -1 && insertAt+1 < len(r.moq.resultsByParams_Usual) { + copy(r.moq.resultsByParams_Usual[insertAt+1:], r.moq.resultsByParams_Usual[insertAt:0]) + r.moq.resultsByParams_Usual[insertAt] = *results } } - paramsKey := r.moq.paramsKey_Other(r.params, r.anyParams) + paramsKey := r.moq.paramsKey_Usual(r.params, r.anyParams) var ok bool r.results, ok = results.results[paramsKey] if !ok { - r.results = &moqUsual_Other_results{ + r.results = &moqGenericInterfaceResult_Usual_results[R]{ params: r.params, results: nil, index: 0, @@ -14977,7 +20295,7 @@ func (r *moqUsual_Other_fnRecorder) findResults() { r.results.repeat.Increment(r.moq.scene.T) } -func (r *moqUsual_Other_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_Other_fnRecorder { +func (r *moqGenericInterfaceResult_Usual_fnRecorder[R]) repeat(repeaters ...moq.Repeater) *moqGenericInterfaceResult_Usual_fnRecorder[R] { r.moq.scene.T.Helper() if r.results == nil { r.moq.scene.T.Fatalf("returnResults or doReturnResults must be called before calling repeat") @@ -14988,12 +20306,10 @@ func (r *moqUsual_Other_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_ for n := 0; n < r.results.repeat.ResultCount-1; n++ { if r.sequence { last = struct { - values *struct { - result1 other.Results - } + values *struct{ result1 R } sequence uint32 - doFn moqUsual_Other_doFn - doReturnFn moqUsual_Other_doReturnFn + doFn moqGenericInterfaceResult_Usual_doFn[R] + doReturnFn moqGenericInterfaceResult_Usual_doReturnFn[R] }{ values: last.values, sequence: r.moq.scene.NextRecorderSequence(), @@ -15004,58 +20320,53 @@ func (r *moqUsual_Other_fnRecorder) repeat(repeaters ...moq.Repeater) *moqUsual_ return r } -func (m *moqUsual) prettyParams_Other(params moqUsual_Other_params) string { - return fmt.Sprintf("Other(%#v)", params.param1) +func (m *moqGenericInterfaceResult[R]) prettyParams_Usual(params moqGenericInterfaceResult_Usual_params[R]) string { + return fmt.Sprintf("Usual(%#v, %#v)", params.sParam, params.bParam) } -func (m *moqUsual) paramsKey_Other(params moqUsual_Other_params, anyParams uint64) moqUsual_Other_paramsKey { +func (m *moqGenericInterfaceResult[R]) paramsKey_Usual(params moqGenericInterfaceResult_Usual_params[R], anyParams uint64) moqGenericInterfaceResult_Usual_paramsKey[R] { m.scene.T.Helper() - var param1Used other.Params - var param1UsedHash hash.Hash + var sParamUsed string + var sParamUsedHash hash.Hash if anyParams&(1<<0) == 0 { - if m.runtime.parameterIndexing.Other.param1 == moq.ParamIndexByValue { - param1Used = params.param1 + if m.runtime.parameterIndexing.Usual.sParam == moq.ParamIndexByValue { + sParamUsed = params.sParam } else { - param1UsedHash = hash.DeepHash(params.param1) + sParamUsedHash = hash.DeepHash(params.sParam) } } - return moqUsual_Other_paramsKey{ - params: struct{ param1 other.Params }{ - param1: param1Used, + var bParamUsed bool + var bParamUsedHash hash.Hash + if anyParams&(1<<1) == 0 { + if m.runtime.parameterIndexing.Usual.bParam == moq.ParamIndexByValue { + bParamUsed = params.bParam + } else { + bParamUsedHash = hash.DeepHash(params.bParam) + } + } + return moqGenericInterfaceResult_Usual_paramsKey[R]{ + params: struct { + sParam string + bParam bool + }{ + sParam: sParamUsed, + bParam: bParamUsed, }, - hashes: struct{ param1 hash.Hash }{ - param1: param1UsedHash, + hashes: struct { + sParam hash.Hash + bParam hash.Hash + }{ + sParam: sParamUsedHash, + bParam: bParamUsedHash, }, } } // Reset resets the state of the moq -func (m *moqUsual) Reset() { - m.resultsByParams_Usual = nil - m.resultsByParams_NoNames = nil - m.resultsByParams_NoResults = nil - m.resultsByParams_NoParams = nil - m.resultsByParams_Nothing = nil - m.resultsByParams_Variadic = nil - m.resultsByParams_RepeatedIds = nil - m.resultsByParams_Times = nil - m.resultsByParams_DifficultParamNames = nil - m.resultsByParams_DifficultResultNames = nil - m.resultsByParams_PassByArray = nil - m.resultsByParams_PassByChan = nil - m.resultsByParams_PassByEllipsis = nil - m.resultsByParams_PassByMap = nil - m.resultsByParams_PassByReference = nil - m.resultsByParams_PassBySlice = nil - m.resultsByParams_PassByValue = nil - m.resultsByParams_InterfaceParam = nil - m.resultsByParams_InterfaceResult = nil - m.resultsByParams_FnParam = nil - m.resultsByParams_Other = nil -} +func (m *moqGenericInterfaceResult[R]) Reset() { m.resultsByParams_Usual = nil } // AssertExpectationsMet asserts that all expectations have been met -func (m *moqUsual) AssertExpectationsMet() { +func (m *moqGenericInterfaceResult[R]) AssertExpectationsMet() { m.scene.T.Helper() for _, res := range m.resultsByParams_Usual { for _, results := range res.results { @@ -15065,164 +20376,4 @@ func (m *moqUsual) AssertExpectationsMet() { } } } - for _, res := range m.resultsByParams_NoNames { - for _, results := range res.results { - missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) - if missing > 0 { - m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_NoNames(results.params)) - } - } - } - for _, res := range m.resultsByParams_NoResults { - for _, results := range res.results { - missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) - if missing > 0 { - m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_NoResults(results.params)) - } - } - } - for _, res := range m.resultsByParams_NoParams { - for _, results := range res.results { - missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) - if missing > 0 { - m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_NoParams(results.params)) - } - } - } - for _, res := range m.resultsByParams_Nothing { - for _, results := range res.results { - missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) - if missing > 0 { - m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_Nothing(results.params)) - } - } - } - for _, res := range m.resultsByParams_Variadic { - for _, results := range res.results { - missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) - if missing > 0 { - m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_Variadic(results.params)) - } - } - } - for _, res := range m.resultsByParams_RepeatedIds { - for _, results := range res.results { - missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) - if missing > 0 { - m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_RepeatedIds(results.params)) - } - } - } - for _, res := range m.resultsByParams_Times { - for _, results := range res.results { - missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) - if missing > 0 { - m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_Times(results.params)) - } - } - } - for _, res := range m.resultsByParams_DifficultParamNames { - for _, results := range res.results { - missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) - if missing > 0 { - m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_DifficultParamNames(results.params)) - } - } - } - for _, res := range m.resultsByParams_DifficultResultNames { - for _, results := range res.results { - missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) - if missing > 0 { - m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_DifficultResultNames(results.params)) - } - } - } - for _, res := range m.resultsByParams_PassByArray { - for _, results := range res.results { - missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) - if missing > 0 { - m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_PassByArray(results.params)) - } - } - } - for _, res := range m.resultsByParams_PassByChan { - for _, results := range res.results { - missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) - if missing > 0 { - m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_PassByChan(results.params)) - } - } - } - for _, res := range m.resultsByParams_PassByEllipsis { - for _, results := range res.results { - missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) - if missing > 0 { - m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_PassByEllipsis(results.params)) - } - } - } - for _, res := range m.resultsByParams_PassByMap { - for _, results := range res.results { - missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) - if missing > 0 { - m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_PassByMap(results.params)) - } - } - } - for _, res := range m.resultsByParams_PassByReference { - for _, results := range res.results { - missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) - if missing > 0 { - m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_PassByReference(results.params)) - } - } - } - for _, res := range m.resultsByParams_PassBySlice { - for _, results := range res.results { - missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) - if missing > 0 { - m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_PassBySlice(results.params)) - } - } - } - for _, res := range m.resultsByParams_PassByValue { - for _, results := range res.results { - missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) - if missing > 0 { - m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_PassByValue(results.params)) - } - } - } - for _, res := range m.resultsByParams_InterfaceParam { - for _, results := range res.results { - missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) - if missing > 0 { - m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_InterfaceParam(results.params)) - } - } - } - for _, res := range m.resultsByParams_InterfaceResult { - for _, results := range res.results { - missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) - if missing > 0 { - m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_InterfaceResult(results.params)) - } - } - } - for _, res := range m.resultsByParams_FnParam { - for _, results := range res.results { - missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) - if missing > 0 { - m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_FnParam(results.params)) - } - } - } - for _, res := range m.resultsByParams_Other { - for _, results := range res.results { - missing := results.repeat.MinTimes - int(atomic.LoadUint32(&results.index)) - if missing > 0 { - m.scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.prettyParams_Other(results.params)) - } - } - } } diff --git a/generator/testmoqs/other/types.go b/generator/testmoqs/other/types.go index 8cab19b..8ff1f4b 100644 --- a/generator/testmoqs/other/types.go +++ b/generator/testmoqs/other/types.go @@ -18,6 +18,5 @@ type Results struct { } type Another interface { - //nolint:inamedparam // Testing interface method with unnamed param Other(Params) Results } diff --git a/generator/testmoqs/testmoqs_test.go b/generator/testmoqs/testmoqs_test.go index c15f47d..e40e7cc 100644 --- a/generator/testmoqs/testmoqs_test.go +++ b/generator/testmoqs/testmoqs_test.go @@ -76,6 +76,14 @@ func testCases(t *testing.T, c moq.Config) map[string]adaptor { usualMoq := newMoqUsual(moqScene, &c) exportUsualMoq := exported.NewMoqUsual(moqScene, &c) + genericParamsMoq := newMoqGenericParams[string, bool](moqScene, &c) + exportedGenericParamsMoq := exported.NewMoqGenericParams[string, bool](moqScene, &c) + partialGenericParamsMoq := newMoqPartialGenericParams[string](moqScene, &c) + exportedPartialGenericParamsMoq := exported.NewMoqPartialGenericParams[string](moqScene, &c) + genericResultsMoq := newMoqGenericResults[string, error](moqScene, &c) + exportedGenericResultsMoq := exported.NewMoqGenericResults[string, error](moqScene, &c) + partialGenericResultsMoq := newMoqPartialGenericResults[string](moqScene, &c) + exportedPartialGenericResultsMoq := exported.NewMoqPartialGenericResults[string](moqScene, &c) //nolint:lll // chopped down entries are reverted by gofumpt entries := map[string]adaptor{ "usual fn": &usualFnAdaptor{m: newMoqUsualFn(moqScene, &c)}, @@ -104,6 +112,30 @@ func testCases(t *testing.T, c moq.Config) map[string]adaptor { "exported interface param fn": &exportedInterfaceParamFnAdaptor{m: exported.NewMoqInterfaceParamFn(moqScene, &c)}, "interface result fn": &interfaceResultFnAdaptor{m: newMoqInterfaceResultFn(moqScene, &c)}, "exported interface result param fn": &exportedInterfaceResultFnAdaptor{m: exported.NewMoqInterfaceResultFn(moqScene, &c)}, + "generic params fn": &genericParamsFnAdaptor[string, bool]{ + m: newMoqGenericParamsFn[string, bool](moqScene, &c), + }, + "exported generic params fn": &exportedGenericParamsFnAdaptor[string, bool]{ + m: exported.NewMoqGenericParamsFn[string, bool](moqScene, &c), + }, + "partial generic params fn": &partialGenericParamsFnAdaptor[string]{ + m: newMoqPartialGenericParamsFn[string](moqScene, &c), + }, + "exported partial generic params fn": &exportedPartialGenericParamsFnAdaptor[string]{ + m: exported.NewMoqPartialGenericParamsFn[string](moqScene, &c), + }, + "generic results fn": &genericResultsFnAdaptor[string, error]{ + m: newMoqGenericResultsFn[string, error](moqScene, &c), + }, + "exported generic results fn": &exportedGenericResultsFnAdaptor[string, error]{ + m: exported.NewMoqGenericResultsFn[string, error](moqScene, &c), + }, + "partial generic results fn": &partialGenericResultsFnAdaptor[string]{ + m: newMoqPartialGenericResultsFn[string](moqScene, &c), + }, + "partial exported generic results fn": &exportedPartialGenericResultsFnAdaptor[string]{ + m: exported.NewMoqPartialGenericResultsFn[string](moqScene, &c), + }, "usual": &usualAdaptor{m: usualMoq}, "exported usual": &exportedUsualAdaptor{m: exportUsualMoq}, @@ -131,6 +163,20 @@ func testCases(t *testing.T, c moq.Config) map[string]adaptor { "exported interface param": &exportedInterfaceParamAdaptor{m: exportUsualMoq}, "interface result": &interfaceResultAdaptor{m: usualMoq}, "exported interface result param": &exportedInterfaceResultAdaptor{m: exportUsualMoq}, + "generic params": &genericParamsAdaptor[string, bool]{m: genericParamsMoq}, + "exported generic params": &exportedGenericParamsAdaptor[string, bool]{m: exportedGenericParamsMoq}, + "partial generic params": &partialGenericParamsAdaptor[string]{m: partialGenericParamsMoq}, + "partial exported generic params": &exportedPartialGenericParamsAdaptor[string]{ + m: exportedPartialGenericParamsMoq, + }, + "generic results": &genericResultsAdaptor[string, error]{m: genericResultsMoq}, + "exported generic results": &exportedGenericResultsAdaptor[string, error]{ + m: exportedGenericResultsMoq, + }, + "partial generic results": &partialGenericResultsAdaptor[string]{m: partialGenericResultsMoq}, + "exported partial generic results": &exportedPartialGenericResultsAdaptor[string]{ + m: exportedPartialGenericResultsMoq, + }, } return entries diff --git a/generator/testmoqs/types.go b/generator/testmoqs/types.go index a7b11d8..3659a10 100644 --- a/generator/testmoqs/types.go +++ b/generator/testmoqs/types.go @@ -8,10 +8,12 @@ import ( "moqueries.org/cli/generator/testmoqs/other" ) +// TODO: Need to have a full copy of this file in a test package? + // NB: Keep in sync with ../generator_test.go TestGenerating -//go:generate moqueries --destination moq_testmoqs_test.go UsualFn NoNamesFn NoResultsFn NoParamsFn NothingFn VariadicFn RepeatedIdsFn TimesFn DifficultParamNamesFn DifficultResultNamesFn PassByArrayFn PassByChanFn PassByEllipsisFn PassByMapFn PassByReferenceFn PassBySliceFn PassByValueFn InterfaceParamFn InterfaceResultFn Usual -//go:generate moqueries --destination exported/moq_exported_testmoqs.go --export UsualFn NoNamesFn NoResultsFn NoParamsFn NothingFn VariadicFn RepeatedIdsFn TimesFn DifficultParamNamesFn DifficultResultNamesFn PassByArrayFn PassByChanFn PassByEllipsisFn PassByMapFn PassByReferenceFn PassBySliceFn PassByValueFn InterfaceParamFn InterfaceResultFn Usual +//go:generate moqueries --destination moq_testmoqs_test.go UsualFn NoNamesFn NoResultsFn NoParamsFn NothingFn VariadicFn RepeatedIdsFn TimesFn DifficultParamNamesFn DifficultResultNamesFn PassByArrayFn PassByChanFn PassByEllipsisFn PassByMapFn PassByReferenceFn PassBySliceFn PassByValueFn InterfaceParamFn InterfaceResultFn GenericParamsFn PartialGenericParamsFn GenericResultsFn PartialGenericResultsFn GenericInterfaceParamFn GenericInterfaceResultFn Usual GenericParams PartialGenericParams GenericResults PartialGenericResults GenericInterfaceParam GenericInterfaceResult +//go:generate moqueries --destination exported/moq_exported_testmoqs.go --export UsualFn NoNamesFn NoResultsFn NoParamsFn NothingFn VariadicFn RepeatedIdsFn TimesFn DifficultParamNamesFn DifficultResultNamesFn PassByArrayFn PassByChanFn PassByEllipsisFn PassByMapFn PassByReferenceFn PassBySliceFn PassByValueFn InterfaceParamFn InterfaceResultFn GenericParamsFn PartialGenericParamsFn GenericResultsFn PartialGenericResultsFn GenericInterfaceParamFn GenericInterfaceResultFn Usual GenericParams PartialGenericParams GenericResults PartialGenericResults GenericInterfaceParam GenericInterfaceResult // UsualFn is a typical function type type UsualFn func(sParam string, bParam bool) (sResult string, err error) @@ -96,19 +98,40 @@ type InterfaceResultReader struct { Err error } -func (r *InterfaceResultReader) Read(p []byte) (int, error) { +func (r *InterfaceResultReader) Read([]byte) (int, error) { return 0, nil } // InterfaceResultFn tests returning interface results type InterfaceResultFn func(sParam string, bParam bool) (r io.Reader) +// GenericParamsFn has all generic parameters +type GenericParamsFn[S, B any] func(S, B) (string, error) + +// PartialGenericParamsFn has some generic parameters +type PartialGenericParamsFn[S any] func(S, bool) (string, error) + +// GenericResultsFn has all generic results +type GenericResultsFn[S ~string, E error] func(string, bool) (S, E) + +// PartialGenericResultsFn has some generic results +type PartialGenericResultsFn[S ~string] func(string, bool) (S, error) + +type MyWriter io.Writer + +// GenericInterfaceParamFn tests passing generic interface parameters +type GenericInterfaceParamFn[W MyWriter] func(w W) (sResult string, err error) + +type MyReader io.Reader + +// GenericInterfaceResultFn tests returning generic interface results +type GenericInterfaceResultFn[R MyReader] func(sParam string, bParam bool) (r R) + // Usual combines all the above function types into an interface // //nolint:interfacebloat // Test interface with one of every method type type Usual interface { Usual(sParam string, bParam bool) (sResult string, err error) - //nolint:inamedparam // Testing interface method with unnamed param for type string NoNames(string, bool) (string, error) NoResults(sParam string, bParam bool) NoParams() (sResult string, err error) @@ -130,3 +153,27 @@ type Usual interface { FnParam(fn func()) other.Other } + +type GenericParams[S, B any] interface { + Usual(S, B) (string, error) +} + +type PartialGenericParams[S any] interface { + Usual(S, bool) (string, error) +} + +type GenericResults[S ~string, E error] interface { + Usual(string, bool) (S, E) +} + +type PartialGenericResults[S ~string] interface { + Usual(string, bool) (S, error) +} + +type GenericInterfaceParam[W MyWriter] interface { + Usual(w W) (sResult string, err error) +} + +type GenericInterfaceResult[R MyReader] interface { + Usual(sParam string, bParam bool) (r R) +} diff --git a/generator/testmoqs/usualadaptors_test.go b/generator/testmoqs/usualadaptors_test.go index 6405dc5..f68057b 100644 --- a/generator/testmoqs/usualadaptors_test.go +++ b/generator/testmoqs/usualadaptors_test.go @@ -2536,3 +2536,837 @@ func (r *exportedInterfaceResultRecorder) repeat(repeaters ...moq.Repeater) { func (r *exportedInterfaceResultRecorder) isNil() bool { return r.r == nil } + +type genericParamsAdaptor[S, B any] struct { + //nolint:structcheck // definitely used + m *moqGenericParams[S, B] +} + +func (a *genericParamsAdaptor[S, B]) config() adaptorConfig { return adaptorConfig{} } + +func (a *genericParamsAdaptor[S, B]) mock() interface{} { return a.m.mock() } + +func (a *genericParamsAdaptor[S, B]) newRecorder(sParams []S, bParam B) recorder { + return &genericParamsRecorder[S, B]{r: a.m.onCall().Usual(sParams[0], bParam)} +} + +func (a *genericParamsAdaptor[S, B]) invokeMockAndExpectResults(t moq.T, sParams []S, bParam B, res results) { + sResult, err := a.m.mock().Usual(sParams[0], bParam) + if sResult != res.sResults[0] { + t.Errorf("wanted %#v, got %#v", res.sResults[0], sResult) + } + if err != res.err { + t.Errorf("wanted %#v, got %#v", res.err, err) + } +} + +func (a *genericParamsAdaptor[S, B]) prettyParams(sParams []S, bParam B) string { + return fmt.Sprintf("Usual(%#v, %#v)", sParams[0], bParam) +} + +func (a *genericParamsAdaptor[S, B]) sceneMoq() moq.Moq { + return a.m +} + +type genericParamsRecorder[S, B any] struct { + //nolint:structcheck // definitely used + r *moqGenericParams_Usual_fnRecorder[S, B] +} + +func (r *genericParamsRecorder[S, B]) anySParam() { + if a := r.r.any(); a == nil { + r.r = nil + } else { + r.r = a.param1() + } +} + +func (r *genericParamsRecorder[S, B]) anyBParam() { + if a := r.r.any(); a == nil { + r.r = nil + } else { + r.r = a.param2() + } +} + +func (r *genericParamsRecorder[S, B]) seq() { + r.r = r.r.seq() +} + +func (r *genericParamsRecorder[S, B]) noSeq() { + r.r = r.r.noSeq() +} + +func (r *genericParamsRecorder[S, B]) returnResults(sResults []string, err error) { + r.r = r.r.returnResults(sResults[0], err) +} + +func (r *genericParamsRecorder[S, B]) andDo(t moq.T, fn func(), expectedSParams []string, expectedBParam bool) { + r.r = r.r.andDo(func(sParam S, bParam B) { + fn() + if !reflect.DeepEqual(sParam, expectedSParams[0]) { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if !reflect.DeepEqual(bParam, expectedBParam) { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + }) +} + +func (r *genericParamsRecorder[S, B]) doReturnResults( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, sResults []string, err error, +) { + r.r = r.r.doReturnResults(func(sParam S, bParam B) (string, error) { + fn() + if !reflect.DeepEqual(sParam, expectedSParams[0]) { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if !reflect.DeepEqual(bParam, expectedBParam) { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + return sResults[0], err + }) +} + +func (r *genericParamsRecorder[S, B]) repeat(repeaters ...moq.Repeater) { + r.r = r.r.repeat(repeaters...) +} + +func (r *genericParamsRecorder[S, B]) isNil() bool { + return r.r == nil +} + +type exportedGenericParamsAdaptor[S, B any] struct { + //nolint:structcheck // definitely used + m *exported.MoqGenericParams[S, B] +} + +func (a *exportedGenericParamsAdaptor[S, B]) config() adaptorConfig { + return adaptorConfig{exported: true} +} + +func (a *exportedGenericParamsAdaptor[S, B]) mock() interface{} { return a.m.Mock() } + +func (a *exportedGenericParamsAdaptor[S, B]) newRecorder(sParams []S, bParam B) recorder { + return &exportedGenericParamsRecorder[S, B]{r: a.m.OnCall().Usual(sParams[0], bParam)} +} + +func (a *exportedGenericParamsAdaptor[S, B]) invokeMockAndExpectResults(t moq.T, sParams []S, bParam B, res results) { + sResult, err := a.m.Mock().Usual(sParams[0], bParam) + if sResult != res.sResults[0] { + t.Errorf("wanted %#v, got %#v", res.sResults[0], sResult) + } + if err != res.err { + t.Errorf("wanted %#v, got %#v", res.err, err) + } +} + +func (a *exportedGenericParamsAdaptor[S, B]) prettyParams(sParams []S, bParam B) string { + return fmt.Sprintf("Usual(%#v, %#v)", sParams[0], bParam) +} + +func (a *exportedGenericParamsAdaptor[S, B]) sceneMoq() moq.Moq { + return a.m +} + +type exportedGenericParamsRecorder[S, B any] struct { + //nolint:structcheck // definitely used + r *exported.MoqGenericParams_Usual_fnRecorder[S, B] +} + +func (r *exportedGenericParamsRecorder[S, B]) anySParam() { + if a := r.r.Any(); a == nil { + r.r = nil + } else { + r.r = a.Param1() + } +} + +func (r *exportedGenericParamsRecorder[S, B]) anyBParam() { + if a := r.r.Any(); a == nil { + r.r = nil + } else { + r.r = a.Param2() + } +} + +func (r *exportedGenericParamsRecorder[S, B]) seq() { + r.r = r.r.Seq() +} + +func (r *exportedGenericParamsRecorder[S, B]) noSeq() { + r.r = r.r.NoSeq() +} + +func (r *exportedGenericParamsRecorder[S, B]) returnResults(sResults []string, err error) { + r.r = r.r.ReturnResults(sResults[0], err) +} + +func (r *exportedGenericParamsRecorder[S, B]) andDo( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, +) { + r.r = r.r.AndDo(func(sParam S, bParam B) { + fn() + if !reflect.DeepEqual(sParam, expectedSParams[0]) { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if !reflect.DeepEqual(bParam, expectedBParam) { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + }) +} + +func (r *exportedGenericParamsRecorder[S, B]) doReturnResults( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, sResults []string, err error, +) { + r.r = r.r.DoReturnResults(func(sParam S, bParam B) (string, error) { + fn() + if !reflect.DeepEqual(sParam, expectedSParams[0]) { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if !reflect.DeepEqual(bParam, expectedBParam) { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + return sResults[0], err + }) +} + +func (r *exportedGenericParamsRecorder[S, B]) repeat(repeaters ...moq.Repeater) { + r.r = r.r.Repeat(repeaters...) +} + +func (r *exportedGenericParamsRecorder[S, B]) isNil() bool { + return r.r == nil +} + +type partialGenericParamsAdaptor[S any] struct { + //nolint:structcheck // definitely used + m *moqPartialGenericParams[S] +} + +func (a *partialGenericParamsAdaptor[S]) config() adaptorConfig { return adaptorConfig{} } + +func (a *partialGenericParamsAdaptor[S]) mock() interface{} { return a.m.mock() } + +func (a *partialGenericParamsAdaptor[S]) newRecorder(sParams []S, bParam bool) recorder { + return &partialGenericParamsRecorder[S]{r: a.m.onCall().Usual(sParams[0], bParam)} +} + +func (a *partialGenericParamsAdaptor[S]) invokeMockAndExpectResults(t moq.T, sParams []S, bParam bool, res results) { + sResult, err := a.m.mock().Usual(sParams[0], bParam) + if sResult != res.sResults[0] { + t.Errorf("wanted %#v, got %#v", res.sResults[0], sResult) + } + if err != res.err { + t.Errorf("wanted %#v, got %#v", res.err, err) + } +} + +func (a *partialGenericParamsAdaptor[S]) prettyParams(sParams []S, bParam bool) string { + return fmt.Sprintf("Usual(%#v, %#v)", sParams[0], bParam) +} + +func (a *partialGenericParamsAdaptor[S]) sceneMoq() moq.Moq { + return a.m +} + +type partialGenericParamsRecorder[S any] struct { + //nolint:structcheck // definitely used + r *moqPartialGenericParams_Usual_fnRecorder[S] +} + +func (r *partialGenericParamsRecorder[S]) anySParam() { + if a := r.r.any(); a == nil { + r.r = nil + } else { + r.r = a.param1() + } +} + +func (r *partialGenericParamsRecorder[S]) anyBParam() { + if a := r.r.any(); a == nil { + r.r = nil + } else { + r.r = a.param2() + } +} + +func (r *partialGenericParamsRecorder[S]) seq() { + r.r = r.r.seq() +} + +func (r *partialGenericParamsRecorder[S]) noSeq() { + r.r = r.r.noSeq() +} + +func (r *partialGenericParamsRecorder[S]) returnResults(sResults []string, err error) { + r.r = r.r.returnResults(sResults[0], err) +} + +func (r *partialGenericParamsRecorder[S]) andDo(t moq.T, fn func(), expectedSParams []string, expectedBParam bool) { + r.r = r.r.andDo(func(sParam S, bParam bool) { + fn() + if !reflect.DeepEqual(sParam, expectedSParams[0]) { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + }) +} + +func (r *partialGenericParamsRecorder[S]) doReturnResults( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, sResults []string, err error, +) { + r.r = r.r.doReturnResults(func(sParam S, bParam bool) (string, error) { + fn() + if !reflect.DeepEqual(sParam, expectedSParams[0]) { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + return sResults[0], err + }) +} + +func (r *partialGenericParamsRecorder[S]) repeat(repeaters ...moq.Repeater) { + r.r = r.r.repeat(repeaters...) +} + +func (r *partialGenericParamsRecorder[S]) isNil() bool { + return r.r == nil +} + +type exportedPartialGenericParamsAdaptor[S any] struct { + //nolint:structcheck // definitely used + m *exported.MoqPartialGenericParams[S] +} + +func (a *exportedPartialGenericParamsAdaptor[S]) config() adaptorConfig { + return adaptorConfig{exported: true} +} + +func (a *exportedPartialGenericParamsAdaptor[S]) mock() interface{} { return a.m.Mock() } + +func (a *exportedPartialGenericParamsAdaptor[S]) newRecorder(sParams []S, bParam bool) recorder { + return &exportedPartialGenericParamsRecorder[S]{r: a.m.OnCall().Usual(sParams[0], bParam)} +} + +func (a *exportedPartialGenericParamsAdaptor[S]) invokeMockAndExpectResults( + t moq.T, sParams []S, bParam bool, res results, +) { + sResult, err := a.m.Mock().Usual(sParams[0], bParam) + if sResult != res.sResults[0] { + t.Errorf("wanted %#v, got %#v", res.sResults[0], sResult) + } + if err != res.err { + t.Errorf("wanted %#v, got %#v", res.err, err) + } +} + +func (a *exportedPartialGenericParamsAdaptor[S]) prettyParams(sParams []S, bParam bool) string { + return fmt.Sprintf("Usual(%#v, %#v)", sParams[0], bParam) +} + +func (a *exportedPartialGenericParamsAdaptor[S]) sceneMoq() moq.Moq { + return a.m +} + +type exportedPartialGenericParamsRecorder[S any] struct { + //nolint:structcheck // definitely used + r *exported.MoqPartialGenericParams_Usual_fnRecorder[S] +} + +func (r *exportedPartialGenericParamsRecorder[S]) anySParam() { + if a := r.r.Any(); a == nil { + r.r = nil + } else { + r.r = a.Param1() + } +} + +func (r *exportedPartialGenericParamsRecorder[S]) anyBParam() { + if a := r.r.Any(); a == nil { + r.r = nil + } else { + r.r = a.Param2() + } +} + +func (r *exportedPartialGenericParamsRecorder[S]) seq() { + r.r = r.r.Seq() +} + +func (r *exportedPartialGenericParamsRecorder[S]) noSeq() { + r.r = r.r.NoSeq() +} + +func (r *exportedPartialGenericParamsRecorder[S]) returnResults(sResults []string, err error) { + r.r = r.r.ReturnResults(sResults[0], err) +} + +func (r *exportedPartialGenericParamsRecorder[S]) andDo( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, +) { + r.r = r.r.AndDo(func(sParam S, bParam bool) { + fn() + if !reflect.DeepEqual(sParam, expectedSParams[0]) { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + }) +} + +func (r *exportedPartialGenericParamsRecorder[S]) doReturnResults( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, sResults []string, err error, +) { + r.r = r.r.DoReturnResults(func(sParam S, bParam bool) (string, error) { + fn() + if !reflect.DeepEqual(sParam, expectedSParams[0]) { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if !reflect.DeepEqual(bParam, expectedBParam) { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + return sResults[0], err + }) +} + +func (r *exportedPartialGenericParamsRecorder[S]) repeat(repeaters ...moq.Repeater) { + r.r = r.r.Repeat(repeaters...) +} + +func (r *exportedPartialGenericParamsRecorder[S]) isNil() bool { + return r.r == nil +} + +type genericResultsAdaptor[S ~string, E error] struct { + //nolint:structcheck // definitely used + m *moqGenericResults[S, E] +} + +func (a *genericResultsAdaptor[S, E]) config() adaptorConfig { return adaptorConfig{} } + +func (a *genericResultsAdaptor[S, E]) mock() interface{} { return a.m.mock() } + +func (a *genericResultsAdaptor[S, E]) newRecorder(sParams []string, bParam bool) recorder { + return &genericResultsRecorder[S, E]{r: a.m.onCall().Usual(sParams[0], bParam)} +} + +func (a *genericResultsAdaptor[S, E]) invokeMockAndExpectResults( + t moq.T, sParams []string, bParam bool, res results, +) { + sResult, err := a.m.mock().Usual(sParams[0], bParam) + if !reflect.DeepEqual(sResult, res.sResults[0]) { + t.Errorf("wanted %#v, got %#v", res.sResults[0], sResult) + } + if !reflect.DeepEqual(err, res.err) { + t.Errorf("wanted %#v, got %#v", res.err, err) + } +} + +func (a *genericResultsAdaptor[S, E]) prettyParams(sParams []string, bParam bool) string { + return fmt.Sprintf("Usual(%#v, %#v)", sParams[0], bParam) +} + +func (a *genericResultsAdaptor[S, E]) sceneMoq() moq.Moq { + return a.m +} + +type genericResultsRecorder[S ~string, E error] struct { + //nolint:structcheck // definitely used + r *moqGenericResults_Usual_fnRecorder[S, E] +} + +func (r *genericResultsRecorder[S, E]) anySParam() { + if a := r.r.any(); a == nil { + r.r = nil + } else { + r.r = a.param1() + } +} + +func (r *genericResultsRecorder[S, E]) anyBParam() { + if a := r.r.any(); a == nil { + r.r = nil + } else { + r.r = a.param2() + } +} + +func (r *genericResultsRecorder[S, E]) seq() { + r.r = r.r.seq() +} + +func (r *genericResultsRecorder[S, E]) noSeq() { + r.r = r.r.noSeq() +} + +func (r *genericResultsRecorder[S, E]) returnResults(sResults []string, err error) { + var e E + if err != nil { + e = err.(E) + } + r.r = r.r.returnResults(S(sResults[0]), e) +} + +func (r *genericResultsRecorder[S, E]) andDo(t moq.T, fn func(), expectedSParams []string, expectedBParam bool) { + r.r = r.r.andDo(func(sParam string, bParam bool) { + fn() + if sParam != expectedSParams[0] { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + }) +} + +func (r *genericResultsRecorder[S, E]) doReturnResults( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, sResults []string, err error, +) { + r.r = r.r.doReturnResults(func(sParam string, bParam bool) (S, E) { + fn() + if sParam != expectedSParams[0] { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + var e E + if err != nil { + e = err.(E) + } + return S(sResults[0]), e + }) +} + +func (r *genericResultsRecorder[S, E]) repeat(repeaters ...moq.Repeater) { + r.r = r.r.repeat(repeaters...) +} + +func (r *genericResultsRecorder[S, E]) isNil() bool { + return r.r == nil +} + +type exportedGenericResultsAdaptor[S ~string, E error] struct { + //nolint:structcheck // definitely used + m *exported.MoqGenericResults[S, E] +} + +func (a *exportedGenericResultsAdaptor[S, E]) config() adaptorConfig { + return adaptorConfig{exported: true} +} + +func (a *exportedGenericResultsAdaptor[S, E]) mock() interface{} { return a.m.Mock() } + +func (a *exportedGenericResultsAdaptor[S, E]) newRecorder(sParams []string, bParam bool) recorder { + return &exportedGenericResultsRecorder[S, E]{r: a.m.OnCall().Usual(sParams[0], bParam)} +} + +func (a *exportedGenericResultsAdaptor[S, E]) invokeMockAndExpectResults( + t moq.T, sParams []string, bParam bool, res results, +) { + sResult, err := a.m.Mock().Usual(sParams[0], bParam) + if !reflect.DeepEqual(sResult, res.sResults[0]) { + t.Errorf("wanted %#v, got %#v", res.sResults[0], sResult) + } + if !reflect.DeepEqual(err, res.err) { + t.Errorf("wanted %#v, got %#v", res.err, err) + } +} + +func (a *exportedGenericResultsAdaptor[S, E]) prettyParams(sParams []string, bParam bool) string { + return fmt.Sprintf("Usual(%#v, %#v)", sParams[0], bParam) +} + +func (a *exportedGenericResultsAdaptor[S, E]) sceneMoq() moq.Moq { + return a.m +} + +type exportedGenericResultsRecorder[S ~string, E error] struct { + //nolint:structcheck // definitely used + r *exported.MoqGenericResults_Usual_fnRecorder[S, E] +} + +func (r *exportedGenericResultsRecorder[S, E]) anySParam() { + if a := r.r.Any(); a == nil { + r.r = nil + } else { + r.r = a.Param1() + } +} + +func (r *exportedGenericResultsRecorder[S, E]) anyBParam() { + if a := r.r.Any(); a == nil { + r.r = nil + } else { + r.r = a.Param2() + } +} + +func (r *exportedGenericResultsRecorder[S, E]) seq() { + r.r = r.r.Seq() +} + +func (r *exportedGenericResultsRecorder[S, E]) noSeq() { + r.r = r.r.NoSeq() +} + +func (r *exportedGenericResultsRecorder[S, E]) returnResults(sResults []string, err error) { + var e E + if err != nil { + e = err.(E) + } + r.r = r.r.ReturnResults(S(sResults[0]), e) +} + +func (r *exportedGenericResultsRecorder[S, E]) andDo( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, +) { + r.r = r.r.AndDo(func(sParam string, bParam bool) { + fn() + if sParam != expectedSParams[0] { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + }) +} + +func (r *exportedGenericResultsRecorder[S, E]) doReturnResults( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, sResults []string, err error, +) { + r.r = r.r.DoReturnResults(func(sParam string, bParam bool) (S, E) { + fn() + if sParam != expectedSParams[0] { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + var e E + if err != nil { + e = err.(E) + } + return S(sResults[0]), e + }) +} + +func (r *exportedGenericResultsRecorder[S, E]) repeat(repeaters ...moq.Repeater) { + r.r = r.r.Repeat(repeaters...) +} + +func (r *exportedGenericResultsRecorder[S, E]) isNil() bool { + return r.r == nil +} + +type partialGenericResultsAdaptor[S ~string] struct { + //nolint:structcheck // definitely used + m *moqPartialGenericResults[S] +} + +func (a *partialGenericResultsAdaptor[S]) config() adaptorConfig { return adaptorConfig{} } + +func (a *partialGenericResultsAdaptor[S]) mock() interface{} { return a.m.mock() } + +func (a *partialGenericResultsAdaptor[S]) newRecorder(sParams []string, bParam bool) recorder { + return &partialGenericResultsRecorder[S]{r: a.m.onCall().Usual(sParams[0], bParam)} +} + +func (a *partialGenericResultsAdaptor[S]) invokeMockAndExpectResults( + t moq.T, sParams []string, bParam bool, res results, +) { + sResult, err := a.m.mock().Usual(sParams[0], bParam) + if !reflect.DeepEqual(sResult, res.sResults[0]) { + t.Errorf("wanted %#v, got %#v", res.sResults[0], sResult) + } + if !reflect.DeepEqual(err, res.err) { + t.Errorf("wanted %#v, got %#v", res.err, err) + } +} + +func (a *partialGenericResultsAdaptor[S]) prettyParams(sParams []string, bParam bool) string { + return fmt.Sprintf("Usual(%#v, %#v)", sParams[0], bParam) +} + +func (a *partialGenericResultsAdaptor[S]) sceneMoq() moq.Moq { + return a.m +} + +type partialGenericResultsRecorder[S ~string] struct { + //nolint:structcheck // definitely used + r *moqPartialGenericResults_Usual_fnRecorder[S] +} + +func (r *partialGenericResultsRecorder[S]) anySParam() { + if a := r.r.any(); a == nil { + r.r = nil + } else { + r.r = a.param1() + } +} + +func (r *partialGenericResultsRecorder[S]) anyBParam() { + if a := r.r.any(); a == nil { + r.r = nil + } else { + r.r = a.param2() + } +} + +func (r *partialGenericResultsRecorder[S]) seq() { + r.r = r.r.seq() +} + +func (r *partialGenericResultsRecorder[S]) noSeq() { + r.r = r.r.noSeq() +} + +func (r *partialGenericResultsRecorder[S]) returnResults(sResults []string, err error) { + r.r = r.r.returnResults(S(sResults[0]), err) +} + +func (r *partialGenericResultsRecorder[S]) andDo(t moq.T, fn func(), expectedSParams []string, expectedBParam bool) { + r.r = r.r.andDo(func(sParam string, bParam bool) { + fn() + if sParam != expectedSParams[0] { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + }) +} + +func (r *partialGenericResultsRecorder[S]) doReturnResults( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, sResults []string, err error, +) { + r.r = r.r.doReturnResults(func(sParam string, bParam bool) (S, error) { + fn() + if sParam != expectedSParams[0] { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + return S(sResults[0]), err + }) +} + +func (r *partialGenericResultsRecorder[S]) repeat(repeaters ...moq.Repeater) { + r.r = r.r.repeat(repeaters...) +} + +func (r *partialGenericResultsRecorder[S]) isNil() bool { + return r.r == nil +} + +type exportedPartialGenericResultsAdaptor[S ~string] struct { + //nolint:structcheck // definitely used + m *exported.MoqPartialGenericResults[S] +} + +func (a *exportedPartialGenericResultsAdaptor[S]) config() adaptorConfig { + return adaptorConfig{exported: true} +} + +func (a *exportedPartialGenericResultsAdaptor[S]) mock() interface{} { return a.m.Mock() } + +func (a *exportedPartialGenericResultsAdaptor[S]) newRecorder(sParams []string, bParam bool) recorder { + return &exportedPartialGenericResultsRecorder[S]{r: a.m.OnCall().Usual(sParams[0], bParam)} +} + +func (a *exportedPartialGenericResultsAdaptor[S]) invokeMockAndExpectResults( + t moq.T, sParams []string, bParam bool, res results, +) { + sResult, err := a.m.Mock().Usual(sParams[0], bParam) + if !reflect.DeepEqual(sResult, res.sResults[0]) { + t.Errorf("wanted %#v, got %#v", res.sResults[0], sResult) + } + if !reflect.DeepEqual(err, res.err) { + t.Errorf("wanted %#v, got %#v", res.err, err) + } +} + +func (a *exportedPartialGenericResultsAdaptor[S]) prettyParams(sParams []string, bParam bool) string { + return fmt.Sprintf("Usual(%#v, %#v)", sParams[0], bParam) +} + +func (a *exportedPartialGenericResultsAdaptor[S]) sceneMoq() moq.Moq { + return a.m +} + +type exportedPartialGenericResultsRecorder[S ~string] struct { + //nolint:structcheck // definitely used + r *exported.MoqPartialGenericResults_Usual_fnRecorder[S] +} + +func (r *exportedPartialGenericResultsRecorder[S]) anySParam() { + if a := r.r.Any(); a == nil { + r.r = nil + } else { + r.r = a.Param1() + } +} + +func (r *exportedPartialGenericResultsRecorder[S]) anyBParam() { + if a := r.r.Any(); a == nil { + r.r = nil + } else { + r.r = a.Param2() + } +} + +func (r *exportedPartialGenericResultsRecorder[S]) seq() { + r.r = r.r.Seq() +} + +func (r *exportedPartialGenericResultsRecorder[S]) noSeq() { + r.r = r.r.NoSeq() +} + +func (r *exportedPartialGenericResultsRecorder[S]) returnResults(sResults []string, err error) { + r.r = r.r.ReturnResults(S(sResults[0]), err) +} + +func (r *exportedPartialGenericResultsRecorder[S]) andDo( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, +) { + r.r = r.r.AndDo(func(sParam string, bParam bool) { + fn() + if sParam != expectedSParams[0] { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + }) +} + +func (r *exportedPartialGenericResultsRecorder[S]) doReturnResults( + t moq.T, fn func(), expectedSParams []string, expectedBParam bool, sResults []string, err error, +) { + r.r = r.r.DoReturnResults(func(sParam string, bParam bool) (S, error) { + fn() + if sParam != expectedSParams[0] { + t.Errorf("wanted %#v, got %#v", expectedSParams[0], sParam) + } + if bParam != expectedBParam { + t.Errorf("wanted %t, got %#v", expectedBParam, bParam) + } + return S(sResults[0]), err + }) +} + +func (r *exportedPartialGenericResultsRecorder[S]) repeat(repeaters ...moq.Repeater) { + r.r = r.r.Repeat(repeaters...) +} + +func (r *exportedPartialGenericResultsRecorder[S]) isNil() bool { + return r.r == nil +} diff --git a/go.mod b/go.mod index 97eebe0..25c8570 100644 --- a/go.mod +++ b/go.mod @@ -1,16 +1,18 @@ module moqueries.org/cli -go 1.15 +go 1.19 require ( - github.com/dave/dst v0.26.2 + github.com/dave/dst v0.27.2 github.com/spf13/cobra v1.6.1 + golang.org/x/mod v0.14.0 golang.org/x/text v0.14.0 golang.org/x/tools v0.17.0 + moqueries.org/runtime v0.2.1-0.20230514231133-79eabd1bc852 ) require ( - github.com/stretchr/testify v1.8.0 // indirect - golang.org/x/mod v0.14.0 - moqueries.org/runtime v0.2.1-0.20230514231133-79eabd1bc852 + github.com/inconshreveable/mousetrap v1.0.1 // indirect + github.com/spf13/pflag v1.0.5 // indirect + moqueries.org/deephash v0.26.0 // indirect ) diff --git a/go.sum b/go.sum index ad632a1..1df0498 100644 --- a/go.sum +++ b/go.sum @@ -1,109 +1,23 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/dave/dst v0.26.2 h1:lnxLAKI3tx7MgLNVDirFCsDTlTG9nKTk7GcptKcWSwY= -github.com/dave/dst v0.26.2/go.mod h1:UMDJuIRPfyUCC78eFuB+SV/WI8oDeyFDvM/JR6NI3IU= -github.com/dave/gopackages v0.0.0-20170318123100-46e7023ec56e/go.mod h1:i00+b/gKdIDIxuLDFob7ustLAVqhsZRk2qVZrArELGQ= -github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= -github.com/dave/kerr v0.0.0-20170318121727-bc25dd6abe8e/go.mod h1:qZqlPyPvfsDJt+3wHJ1EvSXDuVjFTK0j2p/ca+gtsb8= -github.com/dave/rebecca v0.9.1/go.mod h1:N6XYdMD/OKw3lkF3ywh8Z6wPGuwNFDNtWYEMFWEmXBA= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/pprof v0.0.0-20181127221834-b4f47329b966/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/dave/dst v0.27.2 h1:4Y5VFTkhGLC1oddtNwuxxe36pnyLxMFXT51FOzH8Ekc= +github.com/dave/dst v0.27.2/go.mod h1:jHh6EOibnHgcUW3WjKHisiooEkYwqpHLBSX1iOBhEyc= +github.com/dave/jennifer v1.5.0 h1:HmgPN93bVDpkQyYbqhCHj5QlgvUkvEOzMyEvKLgCRrg= github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -golang.org/x/arch v0.0.0-20180920145803-b19384d3c130/go.mod h1:cYlCBUl1MsqxdiKgmc4uh7TxZfWSFLOGSRR090WDxt8= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= -golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200509030707-2212a7e161a5/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/src-d/go-billy.v4 v4.3.0 h1:KtlZ4c1OWbIs4jCv5ZXrTqG8EQocr0g/d4DjNg70aek= -gopkg.in/src-d/go-billy.v4 v4.3.0/go.mod h1:tm33zBoOwxjYHZIE+OV8bxTWFMJLrconzFMd38aARFk= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= moqueries.org/deephash v0.26.0 h1:KvMnNvb/N9lId0OOO1X6Yp2BifVuDuJJQH3epAeF178= moqueries.org/deephash v0.26.0/go.mod h1:brwHe2Ks78ZEA1xIgUTEy0gtZfO7tJTqXT9haTdIRNE= diff --git a/pkg/testmoqs/moq_generic_indexlistgentype.go b/pkg/testmoqs/moq_generic_indexlistgentype.go new file mode 100644 index 0000000..c55f4d8 --- /dev/null +++ b/pkg/testmoqs/moq_generic_indexlistgentype.go @@ -0,0 +1,1267 @@ +// Code generated by Moqueries - https://moqueries.org - DO NOT EDIT! + +package testmoqs + +import ( + "fmt" + "math/bits" + "sync/atomic" + + "moqueries.org/runtime/moq" +) + +// The following type assertion assures that testmoqs.Generic_indexListGenType +// is mocked completely +var _ Generic_indexListGenType = (*MoqGeneric_indexListGenType_mock)(nil) + +// Generic_indexListGenType is the fabricated implementation type of this mock +// (emitted when mocking a collections of methods directly and not from an +// interface type) +type Generic_indexListGenType interface { + DoSomethingPtr() + DoSomethingElsePtr() + DoSomething() + DoSomethingElse() +} + +// MoqGeneric_indexListGenType holds the state of a moq of the +// Generic_indexListGenType type +type MoqGeneric_indexListGenType struct { + Scene *moq.Scene + Config moq.Config + Moq *MoqGeneric_indexListGenType_mock + + ResultsByParams_DoSomethingPtr []MoqGeneric_indexListGenType_DoSomethingPtr_resultsByParams + ResultsByParams_DoSomethingElsePtr []MoqGeneric_indexListGenType_DoSomethingElsePtr_resultsByParams + ResultsByParams_DoSomething []MoqGeneric_indexListGenType_DoSomething_resultsByParams + ResultsByParams_DoSomethingElse []MoqGeneric_indexListGenType_DoSomethingElse_resultsByParams + + Runtime struct { + ParameterIndexing struct { + DoSomethingPtr struct{} + DoSomethingElsePtr struct{} + DoSomething struct{} + DoSomethingElse struct{} + } + } +} + +// MoqGeneric_indexListGenType_mock isolates the mock interface of the +// Generic_indexListGenType type +type MoqGeneric_indexListGenType_mock struct { + Moq *MoqGeneric_indexListGenType +} + +// MoqGeneric_indexListGenType_recorder isolates the recorder interface of the +// Generic_indexListGenType type +type MoqGeneric_indexListGenType_recorder struct { + Moq *MoqGeneric_indexListGenType +} + +// MoqGeneric_indexListGenType_DoSomethingPtr_params holds the params of the +// Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingPtr_params struct{} + +// MoqGeneric_indexListGenType_DoSomethingPtr_paramsKey holds the map key +// params of the Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingPtr_paramsKey struct { + Params struct{} + Hashes struct{} +} + +// MoqGeneric_indexListGenType_DoSomethingPtr_resultsByParams contains the +// results for a given set of parameters for the Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingPtr_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqGeneric_indexListGenType_DoSomethingPtr_paramsKey]*MoqGeneric_indexListGenType_DoSomethingPtr_results +} + +// MoqGeneric_indexListGenType_DoSomethingPtr_doFn defines the type of function +// needed when calling AndDo for the Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingPtr_doFn func() + +// MoqGeneric_indexListGenType_DoSomethingPtr_doReturnFn defines the type of +// function needed when calling DoReturnResults for the +// Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingPtr_doReturnFn func() + +// MoqGeneric_indexListGenType_DoSomethingPtr_results holds the results of the +// Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingPtr_results struct { + Params MoqGeneric_indexListGenType_DoSomethingPtr_params + Results []struct { + Values *struct{} + Sequence uint32 + DoFn MoqGeneric_indexListGenType_DoSomethingPtr_doFn + DoReturnFn MoqGeneric_indexListGenType_DoSomethingPtr_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqGeneric_indexListGenType_DoSomethingPtr_fnRecorder routes recorded +// function calls to the MoqGeneric_indexListGenType moq +type MoqGeneric_indexListGenType_DoSomethingPtr_fnRecorder struct { + Params MoqGeneric_indexListGenType_DoSomethingPtr_params + AnyParams uint64 + Sequence bool + Results *MoqGeneric_indexListGenType_DoSomethingPtr_results + Moq *MoqGeneric_indexListGenType +} + +// MoqGeneric_indexListGenType_DoSomethingPtr_anyParams isolates the any params +// functions of the Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingPtr_anyParams struct { + Recorder *MoqGeneric_indexListGenType_DoSomethingPtr_fnRecorder +} + +// MoqGeneric_indexListGenType_DoSomethingElsePtr_params holds the params of +// the Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingElsePtr_params struct{} + +// MoqGeneric_indexListGenType_DoSomethingElsePtr_paramsKey holds the map key +// params of the Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingElsePtr_paramsKey struct { + Params struct{} + Hashes struct{} +} + +// MoqGeneric_indexListGenType_DoSomethingElsePtr_resultsByParams contains the +// results for a given set of parameters for the Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingElsePtr_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqGeneric_indexListGenType_DoSomethingElsePtr_paramsKey]*MoqGeneric_indexListGenType_DoSomethingElsePtr_results +} + +// MoqGeneric_indexListGenType_DoSomethingElsePtr_doFn defines the type of +// function needed when calling AndDo for the Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingElsePtr_doFn func() + +// MoqGeneric_indexListGenType_DoSomethingElsePtr_doReturnFn defines the type +// of function needed when calling DoReturnResults for the +// Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingElsePtr_doReturnFn func() + +// MoqGeneric_indexListGenType_DoSomethingElsePtr_results holds the results of +// the Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingElsePtr_results struct { + Params MoqGeneric_indexListGenType_DoSomethingElsePtr_params + Results []struct { + Values *struct{} + Sequence uint32 + DoFn MoqGeneric_indexListGenType_DoSomethingElsePtr_doFn + DoReturnFn MoqGeneric_indexListGenType_DoSomethingElsePtr_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqGeneric_indexListGenType_DoSomethingElsePtr_fnRecorder routes recorded +// function calls to the MoqGeneric_indexListGenType moq +type MoqGeneric_indexListGenType_DoSomethingElsePtr_fnRecorder struct { + Params MoqGeneric_indexListGenType_DoSomethingElsePtr_params + AnyParams uint64 + Sequence bool + Results *MoqGeneric_indexListGenType_DoSomethingElsePtr_results + Moq *MoqGeneric_indexListGenType +} + +// MoqGeneric_indexListGenType_DoSomethingElsePtr_anyParams isolates the any +// params functions of the Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingElsePtr_anyParams struct { + Recorder *MoqGeneric_indexListGenType_DoSomethingElsePtr_fnRecorder +} + +// MoqGeneric_indexListGenType_DoSomething_params holds the params of the +// Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomething_params struct{} + +// MoqGeneric_indexListGenType_DoSomething_paramsKey holds the map key params +// of the Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomething_paramsKey struct { + Params struct{} + Hashes struct{} +} + +// MoqGeneric_indexListGenType_DoSomething_resultsByParams contains the results +// for a given set of parameters for the Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomething_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqGeneric_indexListGenType_DoSomething_paramsKey]*MoqGeneric_indexListGenType_DoSomething_results +} + +// MoqGeneric_indexListGenType_DoSomething_doFn defines the type of function +// needed when calling AndDo for the Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomething_doFn func() + +// MoqGeneric_indexListGenType_DoSomething_doReturnFn defines the type of +// function needed when calling DoReturnResults for the +// Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomething_doReturnFn func() + +// MoqGeneric_indexListGenType_DoSomething_results holds the results of the +// Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomething_results struct { + Params MoqGeneric_indexListGenType_DoSomething_params + Results []struct { + Values *struct{} + Sequence uint32 + DoFn MoqGeneric_indexListGenType_DoSomething_doFn + DoReturnFn MoqGeneric_indexListGenType_DoSomething_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqGeneric_indexListGenType_DoSomething_fnRecorder routes recorded function +// calls to the MoqGeneric_indexListGenType moq +type MoqGeneric_indexListGenType_DoSomething_fnRecorder struct { + Params MoqGeneric_indexListGenType_DoSomething_params + AnyParams uint64 + Sequence bool + Results *MoqGeneric_indexListGenType_DoSomething_results + Moq *MoqGeneric_indexListGenType +} + +// MoqGeneric_indexListGenType_DoSomething_anyParams isolates the any params +// functions of the Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomething_anyParams struct { + Recorder *MoqGeneric_indexListGenType_DoSomething_fnRecorder +} + +// MoqGeneric_indexListGenType_DoSomethingElse_params holds the params of the +// Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingElse_params struct{} + +// MoqGeneric_indexListGenType_DoSomethingElse_paramsKey holds the map key +// params of the Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingElse_paramsKey struct { + Params struct{} + Hashes struct{} +} + +// MoqGeneric_indexListGenType_DoSomethingElse_resultsByParams contains the +// results for a given set of parameters for the Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingElse_resultsByParams struct { + AnyCount int + AnyParams uint64 + Results map[MoqGeneric_indexListGenType_DoSomethingElse_paramsKey]*MoqGeneric_indexListGenType_DoSomethingElse_results +} + +// MoqGeneric_indexListGenType_DoSomethingElse_doFn defines the type of +// function needed when calling AndDo for the Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingElse_doFn func() + +// MoqGeneric_indexListGenType_DoSomethingElse_doReturnFn defines the type of +// function needed when calling DoReturnResults for the +// Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingElse_doReturnFn func() + +// MoqGeneric_indexListGenType_DoSomethingElse_results holds the results of the +// Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingElse_results struct { + Params MoqGeneric_indexListGenType_DoSomethingElse_params + Results []struct { + Values *struct{} + Sequence uint32 + DoFn MoqGeneric_indexListGenType_DoSomethingElse_doFn + DoReturnFn MoqGeneric_indexListGenType_DoSomethingElse_doReturnFn + } + Index uint32 + Repeat *moq.RepeatVal +} + +// MoqGeneric_indexListGenType_DoSomethingElse_fnRecorder routes recorded +// function calls to the MoqGeneric_indexListGenType moq +type MoqGeneric_indexListGenType_DoSomethingElse_fnRecorder struct { + Params MoqGeneric_indexListGenType_DoSomethingElse_params + AnyParams uint64 + Sequence bool + Results *MoqGeneric_indexListGenType_DoSomethingElse_results + Moq *MoqGeneric_indexListGenType +} + +// MoqGeneric_indexListGenType_DoSomethingElse_anyParams isolates the any +// params functions of the Generic_indexListGenType type +type MoqGeneric_indexListGenType_DoSomethingElse_anyParams struct { + Recorder *MoqGeneric_indexListGenType_DoSomethingElse_fnRecorder +} + +// NewMoqGeneric_indexListGenType creates a new moq of the +// Generic_indexListGenType type +func NewMoqGeneric_indexListGenType(scene *moq.Scene, config *moq.Config) *MoqGeneric_indexListGenType { + if config == nil { + config = &moq.Config{} + } + m := &MoqGeneric_indexListGenType{ + Scene: scene, + Config: *config, + Moq: &MoqGeneric_indexListGenType_mock{}, + + Runtime: struct { + ParameterIndexing struct { + DoSomethingPtr struct{} + DoSomethingElsePtr struct{} + DoSomething struct{} + DoSomethingElse struct{} + } + }{ParameterIndexing: struct { + DoSomethingPtr struct{} + DoSomethingElsePtr struct{} + DoSomething struct{} + DoSomethingElse struct{} + }{ + DoSomethingPtr: struct{}{}, + DoSomethingElsePtr: struct{}{}, + DoSomething: struct{}{}, + DoSomethingElse: struct{}{}, + }}, + } + m.Moq.Moq = m + + scene.AddMoq(m) + return m +} + +// Mock returns the mock implementation of the Generic_indexListGenType type +func (m *MoqGeneric_indexListGenType) Mock() *MoqGeneric_indexListGenType_mock { return m.Moq } + +func (m *MoqGeneric_indexListGenType_mock) DoSomethingPtr() { + m.Moq.Scene.T.Helper() + params := MoqGeneric_indexListGenType_DoSomethingPtr_params{} + var results *MoqGeneric_indexListGenType_DoSomethingPtr_results + for _, resultsByParams := range m.Moq.ResultsByParams_DoSomethingPtr { + paramsKey := m.Moq.ParamsKey_DoSomethingPtr(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_DoSomethingPtr(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_DoSomethingPtr(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_DoSomethingPtr(params)) + } + } + + if result.DoFn != nil { + result.DoFn() + } + + if result.DoReturnFn != nil { + result.DoReturnFn() + } + return +} + +func (m *MoqGeneric_indexListGenType_mock) DoSomethingElsePtr() { + m.Moq.Scene.T.Helper() + params := MoqGeneric_indexListGenType_DoSomethingElsePtr_params{} + var results *MoqGeneric_indexListGenType_DoSomethingElsePtr_results + for _, resultsByParams := range m.Moq.ResultsByParams_DoSomethingElsePtr { + paramsKey := m.Moq.ParamsKey_DoSomethingElsePtr(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_DoSomethingElsePtr(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_DoSomethingElsePtr(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_DoSomethingElsePtr(params)) + } + } + + if result.DoFn != nil { + result.DoFn() + } + + if result.DoReturnFn != nil { + result.DoReturnFn() + } + return +} + +func (m *MoqGeneric_indexListGenType_mock) DoSomething() { + m.Moq.Scene.T.Helper() + params := MoqGeneric_indexListGenType_DoSomething_params{} + var results *MoqGeneric_indexListGenType_DoSomething_results + for _, resultsByParams := range m.Moq.ResultsByParams_DoSomething { + paramsKey := m.Moq.ParamsKey_DoSomething(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_DoSomething(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_DoSomething(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_DoSomething(params)) + } + } + + if result.DoFn != nil { + result.DoFn() + } + + if result.DoReturnFn != nil { + result.DoReturnFn() + } + return +} + +func (m *MoqGeneric_indexListGenType_mock) DoSomethingElse() { + m.Moq.Scene.T.Helper() + params := MoqGeneric_indexListGenType_DoSomethingElse_params{} + var results *MoqGeneric_indexListGenType_DoSomethingElse_results + for _, resultsByParams := range m.Moq.ResultsByParams_DoSomethingElse { + paramsKey := m.Moq.ParamsKey_DoSomethingElse(params, resultsByParams.AnyParams) + var ok bool + results, ok = resultsByParams.Results[paramsKey] + if ok { + break + } + } + if results == nil { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Unexpected call to %s", m.Moq.PrettyParams_DoSomethingElse(params)) + } + return + } + + i := int(atomic.AddUint32(&results.Index, 1)) - 1 + if i >= results.Repeat.ResultCount { + if !results.Repeat.AnyTimes { + if m.Moq.Config.Expectation == moq.Strict { + m.Moq.Scene.T.Fatalf("Too many calls to %s", m.Moq.PrettyParams_DoSomethingElse(params)) + } + return + } + i = results.Repeat.ResultCount - 1 + } + + result := results.Results[i] + if result.Sequence != 0 { + sequence := m.Moq.Scene.NextMockSequence() + if (!results.Repeat.AnyTimes && result.Sequence != sequence) || result.Sequence > sequence { + m.Moq.Scene.T.Fatalf("Call sequence does not match call to %s", m.Moq.PrettyParams_DoSomethingElse(params)) + } + } + + if result.DoFn != nil { + result.DoFn() + } + + if result.DoReturnFn != nil { + result.DoReturnFn() + } + return +} + +// OnCall returns the recorder implementation of the Generic_indexListGenType +// type +func (m *MoqGeneric_indexListGenType) OnCall() *MoqGeneric_indexListGenType_recorder { + return &MoqGeneric_indexListGenType_recorder{ + Moq: m, + } +} + +func (m *MoqGeneric_indexListGenType_recorder) DoSomethingPtr() *MoqGeneric_indexListGenType_DoSomethingPtr_fnRecorder { + return &MoqGeneric_indexListGenType_DoSomethingPtr_fnRecorder{ + Params: MoqGeneric_indexListGenType_DoSomethingPtr_params{}, + Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, + Moq: m.Moq, + } +} + +func (r *MoqGeneric_indexListGenType_DoSomethingPtr_fnRecorder) Any() *MoqGeneric_indexListGenType_DoSomethingPtr_anyParams { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DoSomethingPtr(r.Params)) + return nil + } + return &MoqGeneric_indexListGenType_DoSomethingPtr_anyParams{Recorder: r} +} + +func (r *MoqGeneric_indexListGenType_DoSomethingPtr_fnRecorder) Seq() *MoqGeneric_indexListGenType_DoSomethingPtr_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DoSomethingPtr(r.Params)) + return nil + } + r.Sequence = true + return r +} + +func (r *MoqGeneric_indexListGenType_DoSomethingPtr_fnRecorder) NoSeq() *MoqGeneric_indexListGenType_DoSomethingPtr_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DoSomethingPtr(r.Params)) + return nil + } + r.Sequence = false + return r +} + +func (r *MoqGeneric_indexListGenType_DoSomethingPtr_fnRecorder) ReturnResults() *MoqGeneric_indexListGenType_DoSomethingPtr_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } + + r.Results.Results = append(r.Results.Results, struct { + Values *struct{} + Sequence uint32 + DoFn MoqGeneric_indexListGenType_DoSomethingPtr_doFn + DoReturnFn MoqGeneric_indexListGenType_DoSomethingPtr_doReturnFn + }{ + Values: &struct{}{}, + Sequence: sequence, + }) + return r +} + +func (r *MoqGeneric_indexListGenType_DoSomethingPtr_fnRecorder) AndDo(fn MoqGeneric_indexListGenType_DoSomethingPtr_doFn) *MoqGeneric_indexListGenType_DoSomethingPtr_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") + return nil + } + last := &r.Results.Results[len(r.Results.Results)-1] + last.DoFn = fn + return r +} + +func (r *MoqGeneric_indexListGenType_DoSomethingPtr_fnRecorder) DoReturnResults(fn MoqGeneric_indexListGenType_DoSomethingPtr_doReturnFn) *MoqGeneric_indexListGenType_DoSomethingPtr_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } + + r.Results.Results = append(r.Results.Results, struct { + Values *struct{} + Sequence uint32 + DoFn MoqGeneric_indexListGenType_DoSomethingPtr_doFn + DoReturnFn MoqGeneric_indexListGenType_DoSomethingPtr_doReturnFn + }{Sequence: sequence, DoReturnFn: fn}) + return r +} + +func (r *MoqGeneric_indexListGenType_DoSomethingPtr_fnRecorder) FindResults() { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Results.Repeat.Increment(r.Moq.Scene.T) + return + } + + anyCount := bits.OnesCount64(r.AnyParams) + insertAt := -1 + var results *MoqGeneric_indexListGenType_DoSomethingPtr_resultsByParams + for n, res := range r.Moq.ResultsByParams_DoSomethingPtr { + if res.AnyParams == r.AnyParams { + results = &res + break + } + if res.AnyCount > anyCount { + insertAt = n + } + } + if results == nil { + results = &MoqGeneric_indexListGenType_DoSomethingPtr_resultsByParams{ + AnyCount: anyCount, + AnyParams: r.AnyParams, + Results: map[MoqGeneric_indexListGenType_DoSomethingPtr_paramsKey]*MoqGeneric_indexListGenType_DoSomethingPtr_results{}, + } + r.Moq.ResultsByParams_DoSomethingPtr = append(r.Moq.ResultsByParams_DoSomethingPtr, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_DoSomethingPtr) { + copy(r.Moq.ResultsByParams_DoSomethingPtr[insertAt+1:], r.Moq.ResultsByParams_DoSomethingPtr[insertAt:0]) + r.Moq.ResultsByParams_DoSomethingPtr[insertAt] = *results + } + } + + paramsKey := r.Moq.ParamsKey_DoSomethingPtr(r.Params, r.AnyParams) + + var ok bool + r.Results, ok = results.Results[paramsKey] + if !ok { + r.Results = &MoqGeneric_indexListGenType_DoSomethingPtr_results{ + Params: r.Params, + Results: nil, + Index: 0, + Repeat: &moq.RepeatVal{}, + } + results.Results[paramsKey] = r.Results + } + + r.Results.Repeat.Increment(r.Moq.Scene.T) +} + +func (r *MoqGeneric_indexListGenType_DoSomethingPtr_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqGeneric_indexListGenType_DoSomethingPtr_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") + return nil + } + r.Results.Repeat.Repeat(r.Moq.Scene.T, repeaters) + last := r.Results.Results[len(r.Results.Results)-1] + for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { + if r.Sequence { + last = struct { + Values *struct{} + Sequence uint32 + DoFn MoqGeneric_indexListGenType_DoSomethingPtr_doFn + DoReturnFn MoqGeneric_indexListGenType_DoSomethingPtr_doReturnFn + }{ + Values: last.Values, + Sequence: r.Moq.Scene.NextRecorderSequence(), + } + } + r.Results.Results = append(r.Results.Results, last) + } + return r +} + +func (m *MoqGeneric_indexListGenType) PrettyParams_DoSomethingPtr(params MoqGeneric_indexListGenType_DoSomethingPtr_params) string { + return fmt.Sprintf("DoSomethingPtr()") +} + +func (m *MoqGeneric_indexListGenType) ParamsKey_DoSomethingPtr(params MoqGeneric_indexListGenType_DoSomethingPtr_params, anyParams uint64) MoqGeneric_indexListGenType_DoSomethingPtr_paramsKey { + m.Scene.T.Helper() + return MoqGeneric_indexListGenType_DoSomethingPtr_paramsKey{ + Params: struct{}{}, + Hashes: struct{}{}, + } +} + +func (m *MoqGeneric_indexListGenType_recorder) DoSomethingElsePtr() *MoqGeneric_indexListGenType_DoSomethingElsePtr_fnRecorder { + return &MoqGeneric_indexListGenType_DoSomethingElsePtr_fnRecorder{ + Params: MoqGeneric_indexListGenType_DoSomethingElsePtr_params{}, + Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, + Moq: m.Moq, + } +} + +func (r *MoqGeneric_indexListGenType_DoSomethingElsePtr_fnRecorder) Any() *MoqGeneric_indexListGenType_DoSomethingElsePtr_anyParams { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DoSomethingElsePtr(r.Params)) + return nil + } + return &MoqGeneric_indexListGenType_DoSomethingElsePtr_anyParams{Recorder: r} +} + +func (r *MoqGeneric_indexListGenType_DoSomethingElsePtr_fnRecorder) Seq() *MoqGeneric_indexListGenType_DoSomethingElsePtr_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DoSomethingElsePtr(r.Params)) + return nil + } + r.Sequence = true + return r +} + +func (r *MoqGeneric_indexListGenType_DoSomethingElsePtr_fnRecorder) NoSeq() *MoqGeneric_indexListGenType_DoSomethingElsePtr_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DoSomethingElsePtr(r.Params)) + return nil + } + r.Sequence = false + return r +} + +func (r *MoqGeneric_indexListGenType_DoSomethingElsePtr_fnRecorder) ReturnResults() *MoqGeneric_indexListGenType_DoSomethingElsePtr_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } + + r.Results.Results = append(r.Results.Results, struct { + Values *struct{} + Sequence uint32 + DoFn MoqGeneric_indexListGenType_DoSomethingElsePtr_doFn + DoReturnFn MoqGeneric_indexListGenType_DoSomethingElsePtr_doReturnFn + }{ + Values: &struct{}{}, + Sequence: sequence, + }) + return r +} + +func (r *MoqGeneric_indexListGenType_DoSomethingElsePtr_fnRecorder) AndDo(fn MoqGeneric_indexListGenType_DoSomethingElsePtr_doFn) *MoqGeneric_indexListGenType_DoSomethingElsePtr_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") + return nil + } + last := &r.Results.Results[len(r.Results.Results)-1] + last.DoFn = fn + return r +} + +func (r *MoqGeneric_indexListGenType_DoSomethingElsePtr_fnRecorder) DoReturnResults(fn MoqGeneric_indexListGenType_DoSomethingElsePtr_doReturnFn) *MoqGeneric_indexListGenType_DoSomethingElsePtr_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } + + r.Results.Results = append(r.Results.Results, struct { + Values *struct{} + Sequence uint32 + DoFn MoqGeneric_indexListGenType_DoSomethingElsePtr_doFn + DoReturnFn MoqGeneric_indexListGenType_DoSomethingElsePtr_doReturnFn + }{Sequence: sequence, DoReturnFn: fn}) + return r +} + +func (r *MoqGeneric_indexListGenType_DoSomethingElsePtr_fnRecorder) FindResults() { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Results.Repeat.Increment(r.Moq.Scene.T) + return + } + + anyCount := bits.OnesCount64(r.AnyParams) + insertAt := -1 + var results *MoqGeneric_indexListGenType_DoSomethingElsePtr_resultsByParams + for n, res := range r.Moq.ResultsByParams_DoSomethingElsePtr { + if res.AnyParams == r.AnyParams { + results = &res + break + } + if res.AnyCount > anyCount { + insertAt = n + } + } + if results == nil { + results = &MoqGeneric_indexListGenType_DoSomethingElsePtr_resultsByParams{ + AnyCount: anyCount, + AnyParams: r.AnyParams, + Results: map[MoqGeneric_indexListGenType_DoSomethingElsePtr_paramsKey]*MoqGeneric_indexListGenType_DoSomethingElsePtr_results{}, + } + r.Moq.ResultsByParams_DoSomethingElsePtr = append(r.Moq.ResultsByParams_DoSomethingElsePtr, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_DoSomethingElsePtr) { + copy(r.Moq.ResultsByParams_DoSomethingElsePtr[insertAt+1:], r.Moq.ResultsByParams_DoSomethingElsePtr[insertAt:0]) + r.Moq.ResultsByParams_DoSomethingElsePtr[insertAt] = *results + } + } + + paramsKey := r.Moq.ParamsKey_DoSomethingElsePtr(r.Params, r.AnyParams) + + var ok bool + r.Results, ok = results.Results[paramsKey] + if !ok { + r.Results = &MoqGeneric_indexListGenType_DoSomethingElsePtr_results{ + Params: r.Params, + Results: nil, + Index: 0, + Repeat: &moq.RepeatVal{}, + } + results.Results[paramsKey] = r.Results + } + + r.Results.Repeat.Increment(r.Moq.Scene.T) +} + +func (r *MoqGeneric_indexListGenType_DoSomethingElsePtr_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqGeneric_indexListGenType_DoSomethingElsePtr_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") + return nil + } + r.Results.Repeat.Repeat(r.Moq.Scene.T, repeaters) + last := r.Results.Results[len(r.Results.Results)-1] + for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { + if r.Sequence { + last = struct { + Values *struct{} + Sequence uint32 + DoFn MoqGeneric_indexListGenType_DoSomethingElsePtr_doFn + DoReturnFn MoqGeneric_indexListGenType_DoSomethingElsePtr_doReturnFn + }{ + Values: last.Values, + Sequence: r.Moq.Scene.NextRecorderSequence(), + } + } + r.Results.Results = append(r.Results.Results, last) + } + return r +} + +func (m *MoqGeneric_indexListGenType) PrettyParams_DoSomethingElsePtr(params MoqGeneric_indexListGenType_DoSomethingElsePtr_params) string { + return fmt.Sprintf("DoSomethingElsePtr()") +} + +func (m *MoqGeneric_indexListGenType) ParamsKey_DoSomethingElsePtr(params MoqGeneric_indexListGenType_DoSomethingElsePtr_params, anyParams uint64) MoqGeneric_indexListGenType_DoSomethingElsePtr_paramsKey { + m.Scene.T.Helper() + return MoqGeneric_indexListGenType_DoSomethingElsePtr_paramsKey{ + Params: struct{}{}, + Hashes: struct{}{}, + } +} + +func (m *MoqGeneric_indexListGenType_recorder) DoSomething() *MoqGeneric_indexListGenType_DoSomething_fnRecorder { + return &MoqGeneric_indexListGenType_DoSomething_fnRecorder{ + Params: MoqGeneric_indexListGenType_DoSomething_params{}, + Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, + Moq: m.Moq, + } +} + +func (r *MoqGeneric_indexListGenType_DoSomething_fnRecorder) Any() *MoqGeneric_indexListGenType_DoSomething_anyParams { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DoSomething(r.Params)) + return nil + } + return &MoqGeneric_indexListGenType_DoSomething_anyParams{Recorder: r} +} + +func (r *MoqGeneric_indexListGenType_DoSomething_fnRecorder) Seq() *MoqGeneric_indexListGenType_DoSomething_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DoSomething(r.Params)) + return nil + } + r.Sequence = true + return r +} + +func (r *MoqGeneric_indexListGenType_DoSomething_fnRecorder) NoSeq() *MoqGeneric_indexListGenType_DoSomething_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DoSomething(r.Params)) + return nil + } + r.Sequence = false + return r +} + +func (r *MoqGeneric_indexListGenType_DoSomething_fnRecorder) ReturnResults() *MoqGeneric_indexListGenType_DoSomething_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } + + r.Results.Results = append(r.Results.Results, struct { + Values *struct{} + Sequence uint32 + DoFn MoqGeneric_indexListGenType_DoSomething_doFn + DoReturnFn MoqGeneric_indexListGenType_DoSomething_doReturnFn + }{ + Values: &struct{}{}, + Sequence: sequence, + }) + return r +} + +func (r *MoqGeneric_indexListGenType_DoSomething_fnRecorder) AndDo(fn MoqGeneric_indexListGenType_DoSomething_doFn) *MoqGeneric_indexListGenType_DoSomething_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") + return nil + } + last := &r.Results.Results[len(r.Results.Results)-1] + last.DoFn = fn + return r +} + +func (r *MoqGeneric_indexListGenType_DoSomething_fnRecorder) DoReturnResults(fn MoqGeneric_indexListGenType_DoSomething_doReturnFn) *MoqGeneric_indexListGenType_DoSomething_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } + + r.Results.Results = append(r.Results.Results, struct { + Values *struct{} + Sequence uint32 + DoFn MoqGeneric_indexListGenType_DoSomething_doFn + DoReturnFn MoqGeneric_indexListGenType_DoSomething_doReturnFn + }{Sequence: sequence, DoReturnFn: fn}) + return r +} + +func (r *MoqGeneric_indexListGenType_DoSomething_fnRecorder) FindResults() { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Results.Repeat.Increment(r.Moq.Scene.T) + return + } + + anyCount := bits.OnesCount64(r.AnyParams) + insertAt := -1 + var results *MoqGeneric_indexListGenType_DoSomething_resultsByParams + for n, res := range r.Moq.ResultsByParams_DoSomething { + if res.AnyParams == r.AnyParams { + results = &res + break + } + if res.AnyCount > anyCount { + insertAt = n + } + } + if results == nil { + results = &MoqGeneric_indexListGenType_DoSomething_resultsByParams{ + AnyCount: anyCount, + AnyParams: r.AnyParams, + Results: map[MoqGeneric_indexListGenType_DoSomething_paramsKey]*MoqGeneric_indexListGenType_DoSomething_results{}, + } + r.Moq.ResultsByParams_DoSomething = append(r.Moq.ResultsByParams_DoSomething, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_DoSomething) { + copy(r.Moq.ResultsByParams_DoSomething[insertAt+1:], r.Moq.ResultsByParams_DoSomething[insertAt:0]) + r.Moq.ResultsByParams_DoSomething[insertAt] = *results + } + } + + paramsKey := r.Moq.ParamsKey_DoSomething(r.Params, r.AnyParams) + + var ok bool + r.Results, ok = results.Results[paramsKey] + if !ok { + r.Results = &MoqGeneric_indexListGenType_DoSomething_results{ + Params: r.Params, + Results: nil, + Index: 0, + Repeat: &moq.RepeatVal{}, + } + results.Results[paramsKey] = r.Results + } + + r.Results.Repeat.Increment(r.Moq.Scene.T) +} + +func (r *MoqGeneric_indexListGenType_DoSomething_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqGeneric_indexListGenType_DoSomething_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") + return nil + } + r.Results.Repeat.Repeat(r.Moq.Scene.T, repeaters) + last := r.Results.Results[len(r.Results.Results)-1] + for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { + if r.Sequence { + last = struct { + Values *struct{} + Sequence uint32 + DoFn MoqGeneric_indexListGenType_DoSomething_doFn + DoReturnFn MoqGeneric_indexListGenType_DoSomething_doReturnFn + }{ + Values: last.Values, + Sequence: r.Moq.Scene.NextRecorderSequence(), + } + } + r.Results.Results = append(r.Results.Results, last) + } + return r +} + +func (m *MoqGeneric_indexListGenType) PrettyParams_DoSomething(params MoqGeneric_indexListGenType_DoSomething_params) string { + return fmt.Sprintf("DoSomething()") +} + +func (m *MoqGeneric_indexListGenType) ParamsKey_DoSomething(params MoqGeneric_indexListGenType_DoSomething_params, anyParams uint64) MoqGeneric_indexListGenType_DoSomething_paramsKey { + m.Scene.T.Helper() + return MoqGeneric_indexListGenType_DoSomething_paramsKey{ + Params: struct{}{}, + Hashes: struct{}{}, + } +} + +func (m *MoqGeneric_indexListGenType_recorder) DoSomethingElse() *MoqGeneric_indexListGenType_DoSomethingElse_fnRecorder { + return &MoqGeneric_indexListGenType_DoSomethingElse_fnRecorder{ + Params: MoqGeneric_indexListGenType_DoSomethingElse_params{}, + Sequence: m.Moq.Config.Sequence == moq.SeqDefaultOn, + Moq: m.Moq, + } +} + +func (r *MoqGeneric_indexListGenType_DoSomethingElse_fnRecorder) Any() *MoqGeneric_indexListGenType_DoSomethingElse_anyParams { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Any functions must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DoSomethingElse(r.Params)) + return nil + } + return &MoqGeneric_indexListGenType_DoSomethingElse_anyParams{Recorder: r} +} + +func (r *MoqGeneric_indexListGenType_DoSomethingElse_fnRecorder) Seq() *MoqGeneric_indexListGenType_DoSomethingElse_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("Seq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DoSomethingElse(r.Params)) + return nil + } + r.Sequence = true + return r +} + +func (r *MoqGeneric_indexListGenType_DoSomethingElse_fnRecorder) NoSeq() *MoqGeneric_indexListGenType_DoSomethingElse_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Moq.Scene.T.Fatalf("NoSeq must be called before ReturnResults or DoReturnResults calls, recording %s", r.Moq.PrettyParams_DoSomethingElse(r.Params)) + return nil + } + r.Sequence = false + return r +} + +func (r *MoqGeneric_indexListGenType_DoSomethingElse_fnRecorder) ReturnResults() *MoqGeneric_indexListGenType_DoSomethingElse_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } + + r.Results.Results = append(r.Results.Results, struct { + Values *struct{} + Sequence uint32 + DoFn MoqGeneric_indexListGenType_DoSomethingElse_doFn + DoReturnFn MoqGeneric_indexListGenType_DoSomethingElse_doReturnFn + }{ + Values: &struct{}{}, + Sequence: sequence, + }) + return r +} + +func (r *MoqGeneric_indexListGenType_DoSomethingElse_fnRecorder) AndDo(fn MoqGeneric_indexListGenType_DoSomethingElse_doFn) *MoqGeneric_indexListGenType_DoSomethingElse_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults must be called before calling AndDo") + return nil + } + last := &r.Results.Results[len(r.Results.Results)-1] + last.DoFn = fn + return r +} + +func (r *MoqGeneric_indexListGenType_DoSomethingElse_fnRecorder) DoReturnResults(fn MoqGeneric_indexListGenType_DoSomethingElse_doReturnFn) *MoqGeneric_indexListGenType_DoSomethingElse_fnRecorder { + r.Moq.Scene.T.Helper() + r.FindResults() + + var sequence uint32 + if r.Sequence { + sequence = r.Moq.Scene.NextRecorderSequence() + } + + r.Results.Results = append(r.Results.Results, struct { + Values *struct{} + Sequence uint32 + DoFn MoqGeneric_indexListGenType_DoSomethingElse_doFn + DoReturnFn MoqGeneric_indexListGenType_DoSomethingElse_doReturnFn + }{Sequence: sequence, DoReturnFn: fn}) + return r +} + +func (r *MoqGeneric_indexListGenType_DoSomethingElse_fnRecorder) FindResults() { + r.Moq.Scene.T.Helper() + if r.Results != nil { + r.Results.Repeat.Increment(r.Moq.Scene.T) + return + } + + anyCount := bits.OnesCount64(r.AnyParams) + insertAt := -1 + var results *MoqGeneric_indexListGenType_DoSomethingElse_resultsByParams + for n, res := range r.Moq.ResultsByParams_DoSomethingElse { + if res.AnyParams == r.AnyParams { + results = &res + break + } + if res.AnyCount > anyCount { + insertAt = n + } + } + if results == nil { + results = &MoqGeneric_indexListGenType_DoSomethingElse_resultsByParams{ + AnyCount: anyCount, + AnyParams: r.AnyParams, + Results: map[MoqGeneric_indexListGenType_DoSomethingElse_paramsKey]*MoqGeneric_indexListGenType_DoSomethingElse_results{}, + } + r.Moq.ResultsByParams_DoSomethingElse = append(r.Moq.ResultsByParams_DoSomethingElse, *results) + if insertAt != -1 && insertAt+1 < len(r.Moq.ResultsByParams_DoSomethingElse) { + copy(r.Moq.ResultsByParams_DoSomethingElse[insertAt+1:], r.Moq.ResultsByParams_DoSomethingElse[insertAt:0]) + r.Moq.ResultsByParams_DoSomethingElse[insertAt] = *results + } + } + + paramsKey := r.Moq.ParamsKey_DoSomethingElse(r.Params, r.AnyParams) + + var ok bool + r.Results, ok = results.Results[paramsKey] + if !ok { + r.Results = &MoqGeneric_indexListGenType_DoSomethingElse_results{ + Params: r.Params, + Results: nil, + Index: 0, + Repeat: &moq.RepeatVal{}, + } + results.Results[paramsKey] = r.Results + } + + r.Results.Repeat.Increment(r.Moq.Scene.T) +} + +func (r *MoqGeneric_indexListGenType_DoSomethingElse_fnRecorder) Repeat(repeaters ...moq.Repeater) *MoqGeneric_indexListGenType_DoSomethingElse_fnRecorder { + r.Moq.Scene.T.Helper() + if r.Results == nil { + r.Moq.Scene.T.Fatalf("ReturnResults or DoReturnResults must be called before calling Repeat") + return nil + } + r.Results.Repeat.Repeat(r.Moq.Scene.T, repeaters) + last := r.Results.Results[len(r.Results.Results)-1] + for n := 0; n < r.Results.Repeat.ResultCount-1; n++ { + if r.Sequence { + last = struct { + Values *struct{} + Sequence uint32 + DoFn MoqGeneric_indexListGenType_DoSomethingElse_doFn + DoReturnFn MoqGeneric_indexListGenType_DoSomethingElse_doReturnFn + }{ + Values: last.Values, + Sequence: r.Moq.Scene.NextRecorderSequence(), + } + } + r.Results.Results = append(r.Results.Results, last) + } + return r +} + +func (m *MoqGeneric_indexListGenType) PrettyParams_DoSomethingElse(params MoqGeneric_indexListGenType_DoSomethingElse_params) string { + return fmt.Sprintf("DoSomethingElse()") +} + +func (m *MoqGeneric_indexListGenType) ParamsKey_DoSomethingElse(params MoqGeneric_indexListGenType_DoSomethingElse_params, anyParams uint64) MoqGeneric_indexListGenType_DoSomethingElse_paramsKey { + m.Scene.T.Helper() + return MoqGeneric_indexListGenType_DoSomethingElse_paramsKey{ + Params: struct{}{}, + Hashes: struct{}{}, + } +} + +// Reset resets the state of the moq +func (m *MoqGeneric_indexListGenType) Reset() { + m.ResultsByParams_DoSomethingPtr = nil + m.ResultsByParams_DoSomethingElsePtr = nil + m.ResultsByParams_DoSomething = nil + m.ResultsByParams_DoSomethingElse = nil +} + +// AssertExpectationsMet asserts that all expectations have been met +func (m *MoqGeneric_indexListGenType) AssertExpectationsMet() { + m.Scene.T.Helper() + for _, res := range m.ResultsByParams_DoSomethingPtr { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_DoSomethingPtr(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_DoSomethingElsePtr { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_DoSomethingElsePtr(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_DoSomething { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_DoSomething(results.Params)) + } + } + } + for _, res := range m.ResultsByParams_DoSomethingElse { + for _, results := range res.Results { + missing := results.Repeat.MinTimes - int(atomic.LoadUint32(&results.Index)) + if missing > 0 { + m.Scene.T.Errorf("Expected %d additional call(s) to %s", missing, m.PrettyParams_DoSomethingElse(results.Params)) + } + } + } +} diff --git a/pkg/testmoqs/moq_reduced.go b/pkg/testmoqs/moq_reduced.go index e7a2aed..13f5b88 100644 --- a/pkg/testmoqs/moq_reduced.go +++ b/pkg/testmoqs/moq_reduced.go @@ -19,7 +19,6 @@ var _ Reduced_reduced = (*MoqReduced_mock)(nil) // when the original interface contains non-exported methods) type Reduced_reduced interface { Usual(sParam string, bParam bool) (sResult string, err error) - //nolint:inamedparam // Testing interface method with unnamed param ReallyUnusualParams(struct{ a string }) ReallyUnusualResults() struct{ a string } } diff --git a/pkg/testmoqs/types.go b/pkg/testmoqs/types.go index 6676a27..a1e396a 100644 --- a/pkg/testmoqs/types.go +++ b/pkg/testmoqs/types.go @@ -24,7 +24,16 @@ func (*PassByRefSimple) Usual(string, bool) (string, error) { type Reduced interface { Usual(sParam string, bParam bool) (sResult string, err error) notSoUsual() - //nolint:inamedparam // Testing interface method with unnamed param ReallyUnusualParams(struct{ a string }) ReallyUnusualResults() struct{ a string } } + +type Generic[T any, V any] struct{} + +func (g *Generic[T, V]) DoSomethingPtr() {} + +func (g *Generic[X, Y]) DoSomethingElsePtr() {} + +func (g Generic[T, V]) DoSomething() {} + +func (g Generic[X, Y]) DoSomethingElse() {} diff --git a/pkg/testmoqs/types_test.go b/pkg/testmoqs/types_test.go index 255b5c3..07d94f6 100644 --- a/pkg/testmoqs/types_test.go +++ b/pkg/testmoqs/types_test.go @@ -48,8 +48,8 @@ func TestPackageGeneration(t *testing.T) { moqs[e.Name()] = struct{}{} } - if len(moqs) != 4 { - t.Errorf("got %#v mocks, want 3", moqs) + if len(moqs) != 5 { + t.Errorf("got %#v mocks, want 5", moqs) } if _, ok := moqs["moq_passbyrefsimple_stargentype.go"]; !ok { t.Errorf("got %#v, want to contain moq_passbyrefsimple_stargentype.go", moqs) @@ -63,6 +63,9 @@ func TestPackageGeneration(t *testing.T) { if _, ok := moqs["moq_reduced.go"]; !ok { t.Errorf("got %#v, want to contain moq_standalonefunc_gentype.go", moqs) } + if _, ok := moqs["moq_generic_indexlistgentype.go"]; !ok { + t.Errorf("got %#v, want to contain moq_standalonefunc_gentype.go", moqs) + } // Minimal testing here just to make sure the right types were found (full // mock testing in the generator package) }