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
91390fe4
Commit
91390fe4
authored
Oct 09, 2019
by
harrylee
Committed by
vipwzw
Oct 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix a bug for make linter
parent
5711063d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
game_test.go
plugin/dapp/game/executor/game_test.go
+18
-18
No files found.
plugin/dapp/game/executor/game_test.go
View file @
91390fe4
...
@@ -36,7 +36,7 @@ var (
...
@@ -36,7 +36,7 @@ var (
func
TestGame
(
t
*
testing
.
T
)
{
func
TestGame
(
t
*
testing
.
T
)
{
types
.
SetTitleOnlyForTest
(
"chain33"
)
types
.
SetTitleOnlyForTest
(
"chain33"
)
total
:=
int64
(
100
*
types
.
Coin
)
total
:=
100
*
types
.
Coin
accountA
:=
types
.
Account
{
accountA
:=
types
.
Account
{
Balance
:
total
,
Balance
:
total
,
Frozen
:
0
,
Frozen
:
0
,
...
@@ -112,10 +112,10 @@ func TestGame(t *testing.T) {
...
@@ -112,10 +112,10 @@ func TestGame(t *testing.T) {
kvdb
.
Set
(
kv
.
Key
,
kv
.
Value
)
kvdb
.
Set
(
kv
.
Key
,
kv
.
Value
)
}
}
gameI
d
:=
common
.
ToHex
(
createTx
.
Hash
())
gameI
D
:=
common
.
ToHex
(
createTx
.
Hash
())
//match game
//match game
matchParam
:=
&
pty
.
GamePreMatchTx
{
GameID
:
gameI
d
,
Guess
:
Scissor
,
Fee
:
100000
}
matchParam
:=
&
pty
.
GamePreMatchTx
{
GameID
:
gameI
D
,
Guess
:
Scissor
,
Fee
:
100000
}
matchTx
,
err
:=
pty
.
CreateRawGamePreMatchTx
(
matchParam
)
matchTx
,
err
:=
pty
.
CreateRawGamePreMatchTx
(
matchParam
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
...
@@ -141,7 +141,7 @@ func TestGame(t *testing.T) {
...
@@ -141,7 +141,7 @@ func TestGame(t *testing.T) {
kvdb
.
Set
(
kv
.
Key
,
kv
.
Value
)
kvdb
.
Set
(
kv
.
Key
,
kv
.
Value
)
}
}
msg
,
err
:=
exec
.
Query
(
pty
.
FuncNameQueryGameListByIds
,
types
.
Encode
(
&
pty
.
QueryGameInfos
{
msg
,
err
:=
exec
.
Query
(
pty
.
FuncNameQueryGameListByIds
,
types
.
Encode
(
&
pty
.
QueryGameInfos
{
GameIds
:
[]
string
{
gameI
d
},
GameIds
:
[]
string
{
gameI
D
},
}))
}))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
...
@@ -149,7 +149,7 @@ func TestGame(t *testing.T) {
...
@@ -149,7 +149,7 @@ func TestGame(t *testing.T) {
t
.
Log
(
msg
)
t
.
Log
(
msg
)
msg
,
err
=
exec
.
Query
(
pty
.
FuncNameQueryGameByID
,
types
.
Encode
(
&
pty
.
QueryGameInfo
{
msg
,
err
=
exec
.
Query
(
pty
.
FuncNameQueryGameByID
,
types
.
Encode
(
&
pty
.
QueryGameInfo
{
GameId
:
gameI
d
}))
GameId
:
gameI
D
}))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
}
}
...
@@ -162,7 +162,7 @@ func TestGame(t *testing.T) {
...
@@ -162,7 +162,7 @@ func TestGame(t *testing.T) {
}
}
//close game
//close game
closeParam
:=
&
pty
.
GamePreCloseTx
{
GameID
:
gameI
d
,
Secret
:
"harrylee"
,
Result
:
Rock
,
Fee
:
100000
}
closeParam
:=
&
pty
.
GamePreCloseTx
{
GameID
:
gameI
D
,
Secret
:
"harrylee"
,
Result
:
Rock
,
Fee
:
100000
}
closeTx
,
err
:=
pty
.
CreateRawGamePreCloseTx
(
closeParam
)
closeTx
,
err
:=
pty
.
CreateRawGamePreCloseTx
(
closeParam
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
...
@@ -193,7 +193,7 @@ func TestGame(t *testing.T) {
...
@@ -193,7 +193,7 @@ func TestGame(t *testing.T) {
t
.
Log
(
acB
)
t
.
Log
(
acB
)
msg
,
err
=
exec
.
Query
(
pty
.
FuncNameQueryGameByID
,
types
.
Encode
(
&
pty
.
QueryGameInfo
{
msg
,
err
=
exec
.
Query
(
pty
.
FuncNameQueryGameByID
,
types
.
Encode
(
&
pty
.
QueryGameInfo
{
GameId
:
gameI
d
}))
GameId
:
gameI
D
}))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
}
}
...
@@ -233,10 +233,10 @@ func TestGame(t *testing.T) {
...
@@ -233,10 +233,10 @@ func TestGame(t *testing.T) {
kvdb
.
Set
(
kv
.
Key
,
kv
.
Value
)
kvdb
.
Set
(
kv
.
Key
,
kv
.
Value
)
}
}
gameI
d
=
common
.
ToHex
(
createTx
.
Hash
())
gameI
D
=
common
.
ToHex
(
createTx
.
Hash
())
//cancle game
//cancle game
cancleParam
:=
&
pty
.
GamePreCancelTx
{
Fee
:
1e5
,
GameID
:
gameI
d
}
cancleParam
:=
&
pty
.
GamePreCancelTx
{
Fee
:
1e5
,
GameID
:
gameI
D
}
cancelTx
,
err
:=
pty
.
CreateRawGamePreCancelTx
(
cancleParam
)
cancelTx
,
err
:=
pty
.
CreateRawGamePreCancelTx
(
cancleParam
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
...
@@ -264,7 +264,7 @@ func TestGame(t *testing.T) {
...
@@ -264,7 +264,7 @@ func TestGame(t *testing.T) {
kvdb
.
Set
(
kv
.
Key
,
kv
.
Value
)
kvdb
.
Set
(
kv
.
Key
,
kv
.
Value
)
}
}
msg
,
err
=
exec
.
Query
(
pty
.
FuncNameQueryGameByID
,
types
.
Encode
(
&
pty
.
QueryGameInfo
{
msg
,
err
=
exec
.
Query
(
pty
.
FuncNameQueryGameByID
,
types
.
Encode
(
&
pty
.
QueryGameInfo
{
GameId
:
gameI
d
}))
GameId
:
gameI
D
}))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
}
}
...
@@ -303,10 +303,10 @@ func TestGame(t *testing.T) {
...
@@ -303,10 +303,10 @@ func TestGame(t *testing.T) {
kvdb
.
Set
(
kv
.
Key
,
kv
.
Value
)
kvdb
.
Set
(
kv
.
Key
,
kv
.
Value
)
}
}
gameI
d
=
common
.
ToHex
(
createTx
.
Hash
())
gameI
D
=
common
.
ToHex
(
createTx
.
Hash
())
//match game
//match game
matchParam
=
&
pty
.
GamePreMatchTx
{
GameID
:
gameI
d
,
Guess
:
Rock
,
Fee
:
100000
}
matchParam
=
&
pty
.
GamePreMatchTx
{
GameID
:
gameI
D
,
Guess
:
Rock
,
Fee
:
100000
}
matchTx
,
err
=
pty
.
CreateRawGamePreMatchTx
(
matchParam
)
matchTx
,
err
=
pty
.
CreateRawGamePreMatchTx
(
matchParam
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
...
@@ -333,7 +333,7 @@ func TestGame(t *testing.T) {
...
@@ -333,7 +333,7 @@ func TestGame(t *testing.T) {
}
}
//close game
//close game
closeParam
=
&
pty
.
GamePreCloseTx
{
GameID
:
gameI
d
,
Secret
:
"123456"
,
Result
:
Rock
,
Fee
:
100000
}
closeParam
=
&
pty
.
GamePreCloseTx
{
GameID
:
gameI
D
,
Secret
:
"123456"
,
Result
:
Rock
,
Fee
:
100000
}
closeTx
,
err
=
pty
.
CreateRawGamePreCloseTx
(
closeParam
)
closeTx
,
err
=
pty
.
CreateRawGamePreCloseTx
(
closeParam
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
...
@@ -360,7 +360,7 @@ func TestGame(t *testing.T) {
...
@@ -360,7 +360,7 @@ func TestGame(t *testing.T) {
}
}
msg
,
err
=
exec
.
Query
(
pty
.
FuncNameQueryGameByID
,
types
.
Encode
(
&
pty
.
QueryGameInfo
{
msg
,
err
=
exec
.
Query
(
pty
.
FuncNameQueryGameByID
,
types
.
Encode
(
&
pty
.
QueryGameInfo
{
GameId
:
gameI
d
}))
GameId
:
gameI
D
}))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
}
}
...
@@ -399,10 +399,10 @@ func TestGame(t *testing.T) {
...
@@ -399,10 +399,10 @@ func TestGame(t *testing.T) {
kvdb
.
Set
(
kv
.
Key
,
kv
.
Value
)
kvdb
.
Set
(
kv
.
Key
,
kv
.
Value
)
}
}
gameI
d
=
common
.
ToHex
(
createTx
.
Hash
())
gameI
D
=
common
.
ToHex
(
createTx
.
Hash
())
//match game
//match game
matchParam
=
&
pty
.
GamePreMatchTx
{
GameID
:
gameI
d
,
Guess
:
Paper
,
Fee
:
100000
}
matchParam
=
&
pty
.
GamePreMatchTx
{
GameID
:
gameI
D
,
Guess
:
Paper
,
Fee
:
100000
}
matchTx
,
err
=
pty
.
CreateRawGamePreMatchTx
(
matchParam
)
matchTx
,
err
=
pty
.
CreateRawGamePreMatchTx
(
matchParam
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
...
@@ -428,7 +428,7 @@ func TestGame(t *testing.T) {
...
@@ -428,7 +428,7 @@ func TestGame(t *testing.T) {
kvdb
.
Set
(
kv
.
Key
,
kv
.
Value
)
kvdb
.
Set
(
kv
.
Key
,
kv
.
Value
)
}
}
//close game
//close game
closeParam
=
&
pty
.
GamePreCloseTx
{
GameID
:
gameI
d
,
Secret
:
"123456"
,
Result
:
Rock
,
Fee
:
100000
}
closeParam
=
&
pty
.
GamePreCloseTx
{
GameID
:
gameI
D
,
Secret
:
"123456"
,
Result
:
Rock
,
Fee
:
100000
}
closeTx
,
err
=
pty
.
CreateRawGamePreCloseTx
(
closeParam
)
closeTx
,
err
=
pty
.
CreateRawGamePreCloseTx
(
closeParam
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
...
@@ -454,7 +454,7 @@ func TestGame(t *testing.T) {
...
@@ -454,7 +454,7 @@ func TestGame(t *testing.T) {
kvdb
.
Set
(
kv
.
Key
,
kv
.
Value
)
kvdb
.
Set
(
kv
.
Key
,
kv
.
Value
)
}
}
msg
,
err
=
exec
.
Query
(
pty
.
FuncNameQueryGameByID
,
types
.
Encode
(
&
pty
.
QueryGameInfo
{
msg
,
err
=
exec
.
Query
(
pty
.
FuncNameQueryGameByID
,
types
.
Encode
(
&
pty
.
QueryGameInfo
{
GameId
:
gameI
d
}))
GameId
:
gameI
D
}))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
}
}
...
...
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