MCPcopy Create free account
hub / github.com/LFYSec/MScan / testDominator

Method testDominator

src/test/java/pascal/taie/util/graph/GraphTest.java:122–142  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

120 }
121
122 @Test
123 void testDominator() {
124 Graph<Integer> g = readGraph("src/test/resources/util/graph-dominator.txt");
125 DominatorFinder<Integer> domFinder = new DominatorFinder<>(g);
126 assertTrue(domFinder.isDominatedBy(2, 1));
127 assertFalse(domFinder.isDominatedBy(1, 2));
128
129 assertEquals(domFinder.getDominatorsOf(1), Set.of(1));
130 assertEquals(domFinder.getDominatorsOf(3), Set.of(1, 3));
131 assertEquals(domFinder.getDominatorsOf(5), Set.of(1, 3, 4, 5));
132 assertEquals(domFinder.getDominatorsOf(7), Set.of(1, 3, 4, 7));
133 assertEquals(domFinder.getDominatorsOf(9), Set.of(1, 3, 4, 7, 8, 9));
134
135 assertEquals(domFinder.getNodesDominatedBy(1),
136 Set.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
137 assertEquals(domFinder.getNodesDominatedBy(3),
138 Set.of(3, 4, 5, 6, 7, 8, 9, 10));
139 assertEquals(domFinder.getNodesDominatedBy(5), Set.of(5));
140 assertEquals(domFinder.getNodesDominatedBy(7), Set.of(7, 8, 9, 10));
141 assertEquals(domFinder.getNodesDominatedBy(9), Set.of(9));
142 }
143
144 private static SimpleGraph<Integer> readGraph(String filePath) {
145 SimpleGraph<Integer> graph = new SimpleGraph<>();

Callers

nothing calls this directly

Calls 5

readGraphMethod · 0.95
isDominatedByMethod · 0.95
getDominatorsOfMethod · 0.95
getNodesDominatedByMethod · 0.95
ofMethod · 0.65

Tested by

no test coverage detected