wheat-cache/storage/persisted/codec.gen_test.go

22 lines
431 B
Go

package persisted
import (
"testing"
"gitee.com/timedb/wheatCache/pkg/proto"
"github.com/stretchr/testify/require"
)
func Test_codec_Encode(t *testing.T) {
c := codec{}
req := &proto.LIndexRequest{
Key: proto.NewBaseKey("123"),
Index: 11,
}
b, err := c.Encode("LIndex", req)
require.NoError(t, err)
res, err := c.Decode(b)
require.NoError(t, err)
require.Equal(t, req.Index, res.(*proto.LIndexRequest).Index)
}