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

Function TestLinearSeek

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

Source from the content-addressed store, hash-verified

160}
161
162func TestLinearSeek(t *testing.T) {
163 N := 10001
164 enc := Encoder{BlockSize: 10}
165 for i := 0; i < N; i += 10 {
166 enc.Add(uint64(i))
167 }
168 pack := enc.Done()
169 defer FreePack(pack)
170 dec := Decoder{Pack: pack}
171
172 for i := 0; i < 2*N; i += 10 {
173 uids := dec.LinearSeek(uint64(i))
174
175 if i < N {
176 require.Contains(t, uids, uint64(i))
177 } else {
178 require.NotContains(t, uids, uint64(i))
179 }
180 }
181
182 // blockIdx points to last block.
183 for i := 0; i < 9990; i += 10 {
184 uids := dec.LinearSeek(uint64(i))
185
186 require.NotContains(t, uids, uint64(i))
187 }
188}
189
190func TestDecoder(t *testing.T) {
191 N := 10001

Callers

nothing calls this directly

Calls 4

AddMethod · 0.95
DoneMethod · 0.95
LinearSeekMethod · 0.95
FreePackFunction · 0.85

Tested by

no test coverage detected