Add BigInt() to Uint struct in types/uint.go, update tests to check ident (#5325)
This commit is contained in:
parent
bb221a52ff
commit
c89dee502a
|
@ -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)
|
||||
|
|
|
@ -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(),
|
||||
|
|
Loading…
Reference in New Issue