提交 3e9f3bcd 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

close task 7501

上级 738db9bf
...@@ -5,7 +5,7 @@ version: 1.0 ...@@ -5,7 +5,7 @@ version: 1.0
fields: fields:
- field: test - field: test
range: 9-1:2{2} range: 9-1:-2{2}
- field: field_use_instance # 引用default.xml里的嵌套字段 - field: field_use_instance # 引用default.xml里的嵌套字段
prefix: "[" # 复写前缀 prefix: "[" # 复写前缀
......
...@@ -85,7 +85,7 @@ func CheckRangeType(startStr string, endStr string, stepStr string) (string, int ...@@ -85,7 +85,7 @@ func CheckRangeType(startStr string, endStr string, stepStr string) (string, int
rand = true rand = true
} }
if int1 > int2 && step.(int) > 0 { if (int1 > int2 && step.(int) > 0) || (int1 < int2 && step.(int) < 0) {
step = -1 * step.(int) step = -1 * step.(int)
} }
return "int", step, 0, rand return "int", step, 0, rand
...@@ -110,7 +110,7 @@ func CheckRangeType(startStr string, endStr string, stepStr string) (string, int ...@@ -110,7 +110,7 @@ func CheckRangeType(startStr string, endStr string, stepStr string) (string, int
precision := getPrecision(float1, step) precision := getPrecision(float1, step)
if float1 > float2 && step.(int) > 0 { if (float1 > float2 && step.(int) > 0) || (float1 < float2 && step.(int) < 0) {
step = -1 * step.(int) step = -1 * step.(int)
} }
return "float", step, precision, rand return "float", step, precision, rand
...@@ -126,7 +126,8 @@ func CheckRangeType(startStr string, endStr string, stepStr string) (string, int ...@@ -126,7 +126,8 @@ func CheckRangeType(startStr string, endStr string, stepStr string) (string, int
rand = true rand = true
} }
if strings.Compare(startStr,endStr) > 0 && step.(int) > 0 { if (strings.Compare(startStr,endStr) > 0 && step.(int) > 0) ||
(strings.Compare(startStr,endStr) < 0 && step.(int) < 0) {
step = -1 * step.(int) step = -1 * step.(int)
} }
return "char", step, 0, rand return "char", step, 0, rand
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册