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
3a1cc6db
Commit
3a1cc6db
authored
Jul 19, 2021
by
mdj33
Committed by
vipwzw
Jul 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ut
parent
480b8a3a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
action.go
plugin/dapp/coinsx/executor/action.go
+2
-0
action_test.go
plugin/dapp/coinsx/executor/action_test.go
+36
-0
No files found.
plugin/dapp/coinsx/executor/action.go
View file @
3a1cc6db
...
@@ -111,6 +111,7 @@ func (a *action) configTransfer(config *coinTy.TransferFlagConfig) (*types.Recei
...
@@ -111,6 +111,7 @@ func (a *action) configTransfer(config *coinTy.TransferFlagConfig) (*types.Recei
}
}
//过滤重复地址
func
filterAddrs
(
addrs
[]
string
)
[]
string
{
func
filterAddrs
(
addrs
[]
string
)
[]
string
{
f
:=
make
(
map
[
string
]
bool
)
f
:=
make
(
map
[
string
]
bool
)
var
newAddrs
[]
string
var
newAddrs
[]
string
...
@@ -143,6 +144,7 @@ func (a *action) addAccounts(addrs []string) (*types.Receipt, error) {
...
@@ -143,6 +144,7 @@ func (a *action) addAccounts(addrs []string) (*types.Receipt, error) {
}
}
//删除掉指定地址
func
filterByAddrs
(
curr
,
del
[]
string
)
[]
string
{
func
filterByAddrs
(
curr
,
del
[]
string
)
[]
string
{
f
:=
make
(
map
[
string
]
bool
)
f
:=
make
(
map
[
string
]
bool
)
for
_
,
k
:=
range
del
{
for
_
,
k
:=
range
del
{
...
...
plugin/dapp/coinsx/executor/action_test.go
0 → 100644
View file @
3a1cc6db
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
"github.com/stretchr/testify/assert"
"testing"
)
func
TestFilterByAddrs
(
t
*
testing
.
T
)
{
curr
:=
[]
string
{
"aa"
,
"bb"
,
"cc"
}
del
:=
[]
string
{
"bb"
}
expect
:=
[]
string
{
"aa"
,
"cc"
}
ret
:=
filterByAddrs
(
curr
,
del
)
assert
.
Equal
(
t
,
ret
,
expect
)
del
=
[]
string
{
"aa"
,
"bb"
,
"cc"
}
ret
=
filterByAddrs
(
curr
,
del
)
assert
.
Equal
(
t
,
[]
string
(
nil
),
ret
)
}
func
TestFilterAddrs
(
t
*
testing
.
T
)
{
curr
:=
[]
string
{
"aa"
,
"bb"
,
"cc"
,
"bb"
}
exp
:=
[]
string
{
"aa"
,
"bb"
,
"cc"
}
ret
:=
filterAddrs
(
curr
)
assert
.
Equal
(
t
,
ret
,
exp
)
curr
=
[]
string
{
"bb"
,
"bb"
}
ret
=
filterAddrs
(
curr
)
assert
.
Equal
(
t
,
[]
string
{
"bb"
},
ret
)
}
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