Documentation ¶
Overview ¶
Package tv generates test vectors for trunnel types.
Index ¶
- func WriteCorpus(c *Corpus, dir string) error
- type Constraints
- func (c Constraints) ClearLocal()
- func (c Constraints) ClearScope(s string)
- func (c Constraints) Clone() Constraints
- func (c Constraints) CloneGlobal() Constraints
- func (c Constraints) Lookup(s, k string) (int64, bool)
- func (c Constraints) LookupLocal(k string) (int64, bool)
- func (c Constraints) LookupOrCreate(s, k string, v int64) int64
- func (c Constraints) LookupOrCreateRef(r *ast.IDRef, v int64) int64
- func (c Constraints) LookupRef(r *ast.IDRef) (int64, bool)
- func (c Constraints) Merge(other Constraints) (Constraints, error)
- func (c Constraints) Set(s, k string, v int64) error
- func (c Constraints) SetRef(r *ast.IDRef, v int64) error
- func (c Constraints) Update(d Constraints) error
- type Corpus
- type Option
- type Selector
- type SelectorFunc
- type Suite
- type Vector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteCorpus ¶
WriteCorpus writes the corpus of vectors in a standard structure under dir.
Types ¶
type Constraints ¶
Constraints records fixed values for struct/context fields.
func NewConstraints ¶
func NewConstraints() Constraints
NewConstraints builds an empty set of constraints.
func (Constraints) ClearLocal ¶
func (c Constraints) ClearLocal()
ClearLocal deletes all constraints in the local scope.
func (Constraints) ClearScope ¶
func (c Constraints) ClearScope(s string)
ClearScope deletes all constraints in scope s.
func (Constraints) CloneGlobal ¶
func (c Constraints) CloneGlobal() Constraints
CloneGlobal clones all constraints apart from the local ones. It is a convenience for Clone followed by ClearLocal.
func (Constraints) Lookup ¶
func (c Constraints) Lookup(s, k string) (int64, bool)
Lookup returns the value of the constraint on s.k.
func (Constraints) LookupLocal ¶
func (c Constraints) LookupLocal(k string) (int64, bool)
LookupLocal is a convenience for looking up in the local scope "".
func (Constraints) LookupOrCreate ¶
func (c Constraints) LookupOrCreate(s, k string, v int64) int64
LookupOrCreate looks up s.k and returns the value if it exists. Otherwise the constraint is set to v and returned.
func (Constraints) LookupOrCreateRef ¶
func (c Constraints) LookupOrCreateRef(r *ast.IDRef, v int64) int64
LookupOrCreateRef is a convenience for LookupOrCreate with an AST IDRef.
func (Constraints) LookupRef ¶
func (c Constraints) LookupRef(r *ast.IDRef) (int64, bool)
LookupRef is a convenience for looking up an AST IDRef.
func (Constraints) Merge ¶
func (c Constraints) Merge(other Constraints) (Constraints, error)
Merge builds a new set of constraints by merging c and other. Errors on conflict.
func (Constraints) Set ¶
func (c Constraints) Set(s, k string, v int64) error
Set sets the value of s.k.
func (Constraints) SetRef ¶
func (c Constraints) SetRef(r *ast.IDRef, v int64) error
SetRef is a convenience for setting the value of an AST IDRef.
func (Constraints) Update ¶
func (c Constraints) Update(d Constraints) error
Update applies all constraints in d to c.
type Corpus ¶
type Corpus struct {
Suites []Suite
}
Corpus is a collection of test vectors for multiple types.
func GenerateFiles ¶
GenerateFiles generates test vectors for the types in the given files.
func (*Corpus) AddVectors ¶
AddVectors adds vectors to the corpus for type n. Convenience wrapper around AddSuite.
type Option ¶
type Option func(*generator)
Option is an option to control test vector generation.
func WithRandom ¶
WithRandom sets the random source for test vector generation.
func WithSelector ¶
WithSelector sets the method for cutting down the number of vectors we have.
type Selector ¶
Selector selects which vectors to keep from a given list.
var Exhaustive Selector = SelectorFunc(func(vs []Vector) []Vector { return vs })
Exhaustive selects all vectors.
func RandomSampleSelector ¶
RandomSampleSelector selects a random sample of up to n vectors.
type SelectorFunc ¶
SelectorFunc implements Selector interface with a plain function.
func (SelectorFunc) SelectVectors ¶
func (f SelectorFunc) SelectVectors(vs []Vector) []Vector
SelectVectors calls f.