@@ -90,7 +90,7 @@ func (ts *ValidatorSetTestSuite) TestCheckpoint() {
9090 ts .Equal (int (validator .Checkpoint (9 )), 99 )
9191}
9292
93- func (ts * ValidatorSetTestSuite ) TestValidator () {
93+ func (ts * ValidatorSetTestSuite ) TestTrustValidator () {
9494 trusted := Validators ([][]byte {{1 }, {2 }, {3 }, {4 }, {5 }})
9595 ts .True (trusted .Contains ([][]byte {{1 }, {2 }, {3 }, {4 }, {5 }}))
9696 ts .True (trusted .Contains ([][]byte {{1 }, {2 }, {3 }, {4 }, {5 }, {10 }, {11 }, {12 }, {13 }, {14 }}))
@@ -104,5 +104,17 @@ func (ts *ValidatorSetTestSuite) TestValidator() {
104104 ts .False (trusted .Contains ([][]byte {{1 }, {10 }, {11 }, {12 }, {13 }, {14 }}))
105105 ts .False (trusted .Contains ([][]byte {}))
106106 ts .False (trusted .Contains ([][]byte {{10 }, {11 }, {12 }, {13 }, {14 }}))
107+ }
107108
109+ func (ts * ValidatorSetTestSuite ) TestThreshold () {
110+ ts .Equal (1 , Validators (make ([][]byte , 1 )).threshold ())
111+ ts .Equal (1 , Validators (make ([][]byte , 2 )).threshold ())
112+ ts .Equal (2 , Validators (make ([][]byte , 3 )).threshold ())
113+ ts .Equal (2 , Validators (make ([][]byte , 4 )).threshold ())
114+ ts .Equal (2 , Validators (make ([][]byte , 5 )).threshold ())
115+ ts .Equal (3 , Validators (make ([][]byte , 6 )).threshold ())
116+ ts .Equal (3 , Validators (make ([][]byte , 7 )).threshold ())
117+ ts .Equal (3 , Validators (make ([][]byte , 8 )).threshold ())
118+ ts .Equal (4 , Validators (make ([][]byte , 9 )).threshold ())
119+ ts .Equal (8 , Validators (make ([][]byte , 21 )).threshold ())
108120}
0 commit comments