aboutsummaryrefslogtreecommitdiffstats
path: root/core/test/utils.go
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-08-15 14:04:35 +0800
committerGitHub <noreply@github.com>2018-08-15 14:04:35 +0800
commit3a9b545b0f33435c277fcede2251e4b5ae800d40 (patch)
tree7848c5f02a3e2e145a038ec206e95d6230ab5d45 /core/test/utils.go
parentc4bfb69724f5fb777fbf5fc272dc65a0f9d1f368 (diff)
downloaddexon-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/test/utils.go')
-rw-r--r--core/test/utils.go9
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
+}