@Test
public void testInitFromAndTo() {
Graph g = createGHStorage(false);
g.edge(0, 1, 1, true);
updateDistancesFor(g, 0, 0.00, 0.00);
updateDistancesFor(g, 1, 0.01, 0.01);
final AtomicReference<SPTEntry> fromRef = new AtomicReference<>();
final AtomicReference<SPTEntry> toRef = new AtomicReference<>();
AStarBidirection astar = new AStarBidirection(g, new ShortestWeighting(carEncoder), traversalMode) {
@Override
public void init(int from, double fromWeight, int to, double toWeight) {
super.init(from, fromWeight, to, toWeight);
fromRef.set(currFrom);
toRef.set(currTo);
}
};
astar.init(0, 1, 1, 0.5);
assertEquals(1, ((AStar.AStarEntry) fromRef.get()).weightOfVisitedPath, .1);
assertEquals(787.3, fromRef.get().weight, .1);
assertEquals(0.5, ((AStar.AStarEntry) toRef.get()).weightOfVisitedPath, .1);
assertEquals(786.8, toRef.get().weight, .1);
}
}