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

Function TestReverseKey

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

Source from the content-addressed store, hash-verified

116}
117
118func TestReverseKey(t *testing.T) {
119 var uid uint64
120 for uid = 1; uid < 1001; uid++ {
121 sattr := fmt.Sprintf("attr:%d", uid)
122
123 key := ReverseKey(AttrInRootNamespace(sattr), uid)
124 pk, err := Parse(key)
125 require.NoError(t, err)
126
127 require.True(t, pk.IsReverse())
128 require.Equal(t, sattr, ParseAttr(pk.Attr))
129 require.Equal(t, uid, pk.Uid)
130 }
131}
132
133func TestReverseKeyWithStartUid(t *testing.T) {
134 var uid uint64

Callers

nothing calls this directly

Calls 5

ReverseKeyFunction · 0.85
AttrInRootNamespaceFunction · 0.85
ParseAttrFunction · 0.85
IsReverseMethod · 0.80
ParseFunction · 0.70

Tested by

no test coverage detected