MCPcopy
hub / github.com/dgraph-io/dgraph / TestUidPack

Function TestUidPack

codec/codec_test.go:37–58  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

35}
36
37func TestUidPack(t *testing.T) {
38 // Some edge case tests.
39 pack := Encode([]uint64{}, 128)
40 FreePack(pack)
41 require.Equal(t, 0, ApproxLen(&pb.UidPack{}))
42 require.Equal(t, 0, len(Decode(&pb.UidPack{}, 0)))
43
44 for range 13 {
45 size := rand.Intn(10e6)
46 if size < 0 {
47 size = 1e6
48 }
49 t.Logf("Testing with size = %d", size)
50
51 expected := getUids(size)
52 pack := Encode(expected, 256)
53 require.Equal(t, len(expected), ExactLen(pack))
54 actual := Decode(pack, 0)
55 require.Equal(t, expected, actual)
56 FreePack(pack)
57 }
58}
59
60func TestBufferUidPack(t *testing.T) {
61 // Some edge case tests.

Callers

nothing calls this directly

Calls 6

EncodeFunction · 0.85
FreePackFunction · 0.85
ApproxLenFunction · 0.85
DecodeFunction · 0.85
getUidsFunction · 0.85
ExactLenFunction · 0.85

Tested by

no test coverage detected