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

Method testUndirectedPathSearch

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

Source from the content-addressed store, hash-verified

72 }
73
74 @Test
75 public void testUndirectedPathSearch() {
76 IVert v1 = undirectedGraph.getVertex(2);
77 IVert v4 = undirectedGraph.getVertex(4);
78 // Use DFS to find the path between v1 and v4
79 Search<Integer> search = new DepthFirstSearch<>();
80 SearchResult<Integer> result = search.find(v1, v4);
81 assertNotNull(result);
82 // Path must follow one of the given paths
83 String[] paths = new String[]{"2 1 3 4", "2 5 3 4"};
84 String path = result.getPath().stream()
85 .map(String::valueOf)
86 .collect(Collectors.joining(" ")).toString();
87 assertTrue(Arrays.binarySearch(paths, path) >= 0);
88 }
89
90 @Test
91 public void testDirectedPathSearch() {

Callers

nothing calls this directly

Calls 5

findMethod · 0.95
getVertexMethod · 0.65
toStringMethod · 0.45
mapMethod · 0.45
getPathMethod · 0.45

Tested by

no test coverage detected