diff --git a/tests/edu/caltech/cs2/project07/MarvelTests.java b/tests/edu/caltech/cs2/project07/MarvelTests.java index fbfa9006fdfa1911df6f5361ac5083f9ba31a402..2a8ceecb1a0f68bb3baab2b5e55d7e69c04c5c38 100644 --- a/tests/edu/caltech/cs2/project07/MarvelTests.java +++ b/tests/edu/caltech/cs2/project07/MarvelTests.java @@ -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,