Commit 5e5226b9 authored by liuyuhang's avatar liuyuhang Committed by 33cn

add ruleaction test

parent 34bc84b3
......@@ -399,6 +399,9 @@ func getReceiptLog(pre, cur *auty.AutonomyProposalBoard, ty int32) *types.Receip
}
func copyAutonomyProposalBoard(cur *auty.AutonomyProposalBoard) *auty.AutonomyProposalBoard {
if cur == nil {
return nil
}
newAut := *cur
newBoard := *cur.GetPropBoard()
newRes := *cur.GetVoteResult()
......
......@@ -457,6 +457,7 @@ func TestGetReceiptLog(t *testing.T) {
}
func TestCopyAutonomyProposalBoard(t *testing.T) {
require.Nil(t, copyAutonomyProposalBoard(nil))
cur := &auty.AutonomyProposalBoard{
PropBoard: &auty.ProposalBoard{Year: 1900, Month: 1},
VoteResult: &auty.VoteResult{TotalVotes: 100},
......
......@@ -461,6 +461,9 @@ func getProjectReceiptLog(pre, cur *auty.AutonomyProposalProject, ty int32) *typ
}
func copyAutonomyProposalProject(cur *auty.AutonomyProposalProject) *auty.AutonomyProposalProject {
if cur == nil {
return nil
}
newAut := *cur
newProject := *cur.GetPropProject()
newRes := *cur.GetBoardVoteRes()
......
......@@ -324,12 +324,21 @@ func getRuleReceiptLog(pre, cur *auty.AutonomyProposalRule, ty int32) *types.Rec
}
func copyAutonomyProposalRule(cur *auty.AutonomyProposalRule) *auty.AutonomyProposalRule {
if cur == nil {
return nil
}
newAut := *cur
newRule := *cur.GetPropRule()
newCfg := *cur.GetPropRule().GetRuleCfg()
newPropRule := *cur.GetPropRule()
var newCfg *auty.RuleConfig
if newPropRule.RuleCfg != nil {
cfg := *cur.GetPropRule().GetRuleCfg()
newCfg = &cfg
}
newRule := *cur.GetRule()
newRes := *cur.GetVoteResult()
newAut.PropRule = &newRule
newAut.PropRule.RuleCfg = &newCfg
newAut.PropRule = &newPropRule
newAut.PropRule.RuleCfg = newCfg
newAut.Rule = &newRule
newAut.VoteResult = &newRes
return &newAut
}
......
This diff is collapsed.
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