Skip to content

Commit

Permalink
Add BigInt() to Uint struct in types/uint.go, update tests to check i…
Browse files Browse the repository at this point in the history
…dent (cosmos#5325)
  • Loading branch information
prestwich authored and alexanderbez committed Nov 19, 2019
1 parent bb221a5 commit c89dee5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions types/uint.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ type Uint struct {
i *big.Int
}

// BigInt converts Uint to big.Int
func (u Uint) BigInt() *big.Int {
return new(big.Int).Set(u.i)
}

// NewUintFromBigUint constructs Uint from big.Uint
func NewUintFromBigInt(i *big.Int) Uint {
u, err := checkNewUint(i)
Expand Down
1 change: 1 addition & 0 deletions types/uint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func TestIdentUint(t *testing.T) {

cases := []uint64{
i.Uint64(),
i.BigInt().Uint64(),
i.i.Uint64(),
ifromstr.Uint64(),
NewUintFromBigInt(new(big.Int).SetUint64(n)).Uint64(),
Expand Down

0 comments on commit c89dee5

Please sign in to comment.