diff options
author | Mission Liao <mission.liao@dexon.org> | 2018-08-15 14:04:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-15 14:04:35 +0800 |
commit | 3a9b545b0f33435c277fcede2251e4b5ae800d40 (patch) | |
tree | 7848c5f02a3e2e145a038ec206e95d6230ab5d45 /core/reliable-broadcast_test.go | |
parent | c4bfb69724f5fb777fbf5fc272dc65a0f9d1f368 (diff) | |
download | dexon-consensus-3a9b545b0f33435c277fcede2251e4b5ae800d40.tar dexon-consensus-3a9b545b0f33435c277fcede2251e4b5ae800d40.tar.gz dexon-consensus-3a9b545b0f33435c277fcede2251e4b5ae800d40.tar.bz2 dexon-consensus-3a9b545b0f33435c277fcede2251e4b5ae800d40.tar.lz dexon-consensus-3a9b545b0f33435c277fcede2251e4b5ae800d40.tar.xz dexon-consensus-3a9b545b0f33435c277fcede2251e4b5ae800d40.tar.zst dexon-consensus-3a9b545b0f33435c277fcede2251e4b5ae800d40.zip |
test: refine test utility (#61)
* Add functionality to test.App
* Add test utility to generate slices of types.ValidatorID
Diffstat (limited to 'core/reliable-broadcast_test.go')
-rw-r--r-- | core/reliable-broadcast_test.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/core/reliable-broadcast_test.go b/core/reliable-broadcast_test.go index 81e640f..c1d0097 100644 --- a/core/reliable-broadcast_test.go +++ b/core/reliable-broadcast_test.go @@ -449,15 +449,13 @@ func (s *ReliableBroadcastTest) TestExtractBlocks() { func (s *ReliableBroadcastTest) TestRandomIntensiveAcking() { rb := newReliableBroadcast() - vids := []types.ValidatorID{} + vids := test.GenerateRandomValidatorIDs(4) heights := map[types.ValidatorID]uint64{} extractedBlocks := []*types.Block{} // Generate validators. - for i := 0; i < 4; i++ { - vid := types.ValidatorID{Hash: common.NewRandomHash()} + for _, vid := range vids { rb.addValidator(vid) - vids = append(vids, vid) } // Generate genesis blocks. for _, vid := range vids { @@ -574,12 +572,10 @@ func (s *ReliableBroadcastTest) TestPrepareBlock() { req = s.Require() rb = newReliableBroadcast() minInterval = 50 * time.Millisecond - validators []types.ValidatorID + validators = test.GenerateRandomValidatorIDs(4) ) // Prepare validator IDs. - for i := 0; i < 4; i++ { - vID := types.ValidatorID{Hash: common.NewRandomHash()} - validators = append(validators, vID) + for _, vID := range validators { rb.addValidator(vID) } // Setup genesis blocks. |