Commit 5837873b authored by Archie Shahidullah's avatar Archie Shahidullah :expressionless:
Browse files

Fix issue 2

parent b37e9e2b
1 merge request!2Review Tests for Project 8
Pipeline #46466 canceled with stage
in 0 seconds
Showing with 10 additions and 8 deletions
+10 -8
......@@ -290,7 +290,12 @@ public class BeavermapTests {
IDeque<Location> actualPath = bmg.dijkstra(start, target);
List<Long> actualPathIDs = new ArrayList<>();
if (actualPath != null) {
if (expectedPathIDs.size() == 0) {
assertNull(actualPath, "Path does not exist from " + start.id + " to " + target.id + " but was found");
}
else {
assertNotNull(actualPath, "Path exists from " + start.id + " to " + target.id + " but was not found");
for (Location l : actualPath) {
actualPathIDs.add(l.id);
}
......@@ -298,9 +303,6 @@ public class BeavermapTests {
MatcherAssert.assertThat(actualPathIDs,
IsIterableContainingInOrder.contains(expectedPathIDs.toArray()));
}
else if (expectedPathIDs.size() != 0) {
fail("Found path from " + start.id + " to " + target.id + " where there is none.");
}
}
}
......
......@@ -79,10 +79,10 @@ public class DijkstraTest {
String line = s.nextLine();
if (line.equals("null")) {
assertNull(res, "Path does not exist but was found");
assertNull(res, "Path does not exist from " + start + " to " + end + " but was found");
}
else {
assertNotNull(res, "Path exists but was not found");
assertNotNull(res, "Path exists from " + start + " to " + end + " but was not found");
for (Location l : res) {
if (prev != null) {
pathLen += bmg.adjacent(prev.id, l.id);
......@@ -135,10 +135,10 @@ public class DijkstraTest {
String line = s.nextLine();
if (line.equals("null")) {
assertNull(res, "Path does not exist but was found");
assertNull(res, "Path does not exist from " + startvertex + " to " + endvertex + " but was found");
}
else {
assertNotNull(res, "Path exists but was not found");
assertNotNull(res, "Path exists from " + startvertex + " to " + endvertex + " but was not found");
double pathLen = 0;
Location prev = null;
for (Location l : res) {
......
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