Add BigInt() to Uint struct in types/uint.go, update tests to check ident (#5325)

This commit is contained in:
James Prestwich 2019-11-18 18:39:33 -08:00 committed by Alexander Bezobchuk
parent bb221a52ff
commit c89dee502a
2 changed files with 6 additions and 0 deletions

View File

@ -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)

View File

@ -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(),