mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
accounts/abi: Improve test coverage
This commit is contained in:
parent
3ca3fffdf0
commit
0bb14ea129
2 changed files with 20 additions and 0 deletions
|
|
@ -252,6 +252,9 @@ func TestTypeCheck(t *testing.T) {
|
||||||
{"bytes20", common.Address{}, ""},
|
{"bytes20", common.Address{}, ""},
|
||||||
{"address", [20]byte{}, ""},
|
{"address", [20]byte{}, ""},
|
||||||
{"address", common.Address{}, ""},
|
{"address", common.Address{}, ""},
|
||||||
|
{"bytes32[]]", "", "invalid arg type in abi"},
|
||||||
|
{"invalidType", "", "unsupported arg type: invalidType"},
|
||||||
|
{"invalidSlice[]", "", "unsupported arg type: invalidSlice"},
|
||||||
} {
|
} {
|
||||||
typ, err := NewType(test.typ)
|
typ, err := NewType(test.typ)
|
||||||
if err != nil && len(test.err) == 0 {
|
if err != nil && len(test.err) == 0 {
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,23 @@ var unpackTests = []unpackTest{
|
||||||
enc: "0000000000000000000000000000000000000000000000000000000000000001",
|
enc: "0000000000000000000000000000000000000000000000000000000000000001",
|
||||||
want: true,
|
want: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
def: `[{ "type": "bool" }]`,
|
||||||
|
enc: "0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
want: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
def: `[{ "type": "bool" }]`,
|
||||||
|
enc: "0000000000000000000000000000000000000000000000000001000000000001",
|
||||||
|
want: false,
|
||||||
|
err: "abi: improperly encoded boolean value",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
def: `[{ "type": "bool" }]`,
|
||||||
|
enc: "0000000000000000000000000000000000000000000000000000000000000003",
|
||||||
|
want: false,
|
||||||
|
err: "abi: improperly encoded boolean value",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
def: `[{"type": "uint32"}]`,
|
def: `[{"type": "uint32"}]`,
|
||||||
enc: "0000000000000000000000000000000000000000000000000000000000000001",
|
enc: "0000000000000000000000000000000000000000000000000000000000000001",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue