aboutsummaryrefslogtreecommitdiffstats
path: root/rlp/decode_test.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-08-13 17:10:26 +0800
committerFelix Lange <fjl@twurst.com>2015-08-13 17:10:26 +0800
commit0b0b31c7d2572a9ea9d88056b1951d6a2162ef23 (patch)
tree7ca11784e810dfab9fa9770fa9957bfe452bdb35 /rlp/decode_test.go
parent0dd6911c6222ce65d6aa0760f7c322246464b2d0 (diff)
parent1d2420323ca555f8ac45969bd39415c5e619e4e0 (diff)
downloaddexon-0b0b31c7d2572a9ea9d88056b1951d6a2162ef23.tar
dexon-0b0b31c7d2572a9ea9d88056b1951d6a2162ef23.tar.gz
dexon-0b0b31c7d2572a9ea9d88056b1951d6a2162ef23.tar.bz2
dexon-0b0b31c7d2572a9ea9d88056b1951d6a2162ef23.tar.lz
dexon-0b0b31c7d2572a9ea9d88056b1951d6a2162ef23.tar.xz
dexon-0b0b31c7d2572a9ea9d88056b1951d6a2162ef23.tar.zst
dexon-0b0b31c7d2572a9ea9d88056b1951d6a2162ef23.zip
Merge pull request #1651 from karalabe/rlp-boolean-support
rlp: boolean support
Diffstat (limited to 'rlp/decode_test.go')
-rw-r--r--rlp/decode_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/rlp/decode_test.go b/rlp/decode_test.go
index 331faa9d8..d6b0611dd 100644
--- a/rlp/decode_test.go
+++ b/rlp/decode_test.go
@@ -19,6 +19,7 @@ package rlp
import (
"bytes"
"encoding/hex"
+ "errors"
"fmt"
"io"
"math/big"
@@ -116,6 +117,9 @@ func TestStreamErrors(t *testing.T) {
{"817F", calls{"Uint"}, nil, ErrCanonSize},
{"8180", calls{"Uint"}, nil, nil},
+ // Non-valid boolean
+ {"02", calls{"Bool"}, nil, errors.New("rlp: invalid boolean value: 2")},
+
// Size tags must use the smallest possible encoding.
// Leading zero bytes in the size tag are also rejected.
{"8100", calls{"Uint"}, nil, ErrCanonSize},
@@ -315,6 +319,11 @@ var (
)
var decodeTests = []decodeTest{
+ // booleans
+ {input: "01", ptr: new(bool), value: true},
+ {input: "80", ptr: new(bool), value: false},
+ {input: "02", ptr: new(bool), error: "rlp: invalid boolean value: 2"},
+
// integers
{input: "05", ptr: new(uint32), value: uint32(5)},
{input: "80", ptr: new(uint32), value: uint32(0)},