Fix tests.
This commit is contained in:
parent
be94c670b7
commit
5b3690b982
@ -52,15 +52,14 @@ 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,9 +124,8 @@ 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) {
|
||||||
assertEquals(expected[i], path.getArcs().get(i));
|
assertEquals(expected[i], path.getArcs().get(i));
|
||||||
@ -135,8 +133,8 @@ public class PathTest {
|
|||||||
|
|
||||||
// Not so simple construction
|
// Not so simple construction
|
||||||
path = Path.createFastestPathFromNodes(graph,
|
path = Path.createFastestPathFromNodes(graph,
|
||||||
Arrays.asList(new Node[]{ nodes[0], nodes[1], nodes[2], nodes[3] }));
|
Arrays.asList(new Node[] { nodes[0], nodes[1], nodes[2], nodes[3] }));
|
||||||
expected = new Arc[]{ a2b, b2c, c2d_3 };
|
expected = new Arc[] { a2b, b2c, c2d_3 };
|
||||||
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) {
|
||||||
assertEquals(expected[i], path.getArcs().get(i));
|
assertEquals(expected[i], path.getArcs().get(i));
|
||||||
@ -149,9 +147,8 @@ 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) {
|
||||||
assertEquals(expected[i], path.getArcs().get(i));
|
assertEquals(expected[i], path.getArcs().get(i));
|
||||||
@ -159,8 +156,8 @@ public class PathTest {
|
|||||||
|
|
||||||
// Not so simple construction
|
// Not so simple construction
|
||||||
path = Path.createShortestPathFromNodes(graph,
|
path = Path.createShortestPathFromNodes(graph,
|
||||||
Arrays.asList(new Node[]{ nodes[0], nodes[1], nodes[2], nodes[3] }));
|
Arrays.asList(new Node[] { nodes[0], nodes[1], nodes[2], nodes[3] }));
|
||||||
expected = new Arc[]{ a2b, b2c, c2d_2 };
|
expected = new Arc[] { a2b, b2c, c2d_2 };
|
||||||
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) {
|
||||||
assertEquals(expected[i], path.getArcs().get(i));
|
assertEquals(expected[i], path.getArcs().get(i));
|
||||||
@ -169,12 +166,12 @@ public class PathTest {
|
|||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
public void testCreateFastestPathFromNodesException() {
|
public void testCreateFastestPathFromNodesException() {
|
||||||
Path.createFastestPathFromNodes(graph, Arrays.asList(new Node[]{ nodes[1], nodes[0] }));
|
Path.createFastestPathFromNodes(graph, Arrays.asList(new Node[] { nodes[1], nodes[0] }));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
public void testCreateShortestPathFromNodesException() {
|
public void testCreateShortestPathFromNodesException() {
|
||||||
Path.createShortestPathFromNodes(graph, Arrays.asList(new Node[]{ nodes[1], nodes[0] }));
|
Path.createShortestPathFromNodes(graph, Arrays.asList(new Node[] { nodes[1], nodes[0] }));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user