public void testNegativeEdgeIndex() { final Graph g = new PrimaryGraph(); final Path path = Generators.createPath(g, 5); new NegativeIndexChecker<Edge>(path.edgeCount()) { @Override Edge get(int index) { return path.getEdge(index); } }.assertOk(); }
private void checkIndexedGets(Path path, Edge[] edges, boolean inverted) { assertEquals(edges.length, path.edgeCount()); for (int i = 0; i < edges.length; i++) { Node root = inverted ? edges[i].n2() : edges[i].n1(); Node target = edges[i].opposite(root); assertEquals(root, path.getNode(i)); assertEquals(edges[i], path.getEdge(i)); assertEquals(target, path.getNode(i + 1)); } }
private void checkSizeInvariants() { assertEquals(path.size(), path.edgeCount()); assertEquals(path.size() + 1, path.nodeCount()); }