@@ -35,27 +35,29 @@ func TestProposalSuite(t *testing.T) {
35
35
func (suite * ProposalSuite ) TestNewChangeDistributionTypeProposal () {
36
36
testCases := []struct {
37
37
title string
38
+ curTime string
38
39
curHeight int64
39
40
upgradeHeight int64
40
41
quo int64
41
42
}{
42
- {"default" , 100 , 0 , 2 },
43
- {"set upgrade height, not reached height" , 100 , 100 , 2 },
44
- {"set upgrade height, reached height" , 101 , 100 , 1 },
43
+ {"default" , "2023-05-01 00:00:00" , 100 , 0 , 2 },
44
+ {"set upgrade height, not reached height" , "2023-05-01 00:00:00" , 100 , 100 , 2 },
45
+ {"set upgrade height, reached height" , "2023-05-01 00:00:00" , 101 , 100 , 1 },
45
46
}
46
- formatTime , _ := gotime .Parse ("2006-01-02 15:04:05" , "2023-06-01 00:00:00" )
47
- require .Equal (suite .T (), formatTime .Unix (), fixedTimeStamp )
48
47
49
48
for _ , tc := range testCases {
50
49
suite .Run (tc .title , func () {
50
+ tokens := sdk .NewDec (1 )
51
+ curTime , _ := gotime .Parse ("2006-01-02 15:04:05" , tc .curTime )
52
+ curDecBefore , err := calculateWeight (curTime .Unix (), tokens , tc .curHeight )
51
53
global .SetGlobalHeight (tc .curHeight )
52
54
tmtypes .InitMilestoneVenus6Height (tc .upgradeHeight )
53
- tokens := sdk . NewDec ( 1000 )
54
- nowDec , err := calculateWeight ( time . Now (). Unix (), tokens , tc . curHeight )
55
+ curDec , err := calculateWeight ( curTime . Unix (), tokens , tc . curHeight )
56
+ require . Equal ( suite . T (), true , curDec . GTE ( curDecBefore ) )
55
57
require .NoError (suite .T (), err )
56
- afterDec , err := calculateWeight (time . Now () .AddDate (0 , 0 , 52 * 7 ).Unix (), tokens , tc .curHeight )
58
+ afterDec , err := calculateWeight (curTime .AddDate (0 , 0 , 52 * 7 ).Unix (), tokens , tc .curHeight )
57
59
require .NoError (suite .T (), err )
58
- require .Equal (suite .T (), sdk .NewDec (tc .quo ), afterDec .Quo (nowDec ))
60
+ require .Equal (suite .T (), sdk .NewDec (tc .quo ), afterDec .Quo (curDec ))
59
61
})
60
62
}
61
63
}
0 commit comments