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

Function TestIndexKeyWithStartUid

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

Source from the content-addressed store, hash-verified

96}
97
98func TestIndexKeyWithStartUid(t *testing.T) {
99 startUid := uint64(math.MaxUint64)
100 for uid := range 1001 {
101 sattr := fmt.Sprintf("attr:%d", uid)
102 sterm := fmt.Sprintf("term:%d", uid)
103
104 key := IndexKey(AttrInRootNamespace(sattr), sterm)
105 key, err := SplitKey(key, startUid)
106 require.NoError(t, err)
107 pk, err := Parse(key)
108 require.NoError(t, err)
109
110 require.True(t, pk.IsIndex())
111 require.Equal(t, sattr, ParseAttr(pk.Attr))
112 require.Equal(t, sterm, pk.Term)
113 require.Equal(t, pk.HasStartUid, true)
114 require.Equal(t, startUid, pk.StartUid)
115 }
116}
117
118func TestReverseKey(t *testing.T) {
119 var uid uint64

Callers

nothing calls this directly

Calls 6

IndexKeyFunction · 0.85
AttrInRootNamespaceFunction · 0.85
SplitKeyFunction · 0.85
ParseAttrFunction · 0.85
IsIndexMethod · 0.80
ParseFunction · 0.70

Tested by

no test coverage detected