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.
()
| 248 | // | (10) |
| 249 | // 4. |
| 250 | func 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. |
nothing calls this directly
no test coverage detected
searching dependent graphs…