File: rdb_test.go

package info (click to toggle)
golang-github-siddontang-rdb 0.0~git20150307.0.fc89ed2-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 108 kB
  • sloc: makefile: 3
file content (23 lines) | stat: -rw-r--r-- 341 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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")
	}
}