aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/args_test.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-24 00:33:01 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-24 00:33:01 +0800
commit1e61b75cbf0830a72b40d0eed8f924cb7bb61aa3 (patch)
tree892a12c0f76cbe7873ce7fbbb3b21c5ecdb0610a /rpc/args_test.go
parent0330077d76b48934ab024a309000f83c78047d8a (diff)
downloadgo-tangerine-1e61b75cbf0830a72b40d0eed8f924cb7bb61aa3.tar.gz
go-tangerine-1e61b75cbf0830a72b40d0eed8f924cb7bb61aa3.tar.zst
go-tangerine-1e61b75cbf0830a72b40d0eed8f924cb7bb61aa3.zip
tests + fixes
Diffstat (limited to 'rpc/args_test.go')
-rw-r--r--rpc/args_test.go35
1 files changed, 33 insertions, 2 deletions
diff --git a/rpc/args_test.go b/rpc/args_test.go
index 2ad53fba2..5cbafd4b2 100644
--- a/rpc/args_test.go
+++ b/rpc/args_test.go
@@ -5,6 +5,8 @@ import (
"encoding/json"
"math/big"
"testing"
+
+ "github.com/ethereum/go-ethereum/common"
)
func TestSha3(t *testing.T) {
@@ -440,8 +442,8 @@ func TestBlockFilterArgsWords(t *testing.T) {
"toBlock": "pending"
}]`
expected := new(BlockFilterArgs)
- expected.Earliest = 0
- expected.Latest = -1
+ expected.Earliest = -1
+ expected.Latest = -2
args := new(BlockFilterArgs)
if err := json.Unmarshal([]byte(input), &args); err != nil {
@@ -651,6 +653,10 @@ func TestFilterStringArgs(t *testing.T) {
t.Error(err)
}
+ if err := args.requirements(); err != nil {
+ t.Error(err)
+ }
+
if expected.Word != args.Word {
t.Errorf("Word shoud be %#v but is %#v", expected.Word, args.Word)
}
@@ -720,3 +726,28 @@ func TestHashIndexArgs(t *testing.T) {
t.Errorf("Index shoud be %#v but is %#v", expected.Index, args.Index)
}
}
+
+func TestSubmitWorkArgs(t *testing.T) {
+ input := `["0x0000000000000001", "0x1234567890abcdef1234567890abcdef", "0xD1GE5700000000000000000000000000"]`
+ expected := new(SubmitWorkArgs)
+ expected.Nonce = 1
+ expected.Header = common.HexToHash("0x1234567890abcdef1234567890abcdef")
+ expected.Digest = common.HexToHash("0xD1GE5700000000000000000000000000")
+
+ args := new(SubmitWorkArgs)
+ if err := json.Unmarshal([]byte(input), &args); err != nil {
+ t.Error(err)
+ }
+
+ if expected.Nonce != args.Nonce {
+ t.Errorf("Nonce shoud be %d but is %d", expected.Nonce, args.Nonce)
+ }
+
+ if expected.Header != args.Header {
+ t.Errorf("Header shoud be %#v but is %#v", expected.Header, args.Header)
+ }
+
+ if expected.Digest != args.Digest {
+ t.Errorf("Digest shoud be %#v but is %#v", expected.Digest, args.Digest)
+ }
+}