(t *testing.T)
| 354 | } |
| 355 | |
| 356 | func TestCutKeyNew(t *testing.T) { |
| 357 | values := []types.Datum{types.NewIntDatum(1), types.NewBytesDatum([]byte("abc")), types.NewFloat64Datum(5.5)} |
| 358 | handle := types.NewIntDatum(100) |
| 359 | values = append(values, handle) |
| 360 | sc := stmtctx.NewStmtCtxWithTimeZone(time.UTC) |
| 361 | encodedValue, err := codec.EncodeKey(sc.TimeZone(), nil, values...) |
| 362 | require.NoError(t, err) |
| 363 | tableID := int64(4) |
| 364 | indexID := int64(5) |
| 365 | indexKey := EncodeIndexSeekKey(tableID, indexID, encodedValue) |
| 366 | valuesBytes, handleBytes, err := CutIndexKeyNew(indexKey, 3) |
| 367 | require.NoError(t, err) |
| 368 | for i := 0; i < 3; i++ { |
| 369 | valueBytes := valuesBytes[i] |
| 370 | var val types.Datum |
| 371 | _, val, _ = codec.DecodeOne(valueBytes) |
| 372 | require.Equal(t, values[i], val) |
| 373 | } |
| 374 | _, handleVal, _ := codec.DecodeOne(handleBytes) |
| 375 | require.Equal(t, types.NewIntDatum(100), handleVal) |
| 376 | } |
| 377 | |
| 378 | func TestCutKey(t *testing.T) { |
| 379 | colIDs := []int64{1, 2, 3} |
nothing calls this directly
no test coverage detected