OSDN Git Service

Hulk did something
[bytom/vapor.git] / consensus / general_test.go
1 package consensus
2
3 import "testing"
4
5 func TestSubsidy(t *testing.T) {
6         cases := []struct {
7                 subsidy uint64
8                 height  uint64
9         }{
10                 {
11                         subsidy: baseSubsidy,
12                         height:  1,
13                 },
14                 {
15                         subsidy: baseSubsidy,
16                         height:  subsidyReductionInterval - 1,
17                 },
18                 {
19                         subsidy: baseSubsidy / 2,
20                         height:  subsidyReductionInterval,
21                 },
22                 {
23                         subsidy: baseSubsidy / 2,
24                         height:  subsidyReductionInterval + 1,
25                 },
26                 {
27                         subsidy: baseSubsidy / 1024,
28                         height:  subsidyReductionInterval * 10,
29                 },
30         }
31
32         for _, c := range cases {
33                 subsidy := BlockSubsidy(c.height)
34                 if subsidy != c.subsidy {
35                         t.Errorf("got subsidy %d, want %d", subsidy, c.subsidy)
36                 }
37         }
38 }