Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
张蕾
Geth-Modification
Commits
fc213c87
Unverified
Commit
fc213c87
authored
Dec 11, 2016
by
tbocek
Committed by
Péter Szilágyi
Jan 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
accounts/abi: added testcase to unpack []uint32
parent
972f0bd3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
abi_test.go
accounts/abi/abi_test.go
+24
-0
No files found.
accounts/abi/abi_test.go
View file @
fc213c87
...
@@ -332,6 +332,30 @@ func TestUnpackSetInterfaceSlice(t *testing.T) {
...
@@ -332,6 +332,30 @@ func TestUnpackSetInterfaceSlice(t *testing.T) {
}
}
}
}
func
TestUnpackSetInterfaceArrayOutput
(
t
*
testing
.
T
)
{
var
(
var1
=
new
([
1
]
uint32
)
var2
=
new
([
1
]
uint32
)
)
out
:=
[]
interface
{}{
var1
,
var2
}
abi
,
err
:=
JSON
(
strings
.
NewReader
(
`[{"type":"function", "name":"ints", "outputs":[{"type":"uint32[1]"}, {"type":"uint32[1]"}]}]`
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
marshalledReturn
:=
append
(
pad
([]
byte
{
1
},
32
,
true
),
pad
([]
byte
{
2
},
32
,
true
)
...
)
err
=
abi
.
Unpack
(
&
out
,
"ints"
,
marshalledReturn
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
*
var1
!=
[
1
]
uint32
{
1
}
{
t
.
Error
(
"expected var1 to be [1], got"
,
*
var1
)
}
if
*
var2
!=
[
1
]
uint32
{
2
}
{
t
.
Error
(
"expected var2 to be [2], got"
,
*
var2
)
}
}
func
TestPack
(
t
*
testing
.
T
)
{
func
TestPack
(
t
*
testing
.
T
)
{
for
i
,
test
:=
range
[]
struct
{
for
i
,
test
:=
range
[]
struct
{
typ
string
typ
string
...
...
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