diff options
author | Paweł Bylica <pawel.bylica@imapp.pl> | 2015-02-24 01:39:05 +0800 |
---|---|---|
committer | Paweł Bylica <pawel.bylica@imapp.pl> | 2015-02-24 01:39:05 +0800 |
commit | 114c3b4efe7f30ab7be0bec013210e7b4c3d08d7 (patch) | |
tree | 5230f6fee87dcbac36e1d71d6ab731b55eab8268 /rlp/encode_test.go | |
parent | b9894c1d0979b9f3e8428b1dc230f1ece106f676 (diff) | |
parent | dd086791acf477da7641c168f82de70ed0b2dca6 (diff) | |
download | go-tangerine-114c3b4efe7f30ab7be0bec013210e7b4c3d08d7.tar go-tangerine-114c3b4efe7f30ab7be0bec013210e7b4c3d08d7.tar.gz go-tangerine-114c3b4efe7f30ab7be0bec013210e7b4c3d08d7.tar.bz2 go-tangerine-114c3b4efe7f30ab7be0bec013210e7b4c3d08d7.tar.lz go-tangerine-114c3b4efe7f30ab7be0bec013210e7b4c3d08d7.tar.xz go-tangerine-114c3b4efe7f30ab7be0bec013210e7b4c3d08d7.tar.zst go-tangerine-114c3b4efe7f30ab7be0bec013210e7b4c3d08d7.zip |
Merge remote-tracking branch 'upstream/develop' into evmjit
Diffstat (limited to 'rlp/encode_test.go')
-rw-r--r-- | rlp/encode_test.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/rlp/encode_test.go b/rlp/encode_test.go index 18b843737..c283fbd57 100644 --- a/rlp/encode_test.go +++ b/rlp/encode_test.go @@ -40,6 +40,8 @@ func (e *encodableReader) Read(b []byte) (int, error) { panic("called") } +type namedByteType byte + var ( _ = Encoder(&testEncoder{}) _ = Encoder(byteEncoder(0)) @@ -102,6 +104,10 @@ var encTests = []encTest{ // byte slices, strings {val: []byte{}, output: "80"}, {val: []byte{1, 2, 3}, output: "83010203"}, + + {val: []namedByteType{1, 2, 3}, output: "83010203"}, + {val: [...]namedByteType{1, 2, 3}, output: "83010203"}, + {val: "", output: "80"}, {val: "dog", output: "83646F67"}, { @@ -177,6 +183,15 @@ var encTests = []encTest{ {val: &recstruct{5, nil}, output: "C205C0"}, {val: &recstruct{5, &recstruct{4, &recstruct{3, nil}}}, output: "C605C404C203C0"}, + // flat + {val: Flat(uint(1)), error: "rlp.Flat: uint did not encode as list"}, + {val: Flat(simplestruct{A: 3, B: "foo"}), output: "0383666F6F"}, + { + // value generates more list headers after the Flat + val: []interface{}{"foo", []uint{1, 2}, Flat([]uint{3, 4}), []uint{5, 6}, "bar"}, + output: "D083666F6FC201020304C2050683626172", + }, + // nil {val: (*uint)(nil), output: "80"}, {val: (*string)(nil), output: "80"}, |