forked from p93542168/wheat-cache
22 lines
431 B
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)
|
|
}
|