Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
7180a513
Commit
7180a513
authored
Feb 26, 2019
by
lilinleeli1234
Committed by
vipwzw
Feb 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update evm test file
parent
bf8fb1b4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
event_test.go
plugin/dapp/evm/executor/abi/event_test.go
+7
-7
unpack_test.go
plugin/dapp/evm/executor/abi/unpack_test.go
+2
-1
No files found.
plugin/dapp/evm/executor/abi/event_test.go
View file @
7180a513
...
@@ -159,7 +159,7 @@ func TestEventTupleUnpack(t *testing.T) {
...
@@ -159,7 +159,7 @@ func TestEventTupleUnpack(t *testing.T) {
}
}
type
EventPledge
struct
{
type
EventPledge
struct
{
Who
common
.
Hash160Address
Who
string
Wad
*
big
.
Int
Wad
*
big
.
Int
Currency
[
3
]
byte
Currency
[
3
]
byte
}
}
...
@@ -180,7 +180,7 @@ func TestEventTupleUnpack(t *testing.T) {
...
@@ -180,7 +180,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
.
HexToAddress
(
"0x00Ce0d46d924CC8437c806721496599FC3FFA268"
)
addr
:=
common
.
HexToAddress
(
"0x00Ce0d46d924CC8437c806721496599FC3FFA268"
)
.
ToAddress
()
.
String
()
var
testCases
=
[]
struct
{
var
testCases
=
[]
struct
{
data
string
data
string
dest
interface
{}
dest
interface
{}
...
@@ -242,7 +242,7 @@ func TestEventTupleUnpack(t *testing.T) {
...
@@ -242,7 +242,7 @@ func TestEventTupleUnpack(t *testing.T) {
"Can unpack Pledge event into structure"
,
"Can unpack Pledge event into structure"
,
},
{
},
{
pledgeData1
,
pledgeData1
,
&
[]
interface
{}{
&
common
.
Hash160Address
{}
,
&
bigint
,
&
[
3
]
byte
{}},
&
[]
interface
{}{
new
(
string
)
,
&
bigint
,
&
[
3
]
byte
{}},
&
[]
interface
{}{
&
[]
interface
{}{
&
addr
,
&
addr
,
&
bigintExpected2
,
&
bigintExpected2
,
...
@@ -252,7 +252,7 @@ func TestEventTupleUnpack(t *testing.T) {
...
@@ -252,7 +252,7 @@ func TestEventTupleUnpack(t *testing.T) {
"Can unpack Pledge event into slice"
,
"Can unpack Pledge event into slice"
,
},
{
},
{
pledgeData1
,
pledgeData1
,
&
[
3
]
interface
{}{
&
common
.
Hash160Address
{}
,
&
bigint
,
&
[
3
]
byte
{}},
&
[
3
]
interface
{}{
new
(
string
)
,
&
bigint
,
&
[
3
]
byte
{}},
&
[
3
]
interface
{}{
&
[
3
]
interface
{}{
&
addr
,
&
addr
,
&
bigintExpected2
,
&
bigintExpected2
,
...
@@ -265,18 +265,18 @@ func TestEventTupleUnpack(t *testing.T) {
...
@@ -265,18 +265,18 @@ func TestEventTupleUnpack(t *testing.T) {
&
[]
interface
{}{
new
(
int
),
0
,
0
},
&
[]
interface
{}{
new
(
int
),
0
,
0
},
&
[]
interface
{}{},
&
[]
interface
{}{},
jsonEventPledge
,
jsonEventPledge
,
"abi: cannot unmarshal
common.Hash160Address
in to int"
,
"abi: cannot unmarshal
string
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.Hash160Address in to string
"
,
"abi: cannot unmarshal
*big.Int in to int
"
,
"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
.
Hash160Address
{}
,
new
(
big
.
Int
)},
&
[]
interface
{}{
new
(
string
)
,
new
(
big
.
Int
)},
&
[]
interface
{}{},
&
[]
interface
{}{},
jsonEventPledge
,
jsonEventPledge
,
"abi: insufficient number of elements in the list/array for unpack, want 3, got 2"
,
"abi: insufficient number of elements in the list/array for unpack, want 3, got 2"
,
...
...
plugin/dapp/evm/executor/abi/unpack_test.go
View file @
7180a513
...
@@ -125,7 +125,8 @@ var unpackTests = []unpackTest{
...
@@ -125,7 +125,8 @@ var unpackTests = []unpackTest{
{
{
def
:
`[{"type": "address"}]`
,
def
:
`[{"type": "address"}]`
,
enc
:
"0000000000000000000000000100000000000000000000000000000000000000"
,
enc
:
"0000000000000000000000000100000000000000000000000000000000000000"
,
want
:
common
.
Hash160Address
{
1
},
want
:
common
.
Hash160Address
{
0
},
err
:
"abi: cannot unmarshal string in to common.Hash160Address"
,
},
},
{
{
def
:
`[{"type": "bytes32"}]`
,
def
:
`[{"type": "bytes32"}]`
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment