MCPcopy Create free account
hub / github.com/distributedio/titan / TestCodecObject

Function TestCodecObject

db/codec_test.go:10–31  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestCodecObject(t *testing.T) {
11 now := Now()
12 tests := []*Object{
13 &Object{
14 ID: []byte("1234567890123456"),
15 CreatedAt: now,
16 UpdatedAt: now,
17 ExpireAt: 0,
18 Type: ObjectString,
19 Encoding: ObjectEncodingRaw,
20 },
21 }
22 for _, obj := range tests {
23 got, err := DecodeObject(EncodeObject(obj))
24 if err != nil {
25 t.Fatalf("decode object get error: %s", err)
26 }
27 if !reflect.DeepEqual(got, obj) {
28 t.Fatalf("decode failed want=%v, got=%v", obj, got)
29 }
30 }
31}
32
33func TestCodecEncodeInt64(t *testing.T) {
34 values := []int64{math.MinInt64, -1, 0, 1, math.MaxInt64}

Callers

nothing calls this directly

Calls 3

NowFunction · 0.85
DecodeObjectFunction · 0.85
EncodeObjectFunction · 0.85

Tested by

no test coverage detected