private void runTestWithDirectionDependentEdgeSpeed(
int speed, int revSpeed, int from, int to, IntArrayList expectedPath, FlagEncoder encoder) {
EncodingManager encodingManager = new EncodingManager(encoder);
FastestWeighting weighting = new FastestWeighting(encoder);
AlgorithmOptions algoOpts = AlgorithmOptions.start().weighting(weighting).build();
GraphHopperStorage graph = createGHStorage(encodingManager, Arrays.asList(weighting), false);
EdgeIteratorState edge = graph.edge(0, 1, 2, true);
long flags = edge.getFlags();
flags = encoder.setSpeed(flags, speed);
flags = encoder.setReverseSpeed(flags, revSpeed);
edge.setFlags(flags);
graph.edge(1, 2, 1, true);
CHGraph chGraph = graph.getGraph(CHGraph.class);
for (int i = 0; i < 3; ++i) {
chGraph.setLevel(i, i);
}
graph.freeze();
RoutingAlgorithm algo = createCHAlgo(graph, chGraph, true, algoOpts);
Path p = algo.calcPath(from, to);
assertEquals(3, p.getDistance(), 1.e-3);
assertEquals(p.toString(), expectedPath, p.calcNodes());
}