aboutsummaryrefslogtreecommitdiffstats
path: root/accounts/abi/numbers_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'accounts/abi/numbers_test.go')
-rw-r--r--accounts/abi/numbers_test.go26
1 files changed, 3 insertions, 23 deletions
diff --git a/accounts/abi/numbers_test.go b/accounts/abi/numbers_test.go
index d66a43258..f409aa60f 100644
--- a/accounts/abi/numbers_test.go
+++ b/accounts/abi/numbers_test.go
@@ -26,48 +26,28 @@ import (
func TestNumberTypes(t *testing.T) {
ubytes := make([]byte, 32)
ubytes[31] = 1
- sbytesmin := []byte{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
unsigned := U256(big.NewInt(1))
if !bytes.Equal(unsigned, ubytes) {
t.Errorf("expected %x got %x", ubytes, unsigned)
}
-
- signed := S256(big.NewInt(1))
- if !bytes.Equal(signed, ubytes) {
- t.Errorf("expected %x got %x", ubytes, unsigned)
- }
-
- signed = S256(big.NewInt(-1))
- if !bytes.Equal(signed, sbytesmin) {
- t.Errorf("expected %x got %x", ubytes, unsigned)
- }
}
func TestPackNumber(t *testing.T) {
ubytes := make([]byte, 32)
ubytes[31] = 1
- sbytesmin := []byte{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
maxunsigned := []byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}
- packed := packNum(reflect.ValueOf(1), IntTy)
- if !bytes.Equal(packed, ubytes) {
- t.Errorf("expected %x got %x", ubytes, packed)
- }
- packed = packNum(reflect.ValueOf(-1), IntTy)
- if !bytes.Equal(packed, sbytesmin) {
- t.Errorf("expected %x got %x", ubytes, packed)
- }
- packed = packNum(reflect.ValueOf(1), UintTy)
+ packed := packNum(reflect.ValueOf(1))
if !bytes.Equal(packed, ubytes) {
t.Errorf("expected %x got %x", ubytes, packed)
}
- packed = packNum(reflect.ValueOf(-1), UintTy)
+ packed = packNum(reflect.ValueOf(-1))
if !bytes.Equal(packed, maxunsigned) {
t.Errorf("expected %x got %x", maxunsigned, packed)
}
- packed = packNum(reflect.ValueOf("string"), UintTy)
+ packed = packNum(reflect.ValueOf("string"))
if packed != nil {
t.Errorf("expected 'string' to pack to nil. got %x instead", packed)
}