feat: data-driven.

This commit is contained in:
徐聪
2021-12-29 15:02:12 +08:00
parent 97e2865022
commit 83923affa8
4 changed files with 37 additions and 31 deletions

View File

@@ -3,6 +3,7 @@ package builtin
import (
"crypto/md5"
"encoding/hex"
"github.com/httprunner/hrp"
"math"
"math/rand"
"time"
@@ -14,7 +15,8 @@ var Functions = map[string]interface{}{
"gen_random_string": genRandomString, // call with one argument
"max": math.Max, // call with two arguments
"md5": MD5,
"getAppVersion": getAppVersion, // test
"parameterize": hrp.LoadFromCSV,
"P": hrp.LoadFromCSV,
}
func init() {
@@ -45,7 +47,3 @@ func MD5(str string) string {
hasher.Write([]byte(str))
return hex.EncodeToString(hasher.Sum(nil))
}
func getAppVersion() []float64 {
return []float64{3.1, 3.3}
}