You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: evaluator_test.go
    path of file: ./repos/tidb/pkg/expression
    
    the code of the file until where you have to start completion: // Copyright 2015 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package expression

import (
	"testing"
	"time"

	"github.com/pingcap/tidb/pkg/errctx"
	"github.com/pingcap/tidb/pkg/parser/ast"
	"github.com/pingcap/tidb/pkg/parser/charset"
	"github.com/pingcap/tidb/pkg/parser/mysql"
	"github.com/pingcap/tidb/pkg/types"
	"github.com/pingcap/tidb/pkg/util/chunk"
	"github.com/pingcap/tidb/pkg/util/collate"
	"github.com/pingcap/tidb/pkg/util/sqlkiller"
	"github.com/stretchr/testify/require"
)

func kindToFieldType(kind byte) types.FieldType {
	ft := types.FieldType{}
	switch kind {
	case types.KindNull:
		ft.SetType(mysql.TypeNull)
	case types.KindInt64:
		ft.SetType(mysql.TypeLonglong)
	case types.KindUint64:
		ft.SetType(mysql.TypeLonglong)
		ft.SetFlag(ft.GetFlag() | mysql.UnsignedFlag)
	case types.KindMinNotNull:
		ft.SetType(mysql.TypeLonglong)
	case types.KindMaxValue:
		ft.SetType(mysql.TypeLonglong)
	case types.KindFloat32:
		ft.SetType(mysql.TypeDouble)
	case types.KindFloat64:
		ft.SetType(mysql.TypeDouble)
	case types.KindString:
		ft.SetType(mysql.TypeVarString)
	case types.KindBytes:
		ft.SetType(mysql.TypeVarString)
	case types.KindMysqlEnum:
		ft.SetType(mysql.TypeEnum)
	case types.KindMysqlSet:
		ft.SetType(mysql.TypeSet)
	case types.KindInterface:
		ft.SetType(mysql.TypeVarString)
	case types.KindMysqlDecimal:
		ft.SetType(mysql.TypeNewDecimal)
	case types.KindMysqlDuration:
		ft.SetType(mysql.TypeDuration)
	case types.KindMysqlTime:
		ft.SetType(mysql.TypeDatetime)
	case types.KindBinaryLiteral:
		ft.SetType(mysql.TypeVarString)
		ft.SetCharset(charset.CharsetBin)
		ft.SetCollate(charset.CollationBin)
	case types.KindMysqlBit:
		ft.SetType(mysql.TypeBit)
	case types.KindMysqlJSON:
		ft.SetType(mysql.TypeJSON)
	}
	return ft
}

func datumsToConstan
    
func TestBinopNumeric(t *testing.T) {
	tbl := []struct {
		lhs any
		op  string
		rhs any
		ret any
	}{
		// plus
		{1, ast.Plus, 1, 2},
		{1, ast.Plus, uint64(1), 2},
		{1, ast.Plus, "1", 2},
		{1, ast.Plus, types.NewDecFromInt(1), 2},
		{uint64(1), ast.Plus, 1, 2},
		{uint64(1), ast.Plus, uint64(1), 2},
		{uint64(1), ast.Plus, -1, 0},
		{1, ast.Plus, []byte("1"), 2},
		{1, ast.Plus, types.NewBinaryLiteralFromUint(1, -1), 2},
		{1, ast.Plus, types.Enum{Name: "a", Value: 1}, 2},
		{1, ast.Plus, types.Set{Name: "a", Value: 1}, 2},

		// minus
		{1, ast.Minus, 1, 0},
		{1, ast.Minus, uint64(1), 0},
		{1, ast.Minus, float64(1), 0},
		{1, ast.Minus, types.NewDecFromInt(1), 0},
		{uint64(1), ast.Minus, 1, 0},
		{uint64(1), ast.Minus, uint64(1), 0},
		{types.NewDecFromInt(1), ast.Minus, 1, 0},
		{"1", ast.Minus, []byte("1"), 0},

		// mul
		{1, ast.Mul, 1, 1},
		{1, ast.Mul, uint64(1), 1},
		{1, ast.Mul, float64(1), 1},
		{1, ast.Mul, types.NewDecFromInt(1), 1},
		{uint64(1), ast.Mul, 1, 1},
		{uint64(1), ast.Mul, uint64(1), 1},
		{types.NewTime(types.FromDate(0, 0, 0, 0, 0, 0, 0), 0, 0), ast.Mul, 0, 0},
		{types.ZeroDuration, ast.Mul, 0, 0},
		{types.NewTime(types.FromGoTime(time.Now()), mysql.TypeDatetime, 0), ast.Mul, 0, 0},
		{types.NewTime(types.FromGoTime(time.Now()), mysql.TypeDatetime, 6), ast.Mul, 0, 0},
		{types.Duration{Duration: 100000000, Fsp: 6}, ast.Mul, 0, 0},

		// div
		{1, ast.Div, float64(1), 1},
		{1, ast.Div, float64(0), nil},
		{1, ast.Div, 2, 0.5},
		{1, ast.Div, 0, nil},

		// int div
		{1, ast.IntDiv, 2, 0},
		{1, ast.IntDiv, uint64(2), 0},
		{1, ast.IntDiv, 0, nil},
		{1, ast.IntDiv, uint64(0), nil},
		{uint64(1), ast.IntDiv, 2, 0},
		{uint64(1), ast.IntDiv, uint64(2), 0},
		{uint64(1), ast.IntDiv, 0, nil},
		{uint64(1), ast.IntDiv, uint64(0), nil},
		{1.0, ast.IntDiv, 2.0, 0},

		// mod
		{10, ast.Mod, 2, 0},
		{10, ast.Mod, uint64(2), 0},
		{10, ast.Mod, 0, nil},
		{10, ast.Mod, uint64(0), nil},
		{-10, ast.Mod, uint64(2), 0},
		{uint64(10), ast.Mod, 2, 0},
		{uint64(10), ast.Mod, uint64(2), 0},
		{uint64(10), ast.Mod, 0, nil},
		{uint64(10), ast.Mod, uint64(0), nil},
		{uint64(10), ast.Mod, -2, 0},
		{float64(10), ast.Mod, 2, 0},
		{float64(10), ast.Mod, 0, nil},
		{types.NewDecFromInt(10), ast.Mod, 2, 0},
		{types.NewDecFromInt(10), ast.Mod, 0, nil},
	}

	ctx := createContext(t)
	for _, tt := range tbl {
		fc := funcs[tt.op]
		f, err := fc.getFunction(ctx, datumsToConstants(types.MakeDatums(tt.lhs, tt.rhs)))
		require.NoError(t, err)
		v, err := evalBuiltinFunc(f, ctx, chunk.Row{})
		require.NoError(t, err)
		switch v.Kind() {
		case types.KindNull:
			require.Nil(t, tt.ret)
		default:
			// we use float64 as the result type check for all.
			sc := ctx.GetSessionVars().StmtCtx
			f, err := v.ToFloat64(sc.TypeCtx())
			require.NoError(t, err)
			d := types.NewDatum(tt.ret)
			r, err := d.ToFloat64(sc.TypeCtx())
			require.NoError(t, err)
			require.Equal(t, r, f)
		}
	}

	testcases := []struct {
		lhs any
		op  string
		rhs any
	}{
		// div
		{1, ast.Div, float64(0)},
		{1, ast.Div, 0},
		// int div
		{1, ast.IntDiv, 0},
		{1, ast.IntDiv, uint64(0)},
		{uint64(1), ast.IntDiv, 0},
		{uint64(1), ast.IntDiv, uint64(0)},
		// mod
		{10, ast.Mod, 0},
		{10, ast.Mod, uint64(0)},
		{uint64(10), ast.Mod, 0},
		{uint64(10), ast.Mod, uint64(0)},
		{float64(10), ast.Mod, 0},
		{types.NewDecFromInt(10), ast.Mod, 0},
	}

	levels := ctx.GetSessionVars().StmtCtx.ErrLevels()
	levels[errctx.ErrGroupDividedByZero] = errctx.LevelError
	ctx.GetSessionVars().StmtCtx.SetErrLevels(levels)
	for _, tt := range testcases {
		fc := funcs[tt.op]
		f, err := fc.getFunction(ctx, datumsToConstants(types.MakeDatums(tt.lhs, tt.rhs)))
		require.NoError(t, err)
		_, err = evalBuiltinFunc(f, ctx, chunk.Row{})
		require.Error(t, err)
	}

	levels[errctx.ErrGroupDividedByZero] = errctx.LevelWarn
	ctx.GetSessionVars().StmtCtx.SetErrLevels(levels)
	for _, tt := range testcases {
		fc := funcs[tt.op]
		f, err := fc.getFunction(ctx, datumsToConstants(types.MakeDatums(tt.lhs, tt.rhs)))
		require.NoError(t, err)
		v, err := evalBuiltinFunc(f, ctx, chunk.Row{})
		require.NoError(t, err)
		require.Equal(t, types.KindNull, v.Kind())
	}
}