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

Function TestChildrenOrder

query/outputnode_test.go:215–252  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

213}
214
215func TestChildrenOrder(t *testing.T) {
216 enc := newEncoder()
217 root := enc.newNode(1)
218 root.meta = 0
219 for i := 1; i <= 10; i++ {
220 n := enc.newNode(1)
221 n.meta = uint64(i)
222 enc.addChildren(root, n)
223 }
224
225 stepMom := enc.newNode(1)
226 stepMom.meta = 100
227 for i := 11; i <= 20; i++ {
228 n := enc.newNode(1)
229 n.meta = uint64(i)
230 enc.addChildren(stepMom, n)
231 }
232 enc.addChildren(root, stepMom.child)
233
234 stepDad := enc.newNode(1)
235 stepDad.meta = 101
236 {
237 n := enc.newNode(1)
238 n.meta = uint64(21)
239 enc.addChildren(stepDad, n)
240 }
241 enc.addChildren(root, stepDad.child)
242
243 enc.fixOrder(root)
244 enc.fixOrder(root) // Another time just to ensure it still works.
245
246 child := root.child
247 for i := 1; i <= 21; i++ {
248 require.Equal(t, uint64(i), child.meta&^visitedBit)
249 child = child.next
250 }
251 require.Nil(t, child)
252}
253
254func TestMarshalTimeJson(t *testing.T) {
255 var timesToMarshal = []struct {

Callers

nothing calls this directly

Calls 4

newEncoderFunction · 0.85
newNodeMethod · 0.80
addChildrenMethod · 0.80
fixOrderMethod · 0.80

Tested by

no test coverage detected