diff options
author | Guillaume Ballet <gballet@gmail.com> | 2019-01-10 23:27:54 +0800 |
---|---|---|
committer | Martin Holst Swende <martin@swende.se> | 2019-01-10 23:27:54 +0800 |
commit | 38cce9ac333d674616047be14c270d7cfbd43641 (patch) | |
tree | 0b676d6246907dc679ef220ae1298d25b3a2da48 /accounts | |
parent | 7240f4d800d3ffb97cf23a27d13746428d761cec (diff) | |
download | dexon-38cce9ac333d674616047be14c270d7cfbd43641.tar dexon-38cce9ac333d674616047be14c270d7cfbd43641.tar.gz dexon-38cce9ac333d674616047be14c270d7cfbd43641.tar.bz2 dexon-38cce9ac333d674616047be14c270d7cfbd43641.tar.lz dexon-38cce9ac333d674616047be14c270d7cfbd43641.tar.xz dexon-38cce9ac333d674616047be14c270d7cfbd43641.tar.zst dexon-38cce9ac333d674616047be14c270d7cfbd43641.zip |
accounts/abi: Extra slice tests (#18424)
Co-authored-by: weimumu <934657014@qq.com>
Diffstat (limited to 'accounts')
-rw-r--r-- | accounts/abi/unpack_test.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/accounts/abi/unpack_test.go b/accounts/abi/unpack_test.go index 5ece81ef2..ff88be3d3 100644 --- a/accounts/abi/unpack_test.go +++ b/accounts/abi/unpack_test.go @@ -177,6 +177,11 @@ var unpackTests = []unpackTest{ want: [][]uint8{{1, 2}, {1, 2}}, }, { + def: `[{"type": "uint8[][]"}]`, + enc: "00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003", + want: [][]uint8{{1, 2}, {1, 2, 3}}, + }, + { def: `[{"type": "uint8[2][2]"}]`, enc: "0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002", want: [2][2]uint8{{1, 2}, {1, 2}}, @@ -252,6 +257,16 @@ var unpackTests = []unpackTest{ want: []string{"Ethereum", "go-ethereum"}, }, { + def: `[{"type": "bytes[]"}]`, + enc: "00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003f0f0f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003f0f0f00000000000000000000000000000000000000000000000000000000000", + want: [][]byte{{0xf0, 0xf0, 0xf0}, {0xf0, 0xf0, 0xf0}}, + }, + { + def: `[{"type": "uint256[2][][]"}]`, + enc: "00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c8000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000003e80000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c8000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000003e8", + want: [][][2]*big.Int{{{big.NewInt(1), big.NewInt(200)}, {big.NewInt(1), big.NewInt(1000)}}, {{big.NewInt(1), big.NewInt(200)}, {big.NewInt(1), big.NewInt(1000)}}}, + }, + { def: `[{"type": "int8[]"}]`, enc: "0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002", want: []int8{1, 2}, |