MCPcopy
hub / github.com/pingcap/tidb / TestTableCodec

Function TestTableCodec

pkg/tablecodec/tablecodec_test.go:42–52  ·  view source on GitHub ↗

TestTableCodec tests some functions in package tablecodec TODO: add more tests.

(t *testing.T)

Source from the content-addressed store, hash-verified

40// TestTableCodec tests some functions in package tablecodec
41// TODO: add more tests.
42func TestTableCodec(t *testing.T) {
43 key := EncodeRowKey(1, codec.EncodeInt(nil, 2))
44 h, err := DecodeRowKey(key)
45 require.NoError(t, err)
46 require.Equal(t, int64(2), h.IntValue())
47
48 key = EncodeRowKeyWithHandle(1, kv.IntHandle(2))
49 h, err = DecodeRowKey(key)
50 require.NoError(t, err)
51 require.Equal(t, int64(2), h.IntValue())
52}
53
54// https://github.com/pingcap/tidb/issues/27687.
55func TestTableCodecInvalid(t *testing.T) {

Callers

nothing calls this directly

Calls 7

EncodeIntFunction · 0.92
IntHandleTypeAlias · 0.92
EncodeRowKeyFunction · 0.85
DecodeRowKeyFunction · 0.85
EncodeRowKeyWithHandleFunction · 0.85
EqualMethod · 0.65
IntValueMethod · 0.65

Tested by

no test coverage detected