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
672cc125
Commit
672cc125
authored
Jan 09, 2020
by
linj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update test
parent
252cb971
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
46 deletions
+5
-46
trade_test.go
plugin/dapp/trade/executor/trade_test.go
+5
-46
No files found.
plugin/dapp/trade/executor/trade_test.go
View file @
672cc125
...
...
@@ -9,7 +9,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/33cn/chain33/types"
pty
"github.com/33cn/plugin/plugin/dapp/trade/types"
)
...
...
@@ -68,51 +67,11 @@ var (
}
)
func
init
()
{
}
// 分叉不好构造, 直接生成对应的kv 记录进行对比
// 在save时有值的, 需要在del 时设置为空;或save 时设置为空, 在del 时有值的
func
check
(
t
*
testing
.
T
,
kvSave
,
kvDel
[]
*
types
.
KeyValue
)
{
kvmapSave
:=
map
[
string
]
string
{}
for
_
,
kv
:=
range
kvSave
{
if
string
(
kv
.
Value
)
!=
"IAMSELLID"
&&
kv
.
Value
!=
nil
{
t
.
Error
(
"onsale error"
)
}
kvmapSave
[
string
(
kv
.
Key
)]
=
string
(
kv
.
Value
)
}
for
_
,
kv
:=
range
kvDel
{
v
,
ok
:=
kvmapSave
[
string
(
kv
.
Key
)]
if
!
ok
{
t
.
Error
(
"error 1"
)
}
if
len
(
v
)
==
0
&&
len
(
kv
.
Value
)
==
0
{
t
.
Error
(
"error 2"
)
}
if
len
(
v
)
!=
0
&&
len
(
kv
.
Value
)
!=
0
{
t
.
Error
(
"error 3"
)
}
}
}
func
TestOnsaleSaveDel
(
t
*
testing
.
T
)
{
kvOnsale
:=
genSaveSellKv
(
&
sellorderOnsale
)
kvOnsaleDel
:=
genDeleteSellKv
(
&
sellorderOnsale
)
check
(
t
,
kvOnsale
,
kvOnsaleDel
)
}
func
TestSoldOutSaveDel
(
t
*
testing
.
T
)
{
kv
:=
genSaveSellKv
(
&
sellorderSoldOut
)
kvDel
:=
genDeleteSellKv
(
&
sellorderSoldOut
)
check
(
t
,
kv
,
kvDel
)
}
func
TestRevokeSaveDel
(
t
*
testing
.
T
)
{
kv
:=
genSaveSellKv
(
&
sellorderRevoked
)
kvDel
:=
genDeleteSellKv
(
&
sellorderRevoked
)
check
(
t
,
kv
,
kvDel
)
// TODO 几个测试数据 linter 不报错, 修改好后写测试可能需要用
func
Test_Order
(
t
*
testing
.
T
)
{
assert
.
NotNil
(
t
,
&
sellorderOnsale
)
assert
.
NotNil
(
t
,
&
sellorderSoldOut
)
assert
.
NotNil
(
t
,
&
sellorderRevoked
)
}
func
TestPriceCheck
(
t
*
testing
.
T
)
{
...
...
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