2018-10-10 19:53:25 -07:00
|
|
|
package keeper
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2018-12-10 06:27:25 -08:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
2018-10-10 19:53:25 -07:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
"github.com/cosmos/cosmos-sdk/x/distribution/types"
|
|
|
|
)
|
|
|
|
|
2018-10-15 19:09:13 -07:00
|
|
|
func TestSetGetPreviousProposerConsAddr(t *testing.T) {
|
2018-10-10 19:53:25 -07:00
|
|
|
ctx, _, keeper, _, _ := CreateTestInputDefault(t, false, 0)
|
|
|
|
|
2018-10-15 19:09:13 -07:00
|
|
|
keeper.SetPreviousProposerConsAddr(ctx, valConsAddr1)
|
|
|
|
res := keeper.GetPreviousProposerConsAddr(ctx)
|
2018-10-10 19:53:25 -07:00
|
|
|
require.True(t, res.Equals(valConsAddr1), "expected: %v got: %v", valConsAddr1.String(), res.String())
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestSetGetCommunityTax(t *testing.T) {
|
|
|
|
ctx, _, keeper, _, _ := CreateTestInputDefault(t, false, 0)
|
|
|
|
|
|
|
|
someDec := sdk.NewDec(333)
|
|
|
|
keeper.SetCommunityTax(ctx, someDec)
|
|
|
|
res := keeper.GetCommunityTax(ctx)
|
|
|
|
require.True(sdk.DecEq(t, someDec, res))
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestSetGetFeePool(t *testing.T) {
|
|
|
|
ctx, _, keeper, _, _ := CreateTestInputDefault(t, false, 0)
|
|
|
|
|
|
|
|
fp := types.InitialFeePool()
|
2018-10-22 01:18:10 -07:00
|
|
|
fp.TotalValAccum.UpdateHeight = 777
|
2018-10-10 19:53:25 -07:00
|
|
|
|
|
|
|
keeper.SetFeePool(ctx, fp)
|
|
|
|
res := keeper.GetFeePool(ctx)
|
2018-10-22 01:18:10 -07:00
|
|
|
require.Equal(t, fp.TotalValAccum, res.TotalValAccum)
|
2018-10-10 19:53:25 -07:00
|
|
|
}
|