MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / TestEncodeMemory

Function TestEncodeMemory

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

Source from the content-addressed store, hash-verified

24)
25
26func TestEncodeMemory(t *testing.T) {
27 // if testing.Short() {
28 t.Skip("Skipping TestEncodeMemory")
29 // }
30 var wg sync.WaitGroup
31
32 for range runtime.NumCPU() {
33 enc := newEncoder()
34 n := enc.newNode(0)
35 require.NotNil(t, n)
36 for i := range 15000 {
37 require.NoError(t, enc.AddValue(n, enc.idForAttr(fmt.Sprintf("very long attr name %06d", i)),
38 types.ValueForType(types.StringID)))
39 enc.AddListChild(n,
40 enc.newNode(enc.idForAttr(fmt.Sprintf("another long child %06d", i))))
41 }
42 wg.Add(1)
43 go func() {
44 defer wg.Done()
45 for range 1000 {
46 enc.buf.Reset()
47 require.NoError(t, enc.encode(n))
48 }
49 }()
50 }
51
52 wg.Wait()
53}
54
55func TestNormalizeJSONLimit(t *testing.T) {
56 // Set default normalize limit.

Callers

nothing calls this directly

Calls 12

ValueForTypeFunction · 0.92
newEncoderFunction · 0.85
newNodeMethod · 0.80
AddValueMethod · 0.80
idForAttrMethod · 0.80
AddListChildMethod · 0.80
WaitMethod · 0.80
SkipMethod · 0.65
AddMethod · 0.45
DoneMethod · 0.45
ResetMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected