Commit a193cf1c authored by harrylee's avatar harrylee Committed by 33cn

rejust code for unit_test

parent 9d67fef6
...@@ -192,7 +192,7 @@ func TestEventTupleUnpack(t *testing.T) { ...@@ -192,7 +192,7 @@ func TestEventTupleUnpack(t *testing.T) {
} }
type EventPledge struct { type EventPledge struct {
Who common.Address Who common.Hash160Address
Wad *big.Int Wad *big.Int
Currency [3]byte Currency [3]byte
} }
...@@ -213,7 +213,7 @@ func TestEventTupleUnpack(t *testing.T) { ...@@ -213,7 +213,7 @@ func TestEventTupleUnpack(t *testing.T) {
bigintExpected := big.NewInt(1000000) bigintExpected := big.NewInt(1000000)
bigintExpected2 := big.NewInt(2218516807680) bigintExpected2 := big.NewInt(2218516807680)
bigintExpected3 := big.NewInt(1000001) bigintExpected3 := big.NewInt(1000001)
addr := common.HexToAddr("0x00Ce0d46d924CC8437c806721496599FC3FFA268") addr := common.HexToAddress("0x00Ce0d46d924CC8437c806721496599FC3FFA268")
var testCases = []struct { var testCases = []struct {
data string data string
dest interface{} dest interface{}
...@@ -275,7 +275,7 @@ func TestEventTupleUnpack(t *testing.T) { ...@@ -275,7 +275,7 @@ func TestEventTupleUnpack(t *testing.T) {
"Can unpack Pledge event into structure", "Can unpack Pledge event into structure",
}, { }, {
pledgeData1, pledgeData1,
&[]interface{}{&common.Address{}, &bigint, &[3]byte{}}, &[]interface{}{&common.Hash160Address{}, &bigint, &[3]byte{}},
&[]interface{}{ &[]interface{}{
&addr, &addr,
&bigintExpected2, &bigintExpected2,
...@@ -285,7 +285,7 @@ func TestEventTupleUnpack(t *testing.T) { ...@@ -285,7 +285,7 @@ func TestEventTupleUnpack(t *testing.T) {
"Can unpack Pledge event into slice", "Can unpack Pledge event into slice",
}, { }, {
pledgeData1, pledgeData1,
&[3]interface{}{&common.Address{}, &bigint, &[3]byte{}}, &[3]interface{}{&common.Hash160Address{}, &bigint, &[3]byte{}},
&[3]interface{}{ &[3]interface{}{
&addr, &addr,
&bigintExpected2, &bigintExpected2,
...@@ -298,18 +298,18 @@ func TestEventTupleUnpack(t *testing.T) { ...@@ -298,18 +298,18 @@ func TestEventTupleUnpack(t *testing.T) {
&[]interface{}{new(int), 0, 0}, &[]interface{}{new(int), 0, 0},
&[]interface{}{}, &[]interface{}{},
jsonEventPledge, jsonEventPledge,
"abi: cannot unmarshal common.Address in to int", "abi: cannot unmarshal common.Hash160Address in to int",
"Can not unpack Pledge event into slice with wrong types", "Can not unpack Pledge event into slice with wrong types",
}, { }, {
pledgeData1, pledgeData1,
&BadEventPledge{}, &BadEventPledge{},
&BadEventPledge{}, &BadEventPledge{},
jsonEventPledge, jsonEventPledge,
"abi: cannot unmarshal common.Address in to string", "abi: cannot unmarshal common.Hash160Address in to string",
"Can not unpack Pledge event into struct with wrong filed types", "Can not unpack Pledge event into struct with wrong filed types",
}, { }, {
pledgeData1, pledgeData1,
&[]interface{}{common.Address{}, new(big.Int)}, &[]interface{}{common.Hash160Address{}, new(big.Int)},
&[]interface{}{}, &[]interface{}{},
jsonEventPledge, jsonEventPledge,
"abi: insufficient number of arguments for unpack, want 3, got 2", "abi: insufficient number of arguments for unpack, want 3, got 2",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment