diff options
author | Felix Lange <fjl@twurst.com> | 2015-03-21 07:49:31 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-03-21 07:49:31 +0800 |
commit | a829a5658723ff3681f14650818ef050cb0a7fa8 (patch) | |
tree | 5736f714715fb5f229f7854bec6e76d333485fc6 /rlp/decode_test.go | |
parent | 81800ca39ea03da7f63d8ecfbd74773f4ca73323 (diff) | |
download | go-tangerine-a829a5658723ff3681f14650818ef050cb0a7fa8.tar.gz go-tangerine-a829a5658723ff3681f14650818ef050cb0a7fa8.tar.zst go-tangerine-a829a5658723ff3681f14650818ef050cb0a7fa8.zip |
rlp: add Stream.Raw
Diffstat (limited to 'rlp/decode_test.go')
-rw-r--r-- | rlp/decode_test.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/rlp/decode_test.go b/rlp/decode_test.go index 0f034d5d8..a18ff1d08 100644 --- a/rlp/decode_test.go +++ b/rlp/decode_test.go @@ -165,6 +165,20 @@ func TestStreamList(t *testing.T) { } } +func TestStreamRaw(t *testing.T) { + s := NewStream(bytes.NewReader(unhex("C58401010101"))) + s.List() + + want := unhex("8401010101") + raw, err := s.Raw() + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(want, raw) { + t.Errorf("raw mismatch: got %x, want %x", raw, want) + } +} + func TestDecodeErrors(t *testing.T) { r := bytes.NewReader(nil) @@ -331,7 +345,7 @@ var decodeTests = []decodeTest{ {input: "C109", ptr: new(*[]uint), value: &[]uint{9}}, {input: "C58403030303", ptr: new(*[][]byte), value: &[][]byte{{3, 3, 3, 3}}}, - // check that input position is advanced also empty values. + // check that input position is advanced also for empty values. {input: "C3808005", ptr: new([]*uint), value: []*uint{nil, nil, uintp(5)}}, // pointer should be reset to nil |