Module: stdgo.testing.quick
Overview
Index
-
function check(_f:stdgo.AnyInterface, _config:stdgo.testing.quick.Config):stdgo.Error
-
function testCheckProperty(_t:stdgo._internal.testing.T_):Void
-
function testEmptyStruct(_t:stdgo._internal.testing.T_):Void
-
function testMutuallyRecursive(_t:stdgo._internal.testing.T_):Void
-
function testNonZeroSliceAndMap(_t:stdgo._internal.testing.T_):Void
Classes
import
class Quick
Package quick implements utility functions to help with black box testing.
The testing/quick package is frozen and is not accepting new features.
Quick function check
function check(_f:stdgo.AnyInterface, _config:stdgo.testing.quick.Config):stdgo.Error
Check looks for an input to f, any function that returns bool,
such that f returns false. It calls f repeatedly, with arbitrary
values for each argument. If f returns false on a given input,
Check returns that input as a *CheckError.
For example:
func TestOddMultipleOfThree(t *testing.T) {
f := func(x int) bool {
y := OddMultipleOfThree(x)
return y%2 == 1 && y%3 == 0
}
if err := quick.Check(f, nil); err != nil {
t.Error(err)
}
}
Quick function checkEqual
function checkEqual(_f:stdgo.AnyInterface, _g:stdgo.AnyInterface, _config:stdgo.testing.quick.Config):stdgo.Error
CheckEqual looks for an input on which f and g return different results.
It calls f and g repeatedly with arbitrary values for each argument.
If f and g return different answers, CheckEqual returns a *CheckEqualError
describing the input and the outputs.
Quick function testCheckEqual
function testCheckEqual(_t:stdgo._internal.testing.T_):Void
Quick function testCheckProperty
function testCheckProperty(_t:stdgo._internal.testing.T_):Void
Quick function testEmptyStruct
function testEmptyStruct(_t:stdgo._internal.testing.T_):Void
Quick function testFailure
function testFailure(_t:stdgo._internal.testing.T_):Void
Quick function testInt64
function testInt64(_t:stdgo._internal.testing.T_):Void
Quick function testMutuallyRecursive
function testMutuallyRecursive(_t:stdgo._internal.testing.T_):Void
Quick function testNonZeroSliceAndMap
function testNonZeroSliceAndMap(_t:stdgo._internal.testing.T_):Void
Some serialization formats (e.g. encoding/pem) cannot distinguish
between a nil and an empty map or slice, so avoid generating the
zero value for these.
Quick function testRecursive
function testRecursive(_t:stdgo._internal.testing.T_):Void
Recursive data structures didn't terminate.
Issues 8818 and 11148.
Quick function value
function value(_t:stdgo._internal.reflect.Type_, _rand:stdgo._internal.math.rand.Rand):stdgo.Tuple<stdgo._internal.reflect.Value, Bool>
Value returns an arbitrary value of the given type.
If the type implements the Generator interface, that will be used.
Note: To create arbitrary values for structs, all the fields must be exported.
Typedefs
import
typedef Generator
typedef Generator = stdgo._internal.testing.quick.Generator;
typedef SetupError
typedef SetupError = stdgo._internal.testing.quick.SetupError;
typedef T__struct_0
typedef T__struct_0 = stdgo._internal.testing.quick.T__struct_0;
typedef TestArrayAlias
typedef TestArrayAlias = stdgo._internal.testing.quick.TestArrayAlias;
typedef TestBoolAlias
typedef TestBoolAlias = stdgo._internal.testing.quick.TestBoolAlias;
typedef TestComplex128Alias
typedef TestComplex128Alias = stdgo._internal.testing.quick.TestComplex128Alias;
typedef TestComplex64Alias
typedef TestComplex64Alias = stdgo._internal.testing.quick.TestComplex64Alias;
typedef TestFloat32Alias
typedef TestFloat32Alias = stdgo._internal.testing.quick.TestFloat32Alias;
typedef TestFloat64Alias
typedef TestFloat64Alias = stdgo._internal.testing.quick.TestFloat64Alias;
typedef TestInt16Alias
typedef TestInt16Alias = stdgo._internal.testing.quick.TestInt16Alias;
typedef TestInt32Alias
typedef TestInt32Alias = stdgo._internal.testing.quick.TestInt32Alias;
typedef TestInt64Alias
typedef TestInt64Alias = stdgo._internal.testing.quick.TestInt64Alias;
typedef TestInt8Alias
typedef TestInt8Alias = stdgo._internal.testing.quick.TestInt8Alias;
typedef TestIntAlias
typedef TestIntAlias = stdgo._internal.testing.quick.TestIntAlias;
typedef TestMapAlias
typedef TestMapAlias = stdgo._internal.testing.quick.TestMapAlias;
typedef TestPtrAlias
typedef TestPtrAlias = stdgo._internal.testing.quick.TestPtrAlias;
typedef TestSliceAlias
typedef TestSliceAlias = stdgo._internal.testing.quick.TestSliceAlias;
typedef TestStringAlias
typedef TestStringAlias = stdgo._internal.testing.quick.TestStringAlias;
typedef TestStructAlias
typedef TestStructAlias = stdgo._internal.testing.quick.TestStructAlias;
typedef TestUint16Alias
typedef TestUint16Alias = stdgo._internal.testing.quick.TestUint16Alias;
typedef TestUint32Alias
typedef TestUint32Alias = stdgo._internal.testing.quick.TestUint32Alias;
typedef TestUint64Alias
typedef TestUint64Alias = stdgo._internal.testing.quick.TestUint64Alias;
typedef TestUint8Alias
typedef TestUint8Alias = stdgo._internal.testing.quick.TestUint8Alias;
typedef TestUintAlias
typedef TestUintAlias = stdgo._internal.testing.quick.TestUintAlias;
typedef TestUintptrAlias
typedef TestUintptrAlias = stdgo._internal.testing.quick.TestUintptrAlias;