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
044c597b
Commit
044c597b
authored
Dec 25, 2019
by
harrylee
Committed by
vipwzw
Dec 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add more test
parent
f8744992
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
exchange_test.go
plugin/dapp/exchange/executor/exchange_test.go
+7
-3
No files found.
plugin/dapp/exchange/executor/exchange_test.go
View file @
044c597b
...
...
@@ -231,8 +231,9 @@ func TestExchange(t *testing.T) {
3.再挂数量是5,价格为4的卖单
4.再挂数量是5,价格为5的卖单
5.挂数量是15,价格为4.5的买单
6.挂单数量是 5,价格为1的卖单
7.撤回未成交的卖单
6.挂单数量是2,价格为1的卖单
7.挂单数量是8,价格为1的卖单
8.撤回未成交的卖单
*/
Exec_LimitOrder
(
t
,
&
et
.
LimitOrder
{
LeftAsset
:
&
et
.
Asset
{
Symbol
:
"bty"
,
Execer
:
"coins"
},
...
...
@@ -292,7 +293,10 @@ func TestExchange(t *testing.T) {
assert
.
Equal
(
t
,
80
*
types
.
Coin
,
acc
.
Balance
)
Exec_LimitOrder
(
t
,
&
et
.
LimitOrder
{
LeftAsset
:
&
et
.
Asset
{
Symbol
:
"bty"
,
Execer
:
"coins"
},
RightAsset
:
&
et
.
Asset
{
Execer
:
"token"
,
Symbol
:
"CCNY"
},
Price
:
100000000
,
Amount
:
10
*
types
.
Coin
,
Op
:
et
.
OpSell
},
PrivKeyC
,
stateDB
,
kvdb
,
env
)
RightAsset
:
&
et
.
Asset
{
Execer
:
"token"
,
Symbol
:
"CCNY"
},
Price
:
100000000
,
Amount
:
2
*
types
.
Coin
,
Op
:
et
.
OpSell
},
PrivKeyC
,
stateDB
,
kvdb
,
env
)
orderList
,
err
=
Exec_QueryOrderList
(
et
.
Completed
,
Nodes
[
2
],
""
,
stateDB
,
kvdb
)
Exec_LimitOrder
(
t
,
&
et
.
LimitOrder
{
LeftAsset
:
&
et
.
Asset
{
Symbol
:
"bty"
,
Execer
:
"coins"
},
RightAsset
:
&
et
.
Asset
{
Execer
:
"token"
,
Symbol
:
"CCNY"
},
Price
:
100000000
,
Amount
:
8
*
types
.
Coin
,
Op
:
et
.
OpSell
},
PrivKeyC
,
stateDB
,
kvdb
,
env
)
orderList
,
err
=
Exec_QueryOrderList
(
et
.
Ordered
,
Nodes
[
2
],
""
,
stateDB
,
kvdb
)
orderID10
:=
orderList
.
List
[
0
]
.
OrderID
assert
.
Equal
(
t
,
int32
(
et
.
Ordered
),
orderList
.
List
[
0
]
.
Status
)
...
...
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