/go/libraries/doltcore/env/actions/{infer_schema}_test.go: fix tests

This commit is contained in:
Dustin Brown
2021-07-07 11:40:24 -07:00
parent fdd6d33293
commit 6d64c37891
2 changed files with 3 additions and 3 deletions

View File

@@ -226,7 +226,7 @@ func leastPermissiveNumericType(strVal string, floatThreshold float64) (ti typei
}
// handle leading zero case
if strVal[0] == '0' {
if len(strVal) > 1 && strVal[0] == '0' {
return typeinfo.StringDefaultType
}

View File

@@ -81,8 +81,8 @@ func TestLeastPermissiveNumericType(t *testing.T) {
{"negative float", "-1.3451234", 0.0, typeinfo.Float32Type},
{"double decimal point", "0.00.0", 0.0, typeinfo.UnknownType},
{"zero float with high precision", "0.0000", 0.0, typeinfo.Float32Type},
{"all zeroes", "0000", 0.0, typeinfo.Uint32Type},
{"leading zeroes", "01", 0.0, typeinfo.Uint32Type},
{"all zeroes", "0000", 0.0, typeinfo.StringDefaultType},
{"leading zeroes", "01", 0.0, typeinfo.StringDefaultType},
{"negative int", "-1234", 0.0, typeinfo.Int32Type},
{"fits in uint64 but not int64", strconv.FormatUint(math.MaxUint64, 10), 0.0, typeinfo.Uint64Type},
{"negative less than math.MinInt64", "-" + strconv.FormatUint(math.MaxUint64, 10), 0.0, typeinfo.UnknownType},