Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
zendata
提交
1154736b
Z
zendata
项目概览
LinuxSuRen
/
zendata
与 Fork 源项目一致
Fork自
易企天创 / zendata
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zendata
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1154736b
编写于
7月 29, 2020
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cloes task#7499
上级
10bf813c
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
280 addition
and
188 deletion
+280
-188
demo/smoke.yaml
demo/smoke.yaml
+2
-3
src/action/generator.go
src/action/generator.go
+60
-0
src/gen/charVal.go
src/gen/charVal.go
+37
-38
src/gen/floatVal.go
src/gen/floatVal.go
+37
-38
src/gen/generator.go
src/gen/generator.go
+0
-6
src/gen/intVal.go
src/gen/intVal.go
+38
-37
src/gen/list.go
src/gen/list.go
+43
-24
src/gen/rand.go
src/gen/rand.go
+62
-41
src/utils/vari/var.go
src/utils/vari/var.go
+1
-1
未找到文件。
demo/smoke.yaml
浏览文件 @
1154736b
...
...
@@ -34,8 +34,6 @@ fields:
postfix
:
"
\t
"
-
field
:
child2
prefix
:
"
["
postfix
:
"
]"
fields
:
-
field
:
child2.1
range
:
a-b
...
...
@@ -44,6 +42,7 @@ fields:
-
field
:
child2.2
range
:
1-9:R
prefix
:
loop
:
3
loopfix
:
"
,"
prefix
:
"
["
postfix
:
"
]"
src/action/generator.go
浏览文件 @
1154736b
...
...
@@ -13,6 +13,7 @@ import (
"github.com/easysoft/zendata/src/utils/vari"
"net/http"
"os"
"regexp"
"strings"
"time"
)
...
...
@@ -64,6 +65,8 @@ func Print(rows [][]string, format string, table string, colIsNumArr []bool, fie
lineForText
:=
""
for
j
,
col
:=
range
cols
{
col
=
replacePlaceholder
(
col
)
lineForText
=
lineForText
+
col
row
=
append
(
row
,
col
)
...
...
@@ -167,6 +170,63 @@ func getXmlLine(i int, rowXml model.XmlRow, length int) string {
return
text
}
func
replacePlaceholder
(
col
string
)
string
{
ret
:=
col
re
:=
regexp
.
MustCompile
(
"(?siU)
\\
${(.*)}"
)
arr
:=
re
.
FindAllStringSubmatch
(
col
,
-
1
)
strForReplaceMap
:=
map
[
string
][]
string
{}
for
_
,
childArr
:=
range
arr
{
placeholderStr
:=
childArr
[
1
]
//if strForReplaceMap[placeholderStr] == nil {
strForReplaceMap
[
placeholderStr
]
=
getValForPlaceholder
(
placeholderStr
,
len
(
childArr
))
//}
for
_
,
str
:=
range
strForReplaceMap
[
placeholderStr
]
{
ret
=
strings
.
Replace
(
ret
,
gen
.
Placeholder
(
placeholderStr
),
str
,
1
)
}
}
return
ret
}
func
getValForPlaceholder
(
placeholderStr
string
,
count
int
)
[]
string
{
mp
:=
vari
.
RandFieldNameToValuesMap
[
placeholderStr
]
tp
:=
mp
[
"type"
]
.
(
string
)
repeatObj
:=
mp
[
"repeat"
]
repeat
:=
"1"
if
repeatObj
!=
nil
{
repeat
=
repeatObj
.
(
string
)
}
strs
:=
make
([]
string
,
0
)
if
tp
==
"int"
{
start
:=
mp
[
"start"
]
.
(
string
)
end
:=
mp
[
"end"
]
.
(
string
)
precision
:=
mp
[
"precision"
]
.
(
string
)
strs
=
gen
.
GetRandFromRange
(
"int"
,
start
,
end
,
"1"
,
repeat
,
precision
,
count
)
}
else
if
tp
==
"float"
{
start
:=
mp
[
"start"
]
.
(
string
)
end
:=
mp
[
"end"
]
.
(
string
)
precision
:=
mp
[
"precision"
]
.
(
string
)
strs
=
gen
.
GetRandFromRange
(
"float"
,
start
,
end
,
"1"
,
repeat
,
precision
,
count
)
}
else
if
tp
==
"char"
{
start
:=
mp
[
"start"
]
.
(
string
)
end
:=
mp
[
"end"
]
.
(
string
)
precision
:=
mp
[
"precision"
]
.
(
string
)
strs
=
gen
.
GetRandFromRange
(
"char"
,
start
,
end
,
"1"
,
repeat
,
precision
,
count
)
}
else
if
tp
==
"list"
{
list
:=
mp
[
"list"
]
.
([]
interface
{})
strs
=
gen
.
GetRandFromList
(
list
,
repeat
,
count
)
}
return
strs
}
func
printLine
(
line
string
)
{
if
FileWriter
!=
nil
{
PrintToFile
(
line
)
...
...
src/gen/charVal.go
浏览文件 @
1154736b
package
gen
import
(
commonUtils
"github.com/easysoft/zendata/src/utils/common"
constant
"github.com/easysoft/zendata/src/utils/const"
)
func
GenerateByteItems
(
start
byte
,
end
byte
,
step
interface
{},
rand
bool
,
repeat
int
)
[]
interface
{}
{
if
!
rand
{
return
GenerateByteItemsByStep
(
start
,
end
,
step
.
(
int
),
repeat
)
}
else
{
return
GenerateByteItemsRand
(
start
,
end
,
step
.
(
int
),
repeat
)
}
}
//
func GenerateByteItems(start byte, end byte, step interface{}, rand bool, repeat int) []interface{} {
//
if !rand {
//
return GenerateByteItemsByStep(start, end, step.(int), repeat)
//
} else {
//
return GenerateByteItemsRand(start, end, step.(int), repeat)
//
}
//
}
func
GenerateByteItemsByStep
(
start
byte
,
end
byte
,
step
int
,
repeat
int
)
[]
interface
{}
{
arr
:=
make
([]
interface
{},
0
)
...
...
@@ -40,33 +39,33 @@ func GenerateByteItemsByStep(start byte, end byte, step int, repeat int) []inter
return
arr
}
func
GenerateByteItemsRand
(
start
byte
,
end
byte
,
step
int
,
repeat
int
)
[]
interface
{}
{
arr
:=
make
([]
interface
{},
0
)
countInRound
:=
int
(
int
(
end
)
-
int
(
start
))
/
step
total
:=
0
for
i
:=
0
;
i
<
countInRound
;
{
rand
:=
commonUtils
.
RandNum
(
countInRound
)
if
step
<
0
{
rand
=
rand
*
-
1
}
val
:=
start
+
byte
(
rand
)
for
round
:=
0
;
round
<
repeat
;
round
++
{
arr
=
append
(
arr
,
val
)
total
++
if
total
>
constant
.
MaxNumb
{
break
}
}
if
total
>
constant
.
MaxNumb
{
break
}
i
++
}
return
arr
}
\ No newline at end of file
//func GenerateByteItemsRand(start byte, end byte, step int, repeat int) []interface{} {
// arr := make([]interface{}, 0)
//
// countInRound := int(int(end) - int(start)) / step
// total := 0
// for i := 0; i < countInRound; {
// rand := commonUtils.RandNum(countInRound)
// if step < 0 {
// rand = rand * -1
// }
//
// val := start + byte(rand)
//
// for round := 0; round < repeat; round++ {
// arr = append(arr, val)
//
// total++
// if total > constant.MaxNumb {
// break
// }
// }
//
// if total > constant.MaxNumb {
// break
// }
// i++
// }
//
// return arr
//}
\ No newline at end of file
src/gen/floatVal.go
浏览文件 @
1154736b
package
gen
import
(
commonUtils
"github.com/easysoft/zendata/src/utils/common"
constant
"github.com/easysoft/zendata/src/utils/const"
"strconv"
"strings"
)
func
GenerateFloatItems
(
start
float64
,
end
float64
,
step
interface
{},
rand
bool
,
repeat
int
)
[]
interface
{}
{
if
!
rand
{
return
GenerateFloatItemsByStep
(
start
,
end
,
step
.
(
float64
),
repeat
)
}
else
{
return
GenerateFloatItemsRand
(
start
,
end
,
step
.
(
float64
),
repeat
)
}
}
//
func GenerateFloatItems(start float64, end float64, step interface{}, rand bool, repeat int) []interface{} {
//
if !rand{
//
return GenerateFloatItemsByStep(start, end, step.(float64), repeat)
//
} else {
//
return GenerateFloatItemsRand(start, end, step.(float64), repeat)
//
}
//
}
func
GenerateFloatItemsByStep
(
start
float64
,
end
float64
,
step
interface
{},
repeat
int
)
[]
interface
{}
{
arr
:=
make
([]
interface
{},
0
)
...
...
@@ -43,36 +42,36 @@ func GenerateFloatItemsByStep(start float64, end float64, step interface{}, repe
return
arr
}
func
GenerateFloatItemsRand
(
start
float64
,
end
float64
,
step
float64
,
repeat
int
)
[]
interface
{}
{
arr
:=
make
([]
interface
{},
0
)
countInRound
:=
(
end
-
start
)
/
step
total
:=
0
for
i
:=
float64
(
0
);
i
<
countInRound
;
{
rand
:=
commonUtils
.
RandNum64
(
int64
(
countInRound
))
if
step
<
0
{
rand
=
rand
*
-
1
}
val
:=
start
+
float64
(
rand
)
*
step
for
round
:=
0
;
round
<
repeat
;
round
++
{
arr
=
append
(
arr
,
val
)
total
++
if
total
>
constant
.
MaxNumb
{
break
}
}
if
total
>
constant
.
MaxNumb
{
break
}
i
++
}
return
arr
}
//
func GenerateFloatItemsRand(start float64, end float64, step float64, repeat int) []interface{} {
//
arr := make([]interface{}, 0)
//
//
countInRound := (end - start) / step
//
total := 0
//
for i := float64(0); i < countInRound; {
//
rand := commonUtils.RandNum64(int64(countInRound))
//
if step < 0 {
//
rand = rand * -1
//
}
//
//
val := start + float64(rand) * step
//
//
for round := 0; round < repeat; round++ {
//
arr = append(arr, val)
//
//
total++
//
if total > constant.MaxNumb {
//
break
//
}
//
}
//
//
if total > constant.MaxNumb {
//
break
//
}
//
i++
//
}
//
//
return arr
//
}
func
getPrecision
(
base
float64
,
step
interface
{})
int
{
val
:=
base
+
step
.
(
float64
)
...
...
src/gen/generator.go
浏览文件 @
1154736b
...
...
@@ -73,10 +73,6 @@ func GenerateForField(field *model.DefField, total int, withFix bool) (values []
}
else
if
field
.
From
!=
""
{
// refer to res
if
field
.
Use
!=
""
{
// refer to instance
if
field
.
Use
==
"privateIP"
{
fmt
.
Println
(
""
)
}
groupValues
:=
vari
.
Res
[
field
.
From
]
groups
:=
strings
.
Split
(
field
.
Use
,
","
)
for
_
,
group
:=
range
groups
{
...
...
@@ -109,8 +105,6 @@ func GenerateForField(field *model.DefField, total int, withFix bool) (values []
func
GenerateFieldItemsFromDefinition
(
field
*
model
.
DefField
)
[]
string
{
values
:=
make
([]
string
,
0
)
//valuesWithPlaceholder := make([]string, 0)
//vari.RandFieldNameToValuesMap[field.Path] = valuesWithPlaceholder
fieldWithValues
:=
GenerateList
(
field
)
...
...
src/gen/intVal.go
浏览文件 @
1154736b
package
gen
import
(
commonUtils
"github.com/easysoft/zendata/src/utils/common"
constant
"github.com/easysoft/zendata/src/utils/const"
)
//
func GenerateIntItems(start int64, end int64, step interface{}, rand bool, limit int) []interface{} {
//
if !rand {
//
return GenerateIntItemsByStep(start, end, step.(int), limit)
//
} else{
//
return GenerateIntItemsRand(start, end, step.(int), limit)
//
}
//
}
func
GenerateIntItems
(
start
int64
,
end
int64
,
step
interface
{},
rand
bool
,
limit
int
)
[]
interface
{}
{
if
!
rand
{
return
GenerateIntItemsByStep
(
start
,
end
,
step
.
(
int
),
limit
)
}
else
{
return
GenerateIntItemsRand
(
start
,
end
,
step
.
(
int
),
limit
)
}
}
func
GenerateIntItemsByStep
(
start
int64
,
end
int64
,
step
int
,
repeat
int
)
[]
interface
{}
{
arr
:=
make
([]
interface
{},
0
)
...
...
@@ -40,33 +41,33 @@ func GenerateIntItemsByStep(start int64, end int64, step int, repeat int) []inte
return
arr
}
//func GenerateIntItemsRand(start int64, end int64, step int, repeat int) []interface{} {
// arr := make([]interface{}, 0)
//
// countInRound := (end - start) / int64(step)
// total := 0
// for i := int64(0); i < countInRound; {
// rand := commonUtils.RandNum64(countInRound)
// if step < 0 {
// rand = rand * -1
// }
//
// val := start + rand
// for round := 0; round < repeat; round++ {
// arr = append(arr, val)
//
// total++
//
// if total > constant.MaxNumb {
// break
// }
// }
//
// if total > constant.MaxNumb {
// break
// }
// i++
// }
//
// return arr
//}
\ No newline at end of file
func
GenerateIntItemsRand
(
start
int64
,
end
int64
,
step
int
,
repeat
int
)
[]
interface
{}
{
arr
:=
make
([]
interface
{},
0
)
countInRound
:=
(
end
-
start
)
/
int64
(
step
)
total
:=
0
for
i
:=
int64
(
0
);
i
<
countInRound
;
{
rand
:=
commonUtils
.
RandNum64
(
countInRound
)
if
step
<
0
{
rand
=
rand
*
-
1
}
val
:=
start
+
rand
for
round
:=
0
;
round
<
repeat
;
round
++
{
arr
=
append
(
arr
,
val
)
total
++
if
total
>
constant
.
MaxNumb
{
break
}
}
if
total
>
constant
.
MaxNumb
{
break
}
i
++
}
return
arr
}
\ No newline at end of file
src/gen/list.go
浏览文件 @
1154736b
...
...
@@ -2,8 +2,8 @@ package gen
import
(
"github.com/easysoft/zendata/src/model"
commonUtils
"github.com/easysoft/zendata/src/utils/common"
constant
"github.com/easysoft/zendata/src/utils/const"
"github.com/easysoft/zendata/src/utils/vari"
"strconv"
"strings"
)
...
...
@@ -140,19 +140,20 @@ func CheckRangeType(startStr string, endStr string, stepStr string) (string, int
}
func
GenerateValuesFromLiteral
(
field
*
model
.
DefField
,
desc
string
,
stepStr
string
,
repeat
int
)
(
items
[]
interface
{})
{
elemArr
:=
strings
.
Split
(
desc
,
","
)
step
,
_
:=
strconv
.
Atoi
(
stepStr
)
total
:=
0
for
i
:=
0
;
i
<
len
(
elemArr
);
{
val
:=
""
if
stepStr
==
"r"
{
items
=
append
(
items
,
Placeholder
(
field
.
Path
))
mp
:=
placeholderMapForRandValues
(
"list"
,
elemArr
,
""
,
""
,
""
,
""
)
if
stepStr
==
"r"
{
val
=
elemArr
[
commonUtils
.
RandNum
(
len
(
elemArr
))]
}
else
{
val
=
elemArr
[
i
]
}
vari
.
RandFieldNameToValuesMap
[
field
.
Path
]
=
mp
return
}
for
i
:=
0
;
i
<
len
(
elemArr
);
{
val
:=
elemArr
[
i
]
for
round
:=
0
;
round
<
repeat
;
round
++
{
items
=
append
(
items
,
val
)
...
...
@@ -180,32 +181,31 @@ func GenerateValuesFromInterval(field *model.DefField, desc string, stepStr stri
dataType
,
step
,
precision
,
rand
:=
CheckRangeType
(
startStr
,
endStr
,
stepStr
)
if
dataType
!=
"string"
&&
rand
{
items
=
append
(
items
,
Placeholder
(
field
.
Path
))
mp
:=
placeholderMapForRandValues
(
dataType
,
[]
string
{},
startStr
,
endStr
,
stepStr
,
""
)
vari
.
RandFieldNameToValuesMap
[
field
.
Path
]
=
mp
return
}
if
dataType
==
"int"
{
startInt
,
_
:=
strconv
.
ParseInt
(
startStr
,
0
,
64
)
endInt
,
_
:=
strconv
.
ParseInt
(
endStr
,
0
,
64
)
if
!
rand
{
items
=
GenerateIntItemsByStep
(
startInt
,
endInt
,
step
.
(
int
),
repeat
)
}
else
{
items
=
append
(
items
,
field
.
Path
)
}
items
=
GenerateIntItemsByStep
(
startInt
,
endInt
,
step
.
(
int
),
repeat
)
}
else
if
dataType
==
"float"
{
startFloat
,
_
:=
strconv
.
ParseFloat
(
startStr
,
64
)
endFloat
,
_
:=
strconv
.
ParseFloat
(
endStr
,
64
)
field
.
Precision
=
precision
if
!
rand
{
items
=
GenerateFloatItemsByStep
(
startFloat
,
endFloat
,
step
.
(
int
),
repeat
)
}
else
{
items
=
append
(
items
,
field
.
Path
)
}
items
=
GenerateFloatItemsByStep
(
startFloat
,
endFloat
,
step
.
(
int
),
repeat
)
}
else
if
dataType
==
"char"
{
if
!
rand
{
items
=
GenerateByteItemsByStep
(
startStr
[
0
],
endStr
[
0
],
step
.
(
int
),
repeat
)
}
else
{
items
=
append
(
items
,
field
.
Path
)
}
items
=
GenerateByteItemsByStep
(
startStr
[
0
],
endStr
[
0
],
step
.
(
int
),
repeat
)
}
else
if
dataType
==
"string"
{
if
repeat
==
0
{
repeat
=
1
}
for
i
:=
0
;
i
<
repeat
;
i
++
{
...
...
@@ -215,3 +215,22 @@ func GenerateValuesFromInterval(field *model.DefField, desc string, stepStr stri
return
}
func
Placeholder
(
str
string
)
string
{
return
"${"
+
str
+
"}"
}
func
placeholderMapForRandValues
(
tp
string
,
list
[]
string
,
start
,
end
,
step
,
precision
string
)
map
[
string
]
interface
{}
{
ret
:=
map
[
string
]
interface
{}{}
ret
[
"type"
]
=
tp
ret
[
"list"
]
=
list
// for literal values
ret
[
"start"
]
=
start
// for interval values
ret
[
"end"
]
=
end
ret
[
"step"
]
=
step
ret
[
"precision"
]
=
precision
return
ret
}
src/gen/rand.go
浏览文件 @
1154736b
...
...
@@ -6,54 +6,73 @@ import (
"strings"
)
func
GetRandFromList
(
list
[]
string
,
repeat
int
)
string
{
rand
:=
commonUtils
.
RandNum
(
len
(
list
))
val
:=
list
[
rand
]
func
GetRandFromList
(
list
[]
interface
{},
repeatStr
string
,
count
int
)
[]
string
{
ret
:=
make
([]
string
,
0
)
items
:=
make
([]
string
,
0
)
for
round
:=
0
;
round
<
repeat
;
round
++
{
items
=
append
(
items
,
val
)
for
i
:=
0
;
i
<
count
;
i
++
{
rand
:=
commonUtils
.
RandNum
(
len
(
list
))
val
:=
list
[
rand
]
repeat
,
_
:=
strconv
.
Atoi
(
repeatStr
)
items
:=
make
([]
string
,
0
)
for
round
:=
0
;
round
<
repeat
;
round
++
{
items
=
append
(
items
,
val
.
(
string
))
}
ret
=
append
(
ret
,
strings
.
Join
(
items
,
""
))
}
return
strings
.
Join
(
items
,
""
)
return
ret
}
func
GetRandFromRange
(
dataType
,
start
,
end
,
step
string
,
repeat
,
precision
int
)
string
{
func
GetRandFromRange
(
dataType
,
start
,
end
,
step
,
repeatStr
,
precisionStr
string
,
count
int
)
[]
string
{
repeat
,
_
:=
strconv
.
Atoi
(
repeatStr
)
precision
,
_
:=
strconv
.
Atoi
(
precisionStr
)
ret
:=
make
([]
string
,
0
)
if
dataType
==
"int"
{
startInt
,
_
:=
strconv
.
ParseInt
(
start
,
0
,
64
)
endInt
,
_
:=
strconv
.
ParseInt
(
end
,
0
,
64
)
stepInt
,
_
:=
strconv
.
ParseInt
(
step
,
0
,
64
)
countInRound
:=
(
startInt
-
endInt
)
/
stepInt
rand
:=
commonUtils
.
RandNum64
(
countInRound
)
if
stepInt
<
0
{
rand
=
rand
*
-
1
}
val
:=
startInt
+
rand
countInRound
:=
(
endInt
-
startInt
)
/
stepInt
items
:=
make
([]
string
,
0
)
for
round
:=
0
;
round
<
repeat
;
round
++
{
items
=
append
(
items
,
string
(
val
))
}
for
i
:=
0
;
i
<
count
;
i
++
{
rand
:=
commonUtils
.
RandNum64
(
countInRound
)
if
stepInt
<
0
{
rand
=
rand
*
-
1
}
val
:=
startInt
+
rand
return
strings
.
Join
(
items
,
""
)
items
:=
make
([]
string
,
0
)
for
round
:=
0
;
round
<
repeat
;
round
++
{
items
=
append
(
items
,
strconv
.
FormatInt
(
val
,
10
))
}
temp
:=
strings
.
Join
(
items
,
""
)
ret
=
append
(
ret
,
temp
)
}
}
else
if
dataType
==
"char"
{
startChar
:=
start
[
0
]
endChar
:=
end
[
0
]
stepInt
,
_
:=
strconv
.
ParseInt
(
step
,
0
,
64
)
stepInt
,
_
:=
strconv
.
ParseInt
(
step
,
1
0
,
64
)
countInRound
:=
int64
(
int64
(
endChar
)
-
int64
(
startChar
))
/
stepInt
rand
:=
commonUtils
.
RandNum64
(
countInRound
)
if
stepInt
<
0
{
rand
=
rand
*
-
1
}
val
:=
startChar
+
byte
(
rand
)
items
:=
make
([]
string
,
0
)
for
round
:=
0
;
round
<
repeat
;
round
++
{
items
=
append
(
items
,
string
(
val
))
for
i
:=
0
;
i
<
count
;
i
++
{
rand
:=
commonUtils
.
RandNum64
(
countInRound
)
if
stepInt
<
0
{
rand
=
rand
*
-
1
}
val
:=
startChar
+
byte
(
rand
)
items
:=
make
([]
string
,
0
)
for
round
:=
0
;
round
<
repeat
;
round
++
{
items
=
append
(
items
,
string
(
val
))
}
temp
:=
strings
.
Join
(
items
,
""
)
ret
=
append
(
ret
,
temp
)
}
return
strings
.
Join
(
items
,
""
)
}
else
if
dataType
==
"float"
{
startFloat
,
_
:=
strconv
.
ParseFloat
(
start
,
64
)
...
...
@@ -62,22 +81,24 @@ func GetRandFromRange(dataType, start, end, step string, repeat, precision int)
countInRound
:=
(
startFloat
-
endFloat
)
/
stepFloat
rand
:=
commonUtils
.
RandNum64
(
int64
(
countInRound
))
if
stepFloat
<
0
{
rand
=
rand
*
-
1
}
val
:=
startFloat
+
float64
(
rand
)
*
stepFloat
for
i
:=
0
;
i
<
count
;
i
++
{
rand
:=
commonUtils
.
RandNum64
(
int64
(
countInRound
))
if
stepFloat
<
0
{
rand
=
rand
*
-
1
}
items
:=
make
([]
string
,
0
)
for
round
:=
0
;
round
<
repeat
;
round
++
{
str
:=
strconv
.
FormatFloat
(
val
,
'f'
,
precision
,
64
)
items
=
append
(
items
,
str
)
val
:=
startFloat
+
float64
(
rand
)
*
stepFloat
return
strings
.
Join
(
items
,
""
)
items
:=
make
([]
string
,
0
)
for
round
:=
0
;
round
<
repeat
;
round
++
{
str
:=
strconv
.
FormatFloat
(
val
,
'f'
,
precision
,
64
)
items
=
append
(
items
,
str
)
}
temp
:=
strings
.
Join
(
items
,
""
)
ret
=
append
(
ret
,
temp
)
}
}
return
"N/A"
return
ret
}
\ No newline at end of file
src/utils/vari/var.go
浏览文件 @
1154736b
...
...
@@ -32,7 +32,7 @@ var (
Def
=
model
.
DefData
{}
Res
=
map
[
string
]
map
[
string
][]
string
{}
RandFieldNameToValuesMap
=
map
[
string
]
[]
string
{}
RandFieldNameToValuesMap
=
map
[
string
]
map
[
string
]
interface
{}
{}
DefaultDir
string
ConfigDir
string
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录