github.com/arieschain/arieschain@v0.0.0-20191023063405-37c074544356/accounts/abi/numbers_test.go (about) 1 package abi 2 3 import ( 4 "bytes" 5 "math/big" 6 "reflect" 7 "testing" 8 ) 9 10 func TestNumberTypes(t *testing.T) { 11 ubytes := make([]byte, 32) 12 ubytes[31] = 1 13 14 unsigned := U256(big.NewInt(1)) 15 if !bytes.Equal(unsigned, ubytes) { 16 t.Errorf("expected %x got %x", ubytes, unsigned) 17 } 18 } 19 20 func TestSigned(t *testing.T) { 21 if isSigned(reflect.ValueOf(uint(10))) { 22 t.Error("signed") 23 } 24 25 if !isSigned(reflect.ValueOf(int(10))) { 26 t.Error("not signed") 27 } 28 }