Commit 3f2ad493 authored by QM's avatar QM Committed by vipwzw

add autonomy unit test

parent 999ab02c
...@@ -268,6 +268,13 @@ func TestPropBoard(t *testing.T) { ...@@ -268,6 +268,13 @@ func TestPropBoard(t *testing.T) {
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10, EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
}, },
{ // ErrSetBlockHeight
BoardUpdate: auty.BoardUpdate_REPLACEALL,
Boards: boards,
StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + propEndBlockPeriod + 10,
},
} }
result := []error{ result := []error{
auty.ErrRepeatAddr, auty.ErrRepeatAddr,
...@@ -284,8 +291,9 @@ func TestPropBoard(t *testing.T) { ...@@ -284,8 +291,9 @@ func TestPropBoard(t *testing.T) {
auty.ErrBoardNumber, auty.ErrBoardNumber,
auty.ErrRepeatAddr, auty.ErrRepeatAddr,
nil, nil,
auty.ErrSetBlockHeight,
} }
lenBoards := []int{0, 0, 0, 22, 0, 0, 21, 0, 0, 0, 0, 20} lenBoards := []int{0, 0, 0, 22, 0, 0, 21, 0, 0, 0, 0, 20, 0}
InitBoard(stateDB) InitBoard(stateDB)
exec.SetStateDB(stateDB) exec.SetStateDB(stateDB)
......
...@@ -89,6 +89,12 @@ func TestPropProject(t *testing.T) { ...@@ -89,6 +89,12 @@ func TestPropProject(t *testing.T) {
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10, EndBlockHeight: env.blockHeight + startEndBlockPeriod + 10,
}, },
{ // ErrSetBlockHeight
Amount: 100,
ToAddr: AddrA,
StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + propEndBlockPeriod + 10,
},
} }
result := []error{ result := []error{
...@@ -97,6 +103,7 @@ func TestPropProject(t *testing.T) { ...@@ -97,6 +103,7 @@ func TestPropProject(t *testing.T) {
auty.ErrSetBlockHeight, auty.ErrSetBlockHeight,
types.ErrNotFound, types.ErrNotFound,
auty.ErrNoPeriodAmount, auty.ErrNoPeriodAmount,
auty.ErrSetBlockHeight,
} }
exec.SetStateDB(stateDB) exec.SetStateDB(stateDB)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment