@@ -10,10 +10,10 @@ func TestRewardCalculation_1_1(t *testing.T) {
10
10
state := NewRewardState()
11
11
12
12
current := 100
13
- state.AddStake (10, testutils.TestAddress("alice"), 100, uint64(current), make(map[string]uint64))
13
+ state.addStake (10, testutils.TestAddress("alice"), 100, uint64(current), make(map[string]uint64))
14
14
15
15
current += 100
16
- reward, _ := state.RemoveStake (testutils.TestAddress("alice"), 100, uint64(current), make(map[string]uint64))
16
+ reward, _ := state.removeStake (testutils.TestAddress("alice"), 100, uint64(current), make(map[string]uint64))
17
17
18
18
if reward != 100+100 {
19
19
t.Errorf("expected reward %d, got %d", 100+100, reward)
@@ -24,21 +24,21 @@ func TestRewardCalculation_1_2(t *testing.T) {
24
24
state := NewRewardState()
25
25
26
26
current := 100
27
- state.AddStake (10, testutils.TestAddress("alice"), 100, uint64(current), make(map[string]uint64))
27
+ state.addStake (10, testutils.TestAddress("alice"), 100, uint64(current), make(map[string]uint64))
28
28
29
29
current += 100
30
- reward, _ := state.RemoveStake (testutils.TestAddress("alice"), 100, uint64(current), make(map[string]uint64))
30
+ reward, _ := state.removeStake (testutils.TestAddress("alice"), 100, uint64(current), make(map[string]uint64))
31
31
current -= int(reward)
32
32
33
33
if reward != 100+100 {
34
34
t.Errorf("expected reward %d, got %d", 100+100, reward)
35
35
}
36
36
37
37
current += 100
38
- state.AddStake (12, testutils.TestAddress("bob"), 100, uint64(current), make(map[string]uint64))
38
+ state.addStake (12, testutils.TestAddress("bob"), 100, uint64(current), make(map[string]uint64))
39
39
40
40
current += 100
41
- reward, _ = state.RemoveStake (testutils.TestAddress("bob"), 100, uint64(current), make(map[string]uint64))
41
+ reward, _ = state.removeStake (testutils.TestAddress("bob"), 100, uint64(current), make(map[string]uint64))
42
42
current -= int(reward)
43
43
if reward != 100+100 {
44
44
t.Errorf("expected reward %d, got %d", 100+100, reward)
@@ -50,56 +50,55 @@ func TestRewardCalculation_1_3(t *testing.T) {
50
50
51
51
// Alice takes 100 GNS
52
52
current := 100
53
- state.AddStake (10, testutils.TestAddress("alice"), 10, uint64(current), make(map[string]uint64))
53
+ state.addStake (10, testutils.TestAddress("alice"), 10, uint64(current), make(map[string]uint64))
54
54
55
55
// Alice takes 100 GNS
56
56
current += 100
57
- state.AddStake (11, testutils.TestAddress("bob"), 10, uint64(current), make(map[string]uint64))
57
+ state.addStake (11, testutils.TestAddress("bob"), 10, uint64(current), make(map[string]uint64))
58
58
59
59
// Alice takes 50 GNS, Bob takes 50 GNS
60
60
current += 100
61
- reward, _ := state.RemoveStake (testutils.TestAddress("alice"), 10, uint64(current), make(map[string]uint64))
61
+ reward, _ := state.removeStake (testutils.TestAddress("alice"), 10, uint64(current), make(map[string]uint64))
62
62
current -= int(reward)
63
63
if reward != 100+100+50 {
64
64
t.Errorf("expected reward %d, got %d", 100+100+50, reward)
65
65
}
66
66
67
67
// Bob takes 100 GNS
68
68
current += 100
69
- reward, _ = state.RemoveStake (testutils.TestAddress("bob"), 10, uint64(current), make(map[string]uint64))
69
+ reward, _ = state.removeStake (testutils.TestAddress("bob"), 10, uint64(current), make(map[string]uint64))
70
70
current -= int(reward)
71
71
if reward != 100+50 {
72
72
t.Errorf("expected reward %d, got %d", 100+50, reward)
73
73
}
74
74
}
75
75
76
-
77
76
func TestRewardCalculation_1_4(t *testing.T) {
78
77
state := NewRewardState()
79
78
80
79
// Alice takes 100 GNS
81
80
current := 100
82
- state.AddStake (10, testutils.TestAddress("alice"), 10, uint64(current), make(map[string]uint64))
81
+ state.addStake (10, testutils.TestAddress("alice"), 10, uint64(current), make(map[string]uint64))
83
82
84
83
// Alice takes 200GNS
85
84
current += 200
86
- state.AddStake (11, testutils.TestAddress("bob"), 30, uint64(current), make(map[string]uint64))
85
+ state.addStake (11, testutils.TestAddress("bob"), 30, uint64(current), make(map[string]uint64))
87
86
88
87
// Alice 25, Bob 75
89
88
current += 100
90
- state.AddStake (12, testutils.TestAddress("charlie"), 10, uint64(current), make(map[string]uint64))
89
+ state.addStake (12, testutils.TestAddress("charlie"), 10, uint64(current), make(map[string]uint64))
91
90
92
91
// Alice 20, Bob 60, Charlie 20
93
92
current += 100
94
- reward, _ := state.RemoveStake (testutils.TestAddress("alice"), 10, uint64(current), make(map[string]uint64))
93
+ reward, _ := state.removeStake (testutils.TestAddress("alice"), 10, uint64(current), make(map[string]uint64))
95
94
current -= int(reward)
96
95
if reward != 100+200+25+20 {
97
96
t.Errorf("expected reward %d, got %d", 100+200+25+20, reward)
98
97
}
99
98
100
99
// Bob 75, Charlie 25
101
100
current += 100
102
- reward, _ = state.RemoveStake (testutils.TestAddress("bob"), 30, uint64(current), make(map[string]uint64))
101
+ reward, _ = state.removeStake (testutils.TestAddress("bob"), 30, uint64(current), make(map[string]uint64))
103
102
current -= int(reward)
104
103
if reward != 75+60+75 {
105
104
t.Errorf("expected reward %d, got %d", 75+60+75, reward)
0 commit comments