MCPcopy
hub / github.com/Col-E/Recaf / testGetAllRoots

Method testGetAllRoots

src/test/java/me/coley/recaf/GraphTest.java:152–172  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

150 }
151
152 @Test
153 public void testGetAllRoots() {
154 IVert v1 = directedGraph.getVertex(1);
155 IVert v4 = directedGraph.getVertex(4);
156 IVert v5 = directedGraph.getVertex(5);
157 IVert v6 = directedGraph.getVertex(6);
158 // 5 -> 6 (root)
159 // 5 -> 3 -> 1 (root)
160 Set<Vertex<Integer>> roots = v5.getAllRoots().collect(Collectors.toSet());
161 assertTrue(roots.contains(v1));
162 assertTrue(roots.contains(v6));
163 assertEquals(2, roots.size());
164 // 4 -> 2 -> 1 (root)
165 roots = v4.getAllRoots().collect(Collectors.toSet());
166 assertTrue(roots.contains(v1));
167 assertEquals(1, roots.size());
168 // 1 (root)
169 roots = v1.getAllRoots().collect(Collectors.toSet());
170 assertTrue(roots.contains(v1));
171 assertEquals(1, roots.size());
172 }
173
174 @Test
175 public void testIsDirectedLeaf() {

Callers

nothing calls this directly

Calls 4

getAllRootsMethod · 0.80
getVertexMethod · 0.65
containsMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected