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

Function createTestCase2

internal/graph/graph_test.go:250–276  ·  view source on GitHub ↗

createTestCase2 creates a test case that initially looks like: 3 | (12) 1 | (8) 2 | (15) 0 | (10) 4. After keeping 3 and 4, it expects the graph: 3 | (10) 4.

()

Source from the content-addressed store, hash-verified

248// | (10)
249// 4.
250func createTestCase2() trimTreeTestcase {
251 // Create initial graph
252 graph := &Graph{make(Nodes, 5)}
253 nodes := graph.Nodes
254 for i := range nodes {
255 nodes[i] = createEmptyNode()
256 }
257 createEdges(nodes[3], nodes[1])
258 createEdges(nodes[1], nodes[2])
259 createEdges(nodes[2], nodes[0])
260 createEdges(nodes[0], nodes[4])
261 setEdgeWeight(nodes[3].Out, nodes[1], 12)
262 setEdgeWeight(nodes[1].Out, nodes[2], 8)
263 setEdgeWeight(nodes[2].Out, nodes[0], 15)
264 setEdgeWeight(nodes[0].Out, nodes[4], 10)
265
266 // Create expected graph
267 expected, keep := createExpectedNodes(nodes[3], nodes[4])
268 createExpectedEdges(expected[0], expected[1])
269 makeExpectedEdgeResidual(expected[0], expected[1])
270 setEdgeWeight(expected[0].out, expected[1].node, 10)
271 return trimTreeTestcase{
272 initial: graph,
273 expected: expected,
274 keep: keep,
275 }
276}
277
278// createTestCase3 creates an initially empty graph and expects an empty graph
279// after trimming.

Callers

nothing calls this directly

Calls 6

createEmptyNodeFunction · 0.85
createEdgesFunction · 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…