Namespace: go.std.testing.quick
v1.0Contents
Summary
Provides a low-level interface to the testing/quick package.
Package quick implements utility functions to help with black box testing.
The testing/quick package is frozen and is not accepting new features.
Index
- *CheckEqualError
- *CheckError
- *Config
- *SetupError
- Check
- CheckEqual
- CheckEqualError
- CheckError
- Config
- Generator
- SetupError
- Value
- arrayOfCheckEqualError
- arrayOfCheckError
- arrayOfConfig
- arrayOfGenerator
- arrayOfSetupError
Legend
-
Constant
Variable
Function
Macro
Special form
Type
GoVar
Receiver/Method
Constants
Constants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.-
(None.)
Variables
-
(None.)
Functions, Macros, and Special Forms
-
Check
Function v1.0(Check f config)
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)
}
}
Go input arguments: (f any, config *Config)
Go returns: error
Joker input arguments: [^GoObject f, ^*Config config]
Joker returns: ^Error -
CheckEqual
Function v1.0(CheckEqual f g config)
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.
Go input arguments: (f any, g any, config *Config)
Go returns: error
Joker input arguments: [^GoObject f, ^GoObject g, ^*Config config]
Joker returns: ^Error -
Value
Function v1.0(Value t rand)
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.
Go input arguments: (t reflect.Type, rand *math/rand.Rand)
Go returns: (value reflect.Value, ok bool)
Joker input arguments: [^go.std.reflect/Type t, ^go.std.math.rand/*Rand rand]
Joker returns: [^go.std.reflect/Value value, ^Boolean ok]
Types
-
*CheckEqualError
Concrete Type v1.0A CheckEqualError is the result CheckEqual finding an error.
-
Error
Receiver for *CheckEqualError v1.0([])
-
*CheckError
Concrete Type v1.0A CheckError is the result of Check finding an error.
-
Error
Receiver for *CheckError v1.0([])
-
*Config
Concrete Type v1.0A Config structure contains options for running a test.
-
*SetupError
Concrete Type v1.0A SetupError is the result of an error in the way that check is being
used, independent of the functions being tested.
-
CheckEqualError
Concrete Type v1.0A CheckEqualError is the result CheckEqual finding an error.
-
CheckError
Concrete Type v1.0A CheckError is the result of Check finding an error.
-
Config
Concrete Type v1.0A Config structure contains options for running a test.
-
Generator
Abstract Type v1.0A Generator can generate random values of its own type.
-
Generate
Method for Generator v1.0([rand size])
-
SetupError
Concrete Type v1.0A SetupError is the result of an error in the way that check is being
used, independent of the functions being tested.
-
Error
Receiver for SetupError v1.0([])
-
arrayOfCheckEqualError
Concrete Type v1.0A CheckEqualError is the result CheckEqual finding an error.
-
arrayOfCheckError
Concrete Type v1.0A CheckError is the result of Check finding an error.
-
arrayOfConfig
Concrete Type v1.0A Config structure contains options for running a test.
-
arrayOfGenerator
Concrete Type v1.0A Generator can generate random values of its own type.
-
arrayOfSetupError
Concrete Type v1.0A SetupError is the result of an error in the way that check is being
used, independent of the functions being tested.