`import "github.com/zimmski/tavor/fuzz/strategy"`

- func List() []string
- func NewAllPermutations(root token.Token, r rand.Rand) (chan struct{}, error)
- func NewAlmostAllPermutations(root token.Token, r rand.Rand) (chan struct{}, error)
- func NewPermuteOptionals(root token.Token, r rand.Rand) (chan struct{}, error)
- func NewRandom(root token.Token, r rand.Rand) (chan struct{}, error)
- func Register(name string, strat Strategy)
- type Error
- type ErrorType
- type Strategy

allpermutations.go almostallpermutations.go permuteoptionals.go random.go strategy.go

List returns a list of all registered fuzzing strategy names.

NewAllPermutations implements a fuzzing strategy that generates all possible permutations of a token graph. Every iteration of the strategy generates a new permutation. The generation is deterministic. Since this strategy really produces every possible permutation of a token graph, it is advised to only use the strategy on graphs with few states since the state explosion problem manifests itself quite fast.

NewAlmostAllPermutations implements a fuzzing strategy that generates "almost" all possible permutations of a token graph. Every iteration of the strategy generates a new permutation. The generation is deterministic. This strategy does not cover all repititional permutations which can be helpful when less permutations are needed but a almost complete permutation coverage is still needed. For example the definition +2(?(1)?(2)) does not result in 16 permutations but instead it results in only 7.

NewPermuteOptionals implements a fuzzing strategy that generates permutations of only optional tokens of a token graph. Every iteration of the strategy generates a new permutation. The generation is deterministic. This strategy searches the graph for tokens who implement the OptionalToken interface and permutates over them by deactivating or activating them. The permutations always start from the deactivated states so that minimum data is generated first.

NewRandom implements a fuzzing strategy that generates a random permutation of a token graph. The strategy does exactly one iteration which permutates at random all reachable tokens in the graph. The determinism is dependent on the random generator and is therefore for example deterministic if a seed for the random generator produces always the same outputs.

Register registers a fuzzing strategy instance function with the given name.

Error holds a fuzzing strategy error

ErrorType the fuzzing strategy error type

❖

const ( // ErrEndlessLoopDetected the token graph has a cycle which is not allowed. ErrEndlessLoopDetected ErrorType = iota // ErrNilRandomGenerator the random generator is nil ErrNilRandomGenerator )

Strategy defines a fuzzing strategy. The function starts the first iteration of the fuzzing strategy returning a channel which controls the iteration flow. The channel returns a value if the iteration is complete and waits with calculating the next iteration until a value is put in. The channel is automatically closed when there are no more iterations. The error return argument is not nil if an error occurs during the setup of the fuzzing strategy.

New returns a new fuzzing strategy instance given the registered name of the strategy. The error return argument is not nil, if the name does not exist in the registered fuzzing strategy list.

Package strategy imports 8 packages (graph) and is imported by 1 packages. Updated 2018-11-27. Refresh now. Tools for package owners.