Commit c8c07c46 authored by Ethan Ordentlich's avatar Ethan Ordentlich
Browse files

Fix directionality of edge test in common

parent 12868450
1 merge request!2Fix directionality of edge test in marvel common
Pipeline #8969 failed with stage
in 0 seconds
Showing with 21 additions and 2 deletions
+21 -2
......@@ -101,7 +101,12 @@ public class MarvelTests {
MARVEL_GRAPH.removeEdge(c2, c1);
assertEquals(null, MARVEL_GRAPH.adjacent(c2, c1), "An edge is non-null after removal");
if (edge > 80) {
common.add(c1 + " --" + edge + "-- " + c2);
if (c1.compareTo(c2) < 0) {
common.add(c1.strip() + " --" + edge + "-- " + c2.strip());
}
else {
common.add(c2.strip() + " --" + edge + "-- " + c1.strip());
}
}
}
assertTrue(MARVEL_GRAPH.neighbors(c1).isEmpty(), "After removing all of a vertex's neighbors, neighbors() is non-empty");
......@@ -122,7 +127,21 @@ public class MarvelTests {
}
while (fr.hasNextLine()) {
expected.add(fr.nextLine());
String l = fr.nextLine();
// is edge - sort to remove dependence on directionality for correctness
if (l.contains("--")) {
String[] spl = l.split("--");
String v1 = spl[0].strip();
String v2 = spl[2].strip();
String e = spl[1];
if (v1.compareTo(v2) < 0) {
l = v1 + " --" + e + "-- " + v2;
}
else {
l = v2 + " --" + e + "-- " + v1;
}
}
expected.add(l);
}
MatcherAssert.assertThat(actual,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment