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
c358e628
Commit
c358e628
authored
Jul 17, 2019
by
linj
Committed by
vipwzw
Jul 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test
parent
ad42efee
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
means_test.go
plugin/dapp/unfreeze/executor/means_test.go
+55
-0
No files found.
plugin/dapp/unfreeze/executor/means_test.go
View file @
c358e628
...
@@ -180,3 +180,58 @@ func TestFixV1(t *testing.T) {
...
@@ -180,3 +180,58 @@ func TestFixV1(t *testing.T) {
})
})
}
}
}
}
// 查询可提币量, 和当前时间有关, 如对应节点时间不对, 查询结果也不对
func
TestLeftV2
(
t
*
testing
.
T
)
{
cases
:=
[]
struct
{
start
int64
now
int64
period
int64
total
int64
tenThousandth
int64
expect
int64
}{
{
1561607389
,
1561607389
+
500000
,
67200
,
11111130
,
1
,
11102244
},
{
1561607389
,
-
156107389
+
500000
,
67200
,
11111130
,
1
,
11111130
},
}
for
_
,
c
:=
range
cases
{
c
:=
c
t
.
Run
(
"test LeftProportionV2"
,
func
(
t
*
testing
.
T
)
{
create
:=
pty
.
UnfreezeCreate
{
StartTime
:
c
.
start
,
AssetExec
:
"coins"
,
AssetSymbol
:
"bty"
,
TotalCount
:
c
.
total
,
Beneficiary
:
"x"
,
Means
:
pty
.
LeftProportionX
,
MeansOpt
:
&
pty
.
UnfreezeCreate_LeftProportion
{
LeftProportion
:
&
pty
.
LeftProportion
{
Period
:
c
.
period
,
TenThousandth
:
c
.
tenThousandth
,
},
},
}
u
:=
&
pty
.
Unfreeze
{
TotalCount
:
c
.
total
,
Means
:
pty
.
LeftProportionX
,
StartTime
:
c
.
start
,
MeansOpt
:
&
pty
.
Unfreeze_LeftProportion
{
LeftProportion
:
&
pty
.
LeftProportion
{
Period
:
c
.
period
,
TenThousandth
:
c
.
tenThousandth
,
},
},
}
m
:=
leftProportion
{}
u
,
err
:=
m
.
setOpt
(
u
,
&
create
)
assert
.
Nil
(
t
,
err
)
f
,
err
:=
m
.
calcFrozen
(
u
,
c
.
now
)
assert
.
Nil
(
t
,
err
)
assert
.
Equal
(
t
,
c
.
expect
,
f
)
})
}
}
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