diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-06-09 20:49:55 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-06-09 20:49:55 +0800 |
commit | f371e6c81a219b09b8c1822db764ab942ab8ca98 (patch) | |
tree | 297b58ce1acadc044325693fc8ed32bd9f1f7d0f /rpc/args_test.go | |
parent | 3054fd481175286591e5d867ec119e9151d02cb8 (diff) | |
parent | 1a967986428315b5551500f7db9c55c637fe6105 (diff) | |
download | dexon-f371e6c81a219b09b8c1822db764ab942ab8ca98.tar dexon-f371e6c81a219b09b8c1822db764ab942ab8ca98.tar.gz dexon-f371e6c81a219b09b8c1822db764ab942ab8ca98.tar.bz2 dexon-f371e6c81a219b09b8c1822db764ab942ab8ca98.tar.lz dexon-f371e6c81a219b09b8c1822db764ab942ab8ca98.tar.xz dexon-f371e6c81a219b09b8c1822db764ab942ab8ca98.tar.zst dexon-f371e6c81a219b09b8c1822db764ab942ab8ca98.zip |
Merge pull request #1156 from tgerring/issue1145
Differentiate between 0 and unspecified gas/gasprice
Diffstat (limited to 'rpc/args_test.go')
-rw-r--r-- | rpc/args_test.go | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/rpc/args_test.go b/rpc/args_test.go index 09ce12467..aef459961 100644 --- a/rpc/args_test.go +++ b/rpc/args_test.go @@ -573,14 +573,15 @@ func TestNewTxArgsGasMissing(t *testing.T) { "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675" }]` expected := new(NewTxArgs) - expected.Gas = big.NewInt(0) + expected.Gas = nil args := new(NewTxArgs) if err := json.Unmarshal([]byte(input), &args); err != nil { t.Error(err) } - if bytes.Compare(expected.Gas.Bytes(), args.Gas.Bytes()) != 0 { + if args.Gas != expected.Gas { + // if bytes.Compare(expected.Gas.Bytes(), args.Gas.Bytes()) != 0 { t.Errorf("Gas shoud be %v but is %v", expected.Gas, args.Gas) } } @@ -594,14 +595,15 @@ func TestNewTxArgsBlockGaspriceMissing(t *testing.T) { "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675" }]` expected := new(NewTxArgs) - expected.GasPrice = big.NewInt(0) + expected.GasPrice = nil args := new(NewTxArgs) if err := json.Unmarshal([]byte(input), &args); err != nil { t.Error(err) } - if bytes.Compare(expected.GasPrice.Bytes(), args.GasPrice.Bytes()) != 0 { + if args.GasPrice != expected.GasPrice { + // if bytes.Compare(expected.GasPrice.Bytes(), args.GasPrice.Bytes()) != 0 { t.Errorf("GasPrice shoud be %v but is %v", expected.GasPrice, args.GasPrice) } @@ -829,9 +831,10 @@ func TestCallArgsGasMissing(t *testing.T) { } expected := new(CallArgs) - expected.Gas = big.NewInt(0) + expected.Gas = nil - if bytes.Compare(expected.Gas.Bytes(), args.Gas.Bytes()) != 0 { + if args.Gas != expected.Gas { + // if bytes.Compare(expected.Gas.Bytes(), args.Gas.Bytes()) != 0 { t.Errorf("Gas shoud be %v but is %v", expected.Gas, args.Gas) } @@ -852,9 +855,10 @@ func TestCallArgsBlockGaspriceMissing(t *testing.T) { } expected := new(CallArgs) - expected.GasPrice = big.NewInt(0) + expected.GasPrice = nil - if bytes.Compare(expected.GasPrice.Bytes(), args.GasPrice.Bytes()) != 0 { + if args.GasPrice != expected.GasPrice { + // if bytes.Compare(expected.GasPrice.Bytes(), args.GasPrice.Bytes()) != 0 { t.Errorf("GasPrice shoud be %v but is %v", expected.GasPrice, args.GasPrice) } } |