tavor: github.com/zimmski/tavor/fuzz/filter Index | Files

package filter

import "github.com/zimmski/tavor/fuzz/filter"


Package Files

filter.go negativeboundaryvalueanalysis.go positiveboundaryvalueanalysis.go

func ApplyFilters Uses

func ApplyFilters(filters []Filter, root token.Token) (token.Token, error)

ApplyFilters applies a set of filters onto a token. Filters are applied in the order in which they are given. If multiple filters are replacing the same token, only the first replacement will be applied. Filters are not applied onto filter generated tokens.

func List Uses

func List() []string

List returns a list of all registered fuzzing filter names.

func NewNegativeBoundaryValueAnalysis Uses

func NewNegativeBoundaryValueAnalysis(tok token.Token) (token.Token, error)

NewNegativeBoundaryValueAnalysis implements a fuzzing filter for negative boundary-value analysis. This filter searches the token graph for integer range tokens which will be transformed to exactly two integers: The lower and higher negative boundary. Using this filter reduces for example the integer range 1-100 to the integers 0 and 101. Which reduces the range away from the model definition and therefore to an invalid data generation, which can be used for example for negative tests.

func NewPositiveBoundaryValueAnalysis Uses

func NewPositiveBoundaryValueAnalysis(tok token.Token) (token.Token, error)

NewPositiveBoundaryValueAnalysis implements a fuzzing filter for positive boundary-value analysis. This filter searches the token graph for range tokens which will be transformed to a most 5 values: the lower and high boundaries as well as the middle values of the range. Using this filter reduces for example integer ranges of 1-100 to the integers 1, 50 and 100, which reduces permutations dramatically. A range of 1-2 will be reduces to the integers 1 and 2. A range of 1 will be reduced to the integer 1. Resulting integers of this filter therefore do not overlap. As a special case, integer ranges where the signs of the two boundaries are different are reduced to a maximum of 5 non-overlapping values. For instance, the integer range [-5, 10] is reduced to the integers -5, -1, 0, 1 and 10.

func Register Uses

func Register(name string, filt Filter)

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

type Filter Uses

type Filter func(tok token.Token) (token.Token, error)

Filter defines a fuzzing filter The function applies the fuzzing filter onto the token and returns a replacement token, or nil if there is no replacement. If a fatal error is encountered the error return argument is not nil.

func New Uses

func New(name string) (Filter, error)

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

Package filter imports 7 packages (graph). Updated 2017-06-13. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).