mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-05-23 07:16:47 +00:00
29 lines
750 B
Go
29 lines
750 B
Go
package testutils
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/kaspanet/kaspad/domain/dagconfig"
|
|
)
|
|
|
|
// ForAllNets runs the passed testFunc with all available networks
|
|
// if setDifficultyToMinumum = true - will modify the net params to have minimal difficulty, like in SimNet
|
|
func ForAllNets(t *testing.T, skipPow bool, testFunc func(*testing.T, *dagconfig.Params)) {
|
|
allParams := []dagconfig.Params{
|
|
dagconfig.MainnetParams,
|
|
dagconfig.TestnetParams,
|
|
dagconfig.SimnetParams,
|
|
dagconfig.DevnetParams,
|
|
}
|
|
|
|
for _, params := range allParams {
|
|
paramsCopy := params
|
|
t.Run(paramsCopy.Name, func(t *testing.T) {
|
|
t.Parallel()
|
|
paramsCopy.SkipProofOfWork = skipPow
|
|
t.Logf("Running test for %s", paramsCopy.Name)
|
|
testFunc(t, ¶msCopy)
|
|
})
|
|
}
|
|
}
|