ledisdb/ledis/rdb/rdb_test.go

24 lines
341 B
Go
Raw Normal View History

2014-11-27 09:03:44 +03:00
package rdb
import (
"reflect"
"testing"
)
func TestCodec(t *testing.T) {
testCodec(String("abc"), t)
}
func testCodec(obj interface{}, t *testing.T) {
b, err := Dump(obj)
if err != nil {
t.Fatal(err)
}
if o, err := DecodeDump(b); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(obj, o) {
t.Fatal("must equal")
}
}