micro/codec/noop_test.go
Vasiliy Tolstov 3573133bdb many fixes
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-02-13 15:34:48 +03:00

35 lines
568 B
Go

package codec
import (
"bytes"
"testing"
)
func TestNoopBytes(t *testing.T) {
req := []byte("test req")
rsp := make([]byte, len(req))
nc := NewCodec()
if err := nc.Unmarshal(req, &rsp); err != nil {
t.Fatal(err)
}
if !bytes.Equal(req, rsp) {
t.Fatalf("req not eq rsp: %s != %s", req, rsp)
}
}
func TestNoopString(t *testing.T) {
req := []byte("test req")
var rsp string
nc := NewCodec()
if err := nc.Unmarshal(req, &rsp); err != nil {
t.Fatal(err)
}
if !bytes.Equal(req, []byte(rsp)) {
t.Fatalf("req not eq rsp: %s != %s", req, rsp)
}
}