Fix tests.

This commit is contained in:
Holt59 2018-03-02 23:49:14 +01:00
parent be94c670b7
commit 5b3690b982
2 changed files with 17 additions and 25 deletions

View File

@ -52,14 +52,13 @@ public class PathTest {
d2e = new Arc(nodes[3], nodes[4], 20, speed20, null); d2e = new Arc(nodes[3], nodes[4], 20, speed20, null);
e2d = new Arc(nodes[4], nodes[0], 10, speed10, null); e2d = new Arc(nodes[4], nodes[0], 10, speed10, null);
graph = new Graph("ID", "", Arrays.asList(nodes)); graph = new Graph("ID", "", Arrays.asList(nodes), null);
emptyPath = new Path(graph, new ArrayList<Arc>()); emptyPath = new Path(graph, new ArrayList<Arc>());
shortPath = new Path(graph, Arrays.asList(new Arc[] { a2b, b2c, c2d_1 })); shortPath = new Path(graph, Arrays.asList(new Arc[] { a2b, b2c, c2d_1 }));
longPath = new Path(graph, Arrays.asList(new Arc[] { a2b, b2c, c2d_1, d2e })); longPath = new Path(graph, Arrays.asList(new Arc[] { a2b, b2c, c2d_1, d2e }));
loopPath = new Path(graph, Arrays.asList(new Arc[] { a2b, b2c, c2d_1, d2a })); loopPath = new Path(graph, Arrays.asList(new Arc[] { a2b, b2c, c2d_1, d2a }));
longLoopPath = new Path(graph, longLoopPath = new Path(graph, Arrays.asList(new Arc[] { a2b, b2c, c2d_1, d2a, a2c, c2d_3, d2a, a2b, b2c }));
Arrays.asList(new Arc[]{ a2b, b2c, c2d_1, d2a, a2c, c2d_3, d2a, a2b, b2c }));
invalidPath = new Path(graph, Arrays.asList(new Arc[] { a2b, c2d_1, d2e })); invalidPath = new Path(graph, Arrays.asList(new Arc[] { a2b, c2d_1, d2e }));
} }
@ -125,8 +124,7 @@ public class PathTest {
Arc[] expected; Arc[] expected;
// Simple construction // Simple construction
path = Path.createFastestPathFromNodes(graph, path = Path.createFastestPathFromNodes(graph, Arrays.asList(new Node[] { nodes[0], nodes[1], nodes[2] }));
Arrays.asList(new Node[]{ nodes[0], nodes[1], nodes[2] }));
expected = new Arc[] { a2b, b2c }; expected = new Arc[] { a2b, b2c };
assertEquals(expected.length, path.getArcs().size()); assertEquals(expected.length, path.getArcs().size());
for (int i = 0; i < expected.length; ++i) { for (int i = 0; i < expected.length; ++i) {
@ -149,8 +147,7 @@ public class PathTest {
Arc[] expected; Arc[] expected;
// Simple construction // Simple construction
path = Path.createShortestPathFromNodes(graph, path = Path.createShortestPathFromNodes(graph, Arrays.asList(new Node[] { nodes[0], nodes[1], nodes[2] }));
Arrays.asList(new Node[]{ nodes[0], nodes[1], nodes[2] }));
expected = new Arc[] { a2b, b2c }; expected = new Arc[] { a2b, b2c };
assertEquals(expected.length, path.getArcs().size()); assertEquals(expected.length, path.getArcs().size());
for (int i = 0; i < expected.length; ++i) { for (int i = 0; i < expected.length; ++i) {

View File

@ -2,9 +2,6 @@ package org.insa.graph.io;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -23,9 +20,7 @@ public class BinaryGraphReaderTest {
@BeforeClass @BeforeClass
public static void initAll() throws IOException { public static void initAll() throws IOException {
BinaryGraphReaderInsa2016 reader = new BinaryGraphReaderInsa2016( // TODO
new DataInputStream(new BufferedInputStream(new FileInputStream("Maps/midip.map"))));
midip = reader.read();
} }
public void assertPointAt(Point p1, double longitude, double latitude) { public void assertPointAt(Point p1, double longitude, double latitude) {