2020-03-04 09:49:59 -08:00
|
|
|
package types_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestBondStatus(t *testing.T) {
|
|
|
|
require.False(t, sdk.Unbonded.Equal(sdk.Bonded))
|
|
|
|
require.False(t, sdk.Unbonded.Equal(sdk.Unbonding))
|
|
|
|
require.False(t, sdk.Bonded.Equal(sdk.Unbonding))
|
2020-03-20 12:24:18 -07:00
|
|
|
require.Panicsf(t, func() { sdk.BondStatus(0).String() }, "invalid bond status") // nolint:govet
|
2020-03-18 05:59:08 -07:00
|
|
|
require.Equal(t, sdk.BondStatusUnbonded, sdk.Unbonded.String())
|
|
|
|
require.Equal(t, sdk.BondStatusBonded, sdk.Bonded.String())
|
|
|
|
require.Equal(t, sdk.BondStatusUnbonding, sdk.Unbonding.String())
|
2020-03-04 09:49:59 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestTokensToConsensusPower(t *testing.T) {
|
|
|
|
require.Equal(t, int64(0), sdk.TokensToConsensusPower(sdk.NewInt(999_999)))
|
|
|
|
require.Equal(t, int64(1), sdk.TokensToConsensusPower(sdk.NewInt(1_000_000)))
|
|
|
|
}
|