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

Function TestParseDataKeyWithStartUid

x/keys_test.go:64–81  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

62}
63
64func TestParseDataKeyWithStartUid(t *testing.T) {
65 var uid uint64
66 startUid := uint64(math.MaxUint64)
67 for uid = 1; uid < 1001; uid++ {
68 sattr := fmt.Sprintf("attr:%d", uid)
69 key := DataKey(AttrInRootNamespace(sattr), uid)
70 key, err := SplitKey(key, startUid)
71 require.NoError(t, err)
72 pk, err := Parse(key)
73 require.NoError(t, err)
74
75 require.True(t, pk.IsData())
76 require.Equal(t, sattr, ParseAttr(pk.Attr))
77 require.Equal(t, uid, pk.Uid)
78 require.Equal(t, pk.HasStartUid, true)
79 require.Equal(t, startUid, pk.StartUid)
80 }
81}
82
83func TestIndexKey(t *testing.T) {
84 for uid := range 1001 {

Callers

nothing calls this directly

Calls 6

AttrInRootNamespaceFunction · 0.85
SplitKeyFunction · 0.85
ParseAttrFunction · 0.85
IsDataMethod · 0.80
DataKeyFunction · 0.70
ParseFunction · 0.70

Tested by

no test coverage detected