filter

package
v0.0.0-...-9f34108 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyFilters

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

func List() []string

List returns a list of all registered fuzzing filter names.

func NewNegativeBoundaryValueAnalysis

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

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

func Register(name string, filt Filter)

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

Types

type Filter

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL