Documentation ¶
Overview ¶
Package gen provides a generator for creating assignment statements for input parameters of functions for every function found in a given folder
Index ¶
- Constants
- type File
- type Generator
- func (g *Generator) GetNewOrganism() *Organism
- func (g *Generator) GetTestCases() []*Organism
- func (g *Generator) GetTestCasesForFunctionsInFile(f *ast.File, pointer *importer.PkgResolverPointer) map[string][]*testcase.TestCase
- func (g *Generator) TestCasePrefix(funcDecl *ast.FuncDecl) string
- func (g *Generator) TypeToPrefix(e ast.Expr) string
- type Options
- type Organism
Constants ¶
const ( DefaultPopulationSize = 30 DefaultTestCasesPerFunc = 18 // Currently the best way to detect cycles is to count // the amount of times some struct is created DefaultAmountRecursion = 3 )
Default constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct { Version string PackageName string Dir string FileName string // funcName, list of test cases TestCases map[string][]*testcase.TestCase }
File file contains test cases for functions of a given file
type Generator ¶
type Generator struct { Version string Dir string PackageInfo *importer.PackageInfo Opts *Options Deco *decorator.Deco }
Generator the generator
func (*Generator) GetNewOrganism ¶
GetNewOrganism get a single organism
func (*Generator) GetTestCases ¶
GetTestCases retrieve test cases, start of recursions
func (*Generator) GetTestCasesForFunctionsInFile ¶
func (g *Generator) GetTestCasesForFunctionsInFile(f *ast.File, pointer *importer.PkgResolverPointer) map[string][]*testcase.TestCase
GetTestCasesForFunctionsInFile convert given input ast file to a set of test cases per function test case contains a set of decl and assignment statement to generate test cases
func (*Generator) TestCasePrefix ¶
TestCasePrefix in case of receiver create prefix this is need to ensure test results dont override eachother in case of: func X() func (r T) X()
type Options ¶
type Options struct { MaxRecursion int OrganismAmount int TestCasesPerFunc int ValGenerator values.IGen // FIXME: Remove var generator as soon as IdentGen can be used everywhere VarGenerator variables.IGen IdentGen ident.IGen }
Options the options for the generator
type Organism ¶
Organism organism is a set of testcases for functions of files in a given directory
func (*Organism) UpdateAssertStmts ¶
UpdateAssertStmts sets an os assert statements based on printed runtime result