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/test/utils.go | |
parent | c4bfb69724f5fb777fbf5fc272dc65a0f9d1f368 (diff) | |
download | dexon-consensus-3a9b545b0f33435c277fcede2251e4b5ae800d40.tar.gz 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/test/utils.go')
-rw-r--r-- | core/test/utils.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/test/utils.go b/core/test/utils.go index eae12a0..35fbdd5 100644 --- a/core/test/utils.go +++ b/core/test/utils.go @@ -29,3 +29,12 @@ func stableRandomHash(blockConv types.BlockConverter) (common.Hash, error) { } return common.NewRandomHash(), nil } + +// GenerateRandomValidatorIDs generates randomly a slices of types.ValidatorID. +func GenerateRandomValidatorIDs(validatorCount int) (vIDs types.ValidatorIDs) { + vIDs = types.ValidatorIDs{} + for i := 0; i < validatorCount; i++ { + vIDs = append(vIDs, types.ValidatorID{Hash: common.NewRandomHash()}) + } + return +} |