input

package
v1.6.20 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arg

type Arg struct {
	// contains filtered or unexported fields
}

Arg is an argument

func (*Arg) Int

func (a *Arg) Int(def int) int

Int returns the argument as an int

func (*Arg) String

func (a *Arg) String(def string) string

String returns the argument as a string

type Context

type Context struct {
	Name string
	// contains filtered or unexported fields
}

Context provides the test context

func NewContext

func NewContext(name string, args map[string]string) *Context

NewContext returns a new test context

func (*Context) GetArg

func (c *Context) GetArg(name string) *Arg

GetArg gets an argument

type RandomBytesSource

type RandomBytesSource struct {
	// contains filtered or unexported fields
}

RandomBytesSource is a random string input

func (*RandomBytesSource) Next

func (a *RandomBytesSource) Next() Value

Next returns a random byte slice

func (*RandomBytesSource) Reset

func (a *RandomBytesSource) Reset()

Reset resets the input

type RandomChoiceSource

type RandomChoiceSource struct {
	// contains filtered or unexported fields
}

RandomChoiceSource is a input that chooses a random value from a set

func (*RandomChoiceSource) Next

func (p *RandomChoiceSource) Next() Value

Next returns the next random value from the set

func (*RandomChoiceSource) Reset

func (p *RandomChoiceSource) Reset()

Reset resets the input

type RandomStringSource

type RandomStringSource struct {
	// contains filtered or unexported fields
}

RandomStringSource is a random string input

func (*RandomStringSource) Next

func (a *RandomStringSource) Next() Value

Next returns a random string

func (*RandomStringSource) Reset

func (a *RandomStringSource) Reset()

Reset resets the input

type SetSource

type SetSource struct {
	// contains filtered or unexported fields
}

SetSource is a input that returns a random set of values

func (*SetSource) Next

func (p *SetSource) Next() Value

Next returns the random set

func (*SetSource) Reset

func (p *SetSource) Reset()

Reset resets the input

type Source

type Source interface {
	// Reset resets the input
	Reset()

	// Next returns the Next input value
	Next() Value
}

Source is an interface for input sources

func RandomBytes

func RandomBytes(length int) Source

RandomBytes returns a random bytes input

func RandomChoice

func RandomChoice(set Source) Source

RandomChoice returns a input that chooses a random value from a set

func RandomString

func RandomString(length int) Source

RandomString returns a random string input

func SetOf

func SetOf(valueType Source, size int) Source

SetOf returns a input that constructs a set of values of the given input type

type Value

type Value interface {
	// Interface returns the value as an interface{}
	Interface() interface{}

	// Bytes returns the value as a []byte
	Bytes() []byte

	// String returns the value as a string
	String() string

	// Slice returns the value as a slice of values
	Slice() []Value

	// Int returns the value as an int
	Int() int

	// Int32 returns the value as an int32
	Int32() int32

	// Int64 returns the value as an int64
	Int64() int64

	// Uint returns the value as a uint
	Uint() uint

	// Uint32 returns the value as a uint32
	Uint32() uint32

	// Uint64 returns the value as a uint64
	Uint64() uint64

	// Float32 returns the value as a float32
	Float32() float32

	// Float64 returns the value as a float64
	Float64() float64
}

Value is a parameter value

func NewValue

func NewValue(value interface{}) Value

NewValue returns a new Value for the given value

Jump to

Keyboard shortcuts

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