#7403 follow up, fixing unsorted collection in Graph#chain

Fixes #8715
This commit is contained in:
Armin 2017-11-22 19:58:47 +01:00 committed by Armin Braun
parent 475cf748aa
commit d72a93e040
2 changed files with 7 additions and 6 deletions

View file

@ -156,8 +156,8 @@ public final class Graph implements SourceComponent, Hashable {
// Build these lists here since we do mutate the graph in place later
// This isn't strictly necessary, but makes things less confusing
Collection<Vertex> fromLeaves = allLeaves().map(combineResult.oldToNewVertices::get).collect(Collectors.toSet());
Collection<Vertex> toRoots = otherGraph.roots().map(combineResult.oldToNewVertices::get).collect(Collectors.toSet());
Collection<Vertex> fromLeaves = allLeaves().map(combineResult.oldToNewVertices::get).collect(Collectors.toList());
Collection<Vertex> toRoots = otherGraph.roots().map(combineResult.oldToNewVertices::get).collect(Collectors.toList());
return combineResult.graph.chain(fromLeaves, toRoots);
}

View file

@ -83,10 +83,11 @@ public class GraphTest {
@Test
public void complexConsistencyTest() throws InvalidIRException {
Graph g1 = IRHelpers.samplePipeline().getGraph();
Graph g2 = IRHelpers.samplePipeline().getGraph();
assertEquals(g1.uniqueHash(), g2.uniqueHash());
for (int i = 0; i < 10; ++i) {
Graph g1 = IRHelpers.samplePipeline().getGraph();
Graph g2 = IRHelpers.samplePipeline().getGraph();
assertEquals(g1.uniqueHash(), g2.uniqueHash());
}
}
@Test