add sim test comments

This commit is contained in:
rhuairahrighairigh 2019-10-10 12:03:26 -04:00
parent 11c1d1b369
commit 154af93476

View File

@ -60,16 +60,16 @@ const (
// TestMain runs setup and teardown code before all tests. // TestMain runs setup and teardown code before all tests.
func TestMain(m *testing.M) { func TestMain(m *testing.M) {
// set prefixes // set prefixes
config := sdk.GetConfig() config := sdk.GetConfig()
SetBech32AddressPrefixes(config) SetBech32AddressPrefixes(config)
config.Seal() config.Seal()
// load the values from simulation specific flags // load the values from simulation specific flags
simapp.GetSimulatorFlags() simapp.GetSimulatorFlags()
// run tests // run tests
exitCode := m.Run() exitCode := m.Run()
os.Exit(exitCode) os.Exit(exitCode)
} }
func testAndRunTxs(app *App, config simulation.Config) []simulation.WeightedOperation { func testAndRunTxs(app *App, config simulation.Config) []simulation.WeightedOperation {
@ -329,6 +329,7 @@ func BenchmarkFullAppSimulation(b *testing.B) {
} }
} }
// TestFullAppSimulation runs a standard simulation of the app, modified by cmd line flag values.
func TestFullAppSimulation(t *testing.T) { func TestFullAppSimulation(t *testing.T) {
if !simapp.FlagEnabledValue { if !simapp.FlagEnabledValue {
t.Skip("skipping application simulation") t.Skip("skipping application simulation")
@ -383,6 +384,7 @@ func TestFullAppSimulation(t *testing.T) {
} }
} }
// TestAppImportExport runs a simulation, exports the state, imports it, then checks the db state is same after import as it was before export.
func TestAppImportExport(t *testing.T) { func TestAppImportExport(t *testing.T) {
if !simapp.FlagEnabledValue { if !simapp.FlagEnabledValue {
t.Skip("skipping application import/export simulation") t.Skip("skipping application import/export simulation")
@ -500,6 +502,7 @@ func TestAppImportExport(t *testing.T) {
} }
} }
// TestAppSimulationAfterImport runs a simulation, exports it, imports it and runs another simulation.
func TestAppSimulationAfterImport(t *testing.T) { func TestAppSimulationAfterImport(t *testing.T) {
if !simapp.FlagEnabledValue { if !simapp.FlagEnabledValue {
t.Skip("skipping application simulation after import") t.Skip("skipping application simulation after import")
@ -594,6 +597,7 @@ func TestAppSimulationAfterImport(t *testing.T) {
// TODO: Make another test for the fuzzer itself, which just has noOp txs // TODO: Make another test for the fuzzer itself, which just has noOp txs
// and doesn't depend on the application. // and doesn't depend on the application.
// TestAppStateDeterminism runs several sims with the same seed and checks the states are equal.
func TestAppStateDeterminism(t *testing.T) { func TestAppStateDeterminism(t *testing.T) {
if !simapp.FlagEnabledValue { if !simapp.FlagEnabledValue {
t.Skip("skipping application simulation") t.Skip("skipping application simulation")