Skip to content

Commit

Permalink
add a test for block merging in removeEdge
Browse files Browse the repository at this point in the history
  • Loading branch information
Timbals committed Oct 10, 2023
1 parent c7544cc commit 4006651
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,25 @@ public void modifyStmtToBlockAtTail() {
assertEquals(1, graph.getBlocksSorted().size());
}

@Test
public void removeEdgeMerge() {
MutableBlockStmtGraph graph = new MutableBlockStmtGraph();

graph.addNode(firstNop);
graph.setStartingStmt(firstNop);
graph.putEdge(firstNop, secondNop);
graph.putEdge(secondNop, conditionalStmt);

assertEquals(1, graph.getBlocks().size());
// this edge splits the block between the first and second Nop
graph.putEdge(conditionalStmt, secondNop);
assertEquals(2, graph.getBlocks().size());

// this edge removal should merge both blocks together again
graph.removeEdge(conditionalStmt, secondNop);
assertEquals(1, graph.getBlocks().size());
}

@Test
public void removeStmtInBetweenBlock() {

Expand Down

0 comments on commit 4006651

Please sign in to comment.