github.com/cosmos/cosmos-sdk@v0.50.10/types/staking_test.go (about)

     1  package types_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/suite"
     7  
     8  	"cosmossdk.io/math"
     9  
    10  	sdk "github.com/cosmos/cosmos-sdk/types"
    11  )
    12  
    13  type stakingTestSuite struct {
    14  	suite.Suite
    15  }
    16  
    17  func TestStakingTestSuite(t *testing.T) {
    18  	suite.Run(t, new(stakingTestSuite))
    19  }
    20  
    21  func (s *stakingTestSuite) SetupSuite() {
    22  	s.T().Parallel()
    23  }
    24  
    25  func (s *stakingTestSuite) TestTokensToConsensusPower() {
    26  	s.Require().Equal(int64(0), sdk.TokensToConsensusPower(math.NewInt(999_999), sdk.DefaultPowerReduction))
    27  	s.Require().Equal(int64(1), sdk.TokensToConsensusPower(math.NewInt(1_000_000), sdk.DefaultPowerReduction))
    28  }