Documentation ¶
Index ¶
- Constants
- Variables
- func AssertDeepEqual(t *testing.T, name string, got, want Any) bool
- func AssertEqual(t *testing.T, name string, got, want Any) bool
- func AssertKindEqual(t *testing.T, name string, got, want Any) bool
- func AssertNotEqual(t *testing.T, name string, got, want Any) bool
- func AssertSameFunc(t *testing.T, name string, got, want Any, args ...reflect.Value) bool
- func AssertSameKind(t *testing.T, name string, got, want Any) bool
- func AssertSameType(t *testing.T, name string, got, want Any) bool
- func Conj(c complex128) complex128
- func Contains(needle Any, haystack []Any) bool
- func Example()
- func GetEncodedString(n int) string
- func GetFuncResult(t *testing.T, name string, fn Any, args ...reflect.Value) ([]reflect.Value, error)
- func IsKindEqual(got, want Any) bool
- func Less(i, j int) bool
- func Mean(list []int) float64
- func RandomKind(useInvalid bool) reflect.Kind
- func RandomString(n int) string
- func StDev(list []int) float64
- func TBbN(b *testing.B)
- func TError(t *testing.T, name string, got, want Any)
- func TErrorf(t *testing.T, formatString, name string, got, want Any)
- func TName(testname, funcname, argname Any) string
- func TRun(t *testing.T, name string, got, want Any)
- func TRunTest(t *testing.T, tt *test)
- func TTypeError(t *testing.T, name string, got, want Any)
- func TTypeRun(t *testing.T, name string, got, want Any, wantErr bool)
- type Any
- type AnyValue
- type Assert
- type Custom
- type DataPoint
- type GetSetter
- type KindMap
- type Random
- type StatMap
- type TBvalues
- type Test
- type TestSet
- type Tester
Constants ¶
const ( UPPER = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" LOWER = "abcdefghijklmnopqrstuvwxyz" DIGITS = "0123456789" ALPHA = LOWER + UPPER ALPHANUM = ALPHA + DIGITS )
const ReplacementChar rune = '\uFFFD'
ReplacementChar is the recognized unicode replacement character for malformed unicode or errors in encoding.
It is also found in unicode.ReplacementChar
Variables ¶
var ( ValueOf = types.ValueOf Log = types.Log )
var ( LimitResult bool DefaultTestResultLimit = 15 )
var Log = types.Log
var NewAnyValue = types.NewAnyValue
var NoValue reflect.Value = reflect.Value{}
NoValue is the zero value of reflect.Value, which is an invalid result. It specifically means that the test result has not yet been determined.
var TBloop = func(fn Any, in []TBvalues) ([]TBvalues, error) { defer func() { if r := recover(); r != nil { log.Errorf("TestBench: recovered from panic: %v (%v)", r, fn) } }() a := make([]TBvalues, 0, len(in)) for i := 0; i < len(in); i++ { a = append(a, v.Call(in[i])) } return a, nil }
TBloop returns the output output values from a call to the function fn using argList as a series of inputs. ArgList is a slice of inputs; fn is called once for each argument in argList and is results are returned in a similar slice of return values.
Functions ¶
func AssertSameFunc ¶
AssertSameFunc returns true if got and want are both functions that return the same value when called with args... as input.
func Conj ¶
func Conj(c complex128) complex128
func Contains ¶
Contains returns true if the underlying iterable sequence (haystack) contains the search term (needle) in at least one position.
func GetEncodedString ¶
func GetFuncResult ¶
func IsKindEqual ¶
func RandomKind ¶
func RandomString ¶
Types ¶
type Assert ¶
Assert implements the Tester interface. It is used for boolean only challenges. In addition to working seamlessly with the standard library testing package, it can return the bool result for use in alternate data collection or CI software. Result() automatically calls Run()
type Custom ¶
Custom implements Tester and can be used to hook into existing software by passing in the various test arguments with Hook(). Calling Hook() also calls Run() automaticaly.
type Random ¶
type Random interface { Tester Regenerate() }
Random implements Tester and creates a random test that can be used to generate many varied tests automatically. After each use, Regenerate() can be called to generate a new test. Regenerate() automatically calls Run().
type TBvalues ¶
NoTestResult is a slice containing only one value, the zero value of reflect.Value, which is an invalid result.
func TBmakeArgList ¶
func TBwrapInputValues ¶
func TBwrapInputValues(args ...interface{}) TBvalues
type Test ¶
type Test interface { // Name returns the name of the test. Name() string // Args returns the function input arguments. Args() TBvalues // Want returns the expected return value. Want() TBvalues // WantErr returns true if an error is expected // from an AssertTrue test (got == want). WantErr() bool // Got returns the cached function result. If the // function has not yet been called, it is called // and the value is cached and returned. Got() TBvalues // Run calls the the function (jit) if it has not // been called before and caches the result. Run() // Call specifically calls the function and returns // the result of the call whether the result is cached // or not. Call(in TBvalues) TBvalues }