small test and some comments

This commit is contained in:
Ethan Buchman 2018-02-16 19:52:07 -05:00
parent 1555c4876e
commit 1698e4e2d8
3 changed files with 34 additions and 3 deletions

View File

@ -16,6 +16,35 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
) )
func TestMountStores(t *testing.T) {
app := NewBaseApp(t.Name())
// make some cap keys
capKey1 := sdk.NewKVStoreKey("key1")
capKey2 := sdk.NewKVStoreKey("key2")
// no stores are mounted
assert.Panics(t, func() { app.LoadLatestVersion(capKey1) })
app.MountStoresIAVL(capKey1, capKey2)
// both stores are mounted
err := app.LoadLatestVersion(capKey1)
assert.Nil(t, err)
err = app.LoadLatestVersion(capKey2)
assert.Nil(t, err)
}
func TestLoadVersion(t *testing.T) {
// TODO
}
func TestInitStater(t *testing.T) {
// TODO
}
//----------------------
// A mock transaction to update a validator's voting power. // A mock transaction to update a validator's voting power.
type testUpdatePowerTx struct { type testUpdatePowerTx struct {
Addr []byte Addr []byte
@ -33,7 +62,7 @@ func (tx testUpdatePowerTx) GetSigners() []crypto.Address { return ni
func (tx testUpdatePowerTx) GetFeePayer() crypto.Address { return nil } func (tx testUpdatePowerTx) GetFeePayer() crypto.Address { return nil }
func (tx testUpdatePowerTx) GetSignatures() []sdk.StdSignature { return nil } func (tx testUpdatePowerTx) GetSignatures() []sdk.StdSignature { return nil }
func TestBasic(t *testing.T) { func TestExecution(t *testing.T) {
// Create app. // Create app.
app := NewBaseApp(t.Name()) app := NewBaseApp(t.Name())

View File

@ -6,12 +6,13 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
) )
// Router - TODO add description // Router provides handlers for each transaction type.
type Router interface { type Router interface {
AddRoute(r string, h sdk.Handler) AddRoute(r string, h sdk.Handler)
Route(path string) (h sdk.Handler) Route(path string) (h sdk.Handler)
} }
// map a transaction type to a handler
type route struct { type route struct {
r string r string
h sdk.Handler h sdk.Handler

View File

@ -61,7 +61,8 @@ type CommitMultiStore interface {
Committer Committer
MultiStore MultiStore
// Mount a store of type. // Mount a store of type using the given db.
// If db == nil, the new store will use the CommitMultiStore db.
MountStoreWithDB(key StoreKey, typ StoreType, db dbm.DB) MountStoreWithDB(key StoreKey, typ StoreType, db dbm.DB)
// Panics on a nil key. // Panics on a nil key.