aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-27 03:25:30 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-27 03:25:30 +0800
commitddcc8e1673f240556f7a9394d5fbc9ed609a4931 (patch)
tree7af47bfaa7693bd8144a36dee5e36c254c592ccc /rpc
parentb414a1303f33aef26b606367ac68163f9b6c87c8 (diff)
downloadgo-tangerine-ddcc8e1673f240556f7a9394d5fbc9ed609a4931.tar
go-tangerine-ddcc8e1673f240556f7a9394d5fbc9ed609a4931.tar.gz
go-tangerine-ddcc8e1673f240556f7a9394d5fbc9ed609a4931.tar.bz2
go-tangerine-ddcc8e1673f240556f7a9394d5fbc9ed609a4931.tar.lz
go-tangerine-ddcc8e1673f240556f7a9394d5fbc9ed609a4931.tar.xz
go-tangerine-ddcc8e1673f240556f7a9394d5fbc9ed609a4931.tar.zst
go-tangerine-ddcc8e1673f240556f7a9394d5fbc9ed609a4931.zip
SubmitWorkArgs tests
Diffstat (limited to 'rpc')
-rw-r--r--rpc/args_test.go48
1 files changed, 48 insertions, 0 deletions
diff --git a/rpc/args_test.go b/rpc/args_test.go
index b3df3ba38..0b243e760 100644
--- a/rpc/args_test.go
+++ b/rpc/args_test.go
@@ -1370,3 +1370,51 @@ func TestSubmitWorkArgs(t *testing.T) {
t.Errorf("Digest shoud be %#v but is %#v", expected.Digest, args.Digest)
}
}
+
+func TestSubmitWorkArgsInvalid(t *testing.T) {
+ input := `{}`
+
+ args := new(SubmitWorkArgs)
+ str := ExpectDecodeParamError(json.Unmarshal([]byte(input), args))
+ if len(str) > 0 {
+ t.Error(str)
+ }
+}
+
+func TestSubmitWorkArgsEmpty(t *testing.T) {
+ input := `[]`
+
+ args := new(SubmitWorkArgs)
+ str := ExpectInsufficientParamsError(json.Unmarshal([]byte(input), args))
+ if len(str) > 0 {
+ t.Error(str)
+ }
+}
+
+func TestSubmitWorkArgsNonceInt(t *testing.T) {
+ input := `[1, "0x1234567890abcdef1234567890abcdef", "0xD1GE5700000000000000000000000000"]`
+
+ args := new(SubmitWorkArgs)
+ str := ExpectInvalidTypeError(json.Unmarshal([]byte(input), args))
+ if len(str) > 0 {
+ t.Error(str)
+ }
+}
+func TestSubmitWorkArgsHeaderInt(t *testing.T) {
+ input := `["0x0000000000000001", 1, "0xD1GE5700000000000000000000000000"]`
+
+ args := new(SubmitWorkArgs)
+ str := ExpectInvalidTypeError(json.Unmarshal([]byte(input), args))
+ if len(str) > 0 {
+ t.Error(str)
+ }
+}
+func TestSubmitWorkArgsDigestInt(t *testing.T) {
+ input := `["0x0000000000000001", "0x1234567890abcdef1234567890abcdef", 1]`
+
+ args := new(SubmitWorkArgs)
+ str := ExpectInvalidTypeError(json.Unmarshal([]byte(input), args))
+ if len(str) > 0 {
+ t.Error(str)
+ }
+}