Documentation ¶
Index ¶
- func AssertAllInvariants(t *testing.T, app *baseapp.BaseApp, tests []Invariant, log string)
- func DisplayEvents(events map[string]uint)
- func RandStringOfLength(r *rand.Rand, n int) string
- func RandomAmount(r *rand.Rand, max sdk.Int) sdk.Int
- func RandomKey(r *rand.Rand, keys []crypto.PrivKey) crypto.PrivKey
- func Simulate(t *testing.T, app *baseapp.BaseApp, ...)
- func SimulateFromSeed(t *testing.T, app *baseapp.BaseApp, ...)
- type Invariant
- type RandSetup
- type TestAndRunTx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertAllInvariants ¶
AssertAllInvariants asserts a list of provided invariants against application state
func RandStringOfLength ¶
Generate a random string of a particular length
func Simulate ¶
func Simulate( t *testing.T, app *baseapp.BaseApp, appStateFn func(r *rand.Rand, accs []sdk.AccAddress) json.RawMessage, ops []TestAndRunTx, setups []RandSetup, invariants []Invariant, numKeys int, numBlocks int, blockSize int, )
Simulate tests application by sending random messages.
func SimulateFromSeed ¶
func SimulateFromSeed( t *testing.T, app *baseapp.BaseApp, appStateFn func(r *rand.Rand, accs []sdk.AccAddress) json.RawMessage, seed int64, ops []TestAndRunTx, setups []RandSetup, invariants []Invariant, numKeys int, numBlocks int, blockSize int, )
SimulateFromSeed tests an application by running the provided operations, testing the provided invariants, but using the provided seed.
Types ¶
type Invariant ¶
An Invariant is a function which tests a particular invariant. If the invariant has been broken, the function should halt the test and output the log.
type TestAndRunTx ¶
type TestAndRunTx func( t *testing.T, r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, privKeys []crypto.PrivKey, log string, event func(string), ) (action string, err sdk.Error)
TestAndRunTx produces a fuzzed transaction, and ensures the state transition was as expected. It returns a descriptive message "action" about what this fuzzed tx actually did, for ease of debugging.