MCPcopy Create free account
hub / github.com/google/pprof / createTestCase1

Function createTestCase1

internal/graph/graph_test.go:203–231  ·  view source on GitHub ↗

createTestCase1 creates a test case that initially looks like: 0 |(5) 1 (3)/ \(4) 2 3. After keeping 0, 2, and 3, it expects the graph: 0 (3)/ \(4) 2 3.

()

Source from the content-addressed store, hash-verified

201// (3)/ \(4)
202// 2 3.
203func createTestCase1() trimTreeTestcase {
204 // Create initial graph
205 graph := &Graph{make(Nodes, 4)}
206 nodes := graph.Nodes
207 for i := range nodes {
208 nodes[i] = createEmptyNode()
209 }
210 createEdges(nodes[0], nodes[1])
211 createEdges(nodes[1], nodes[2], nodes[3])
212 makeEdgeInline(nodes[0].Out, nodes[1])
213 makeEdgeInline(nodes[1].Out, nodes[2])
214 setEdgeWeight(nodes[0].Out, nodes[1], 5)
215 setEdgeWeight(nodes[1].Out, nodes[2], 3)
216 setEdgeWeight(nodes[1].Out, nodes[3], 4)
217
218 // Create expected graph
219 expected, keep := createExpectedNodes(nodes[0], nodes[2], nodes[3])
220 createExpectedEdges(expected[0], expected[1], expected[2])
221 makeEdgeInline(expected[0].out, expected[1].node)
222 makeExpectedEdgeResidual(expected[0], expected[1])
223 makeExpectedEdgeResidual(expected[0], expected[2])
224 setEdgeWeight(expected[0].out, expected[1].node, 3)
225 setEdgeWeight(expected[0].out, expected[2].node, 4)
226 return trimTreeTestcase{
227 initial: graph,
228 expected: expected,
229 keep: keep,
230 }
231}
232
233// createTestCase2 creates a test case that initially looks like:
234//

Callers

nothing calls this directly

Calls 7

createEmptyNodeFunction · 0.85
createEdgesFunction · 0.85
makeEdgeInlineFunction · 0.85
setEdgeWeightFunction · 0.85
createExpectedNodesFunction · 0.85
createExpectedEdgesFunction · 0.85
makeExpectedEdgeResidualFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…