Skip to content

Commit

Permalink
add test cases for unsigned branch
Browse files Browse the repository at this point in the history
  • Loading branch information
pingyu committed Dec 6, 2019
1 parent e930a86 commit ef0b29e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions expression/builtin_arithmetic_vec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ var vecBuiltinArithmeticCases = map[string][]vecExprBenchCase{
ast.IntDiv: {
{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDecimal, types.ETDecimal}},
{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDecimal, types.ETDecimal}, geners: []dataGenerator{nil, &rangeDecimalGener{0, 0, 0.2}}},
{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDecimal, types.ETDecimal},
childrenFieldTypes: []*types.FieldType{{Tp: mysql.TypeNewDecimal, Flag: mysql.UnsignedFlag}, nil},
geners: []dataGenerator{&rangeDecimalGener{0, 10000, 0.2}, &rangeDecimalGener{0, 10000, 0.2}},
},
{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDecimal, types.ETDecimal},
childrenFieldTypes: []*types.FieldType{nil, {Tp: mysql.TypeNewDecimal, Flag: mysql.UnsignedFlag}},
geners: []dataGenerator{&rangeDecimalGener{0, 10000, 0.2}, &rangeDecimalGener{0, 10000, 0.2}},
},
// when the final result is at (-1, 0], it should be return 0 instead of the error
{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDecimal, types.ETDecimal},
childrenFieldTypes: []*types.FieldType{nil, {Tp: mysql.TypeNewDecimal, Flag: mysql.UnsignedFlag}},
geners: []dataGenerator{&rangeDecimalGener{-100, -1, 0.2}, &rangeDecimalGener{1000, 2000, 0.2}},
},
},
ast.Mod: {
{retEvalType: types.ETReal, childrenTypes: []types.EvalType{types.ETReal, types.ETReal}},
Expand Down

0 comments on commit ef0b29e

Please sign in to comment.