I spotted an edge case where the accumulated distance provided for the end step is slightly off. If the previous step right before the end of route is a break and there is no travel time left between break and end, then we may return an accumulated distance for the end that is lower by 1m than the accumulated distance at the previous break step (and the total distance for the route).
This is due to the fact that the total distance is a double and it can get truncated here:
|
// Unchanged distance after last non-break step. |
|
for (auto i = steps_rank; i < route.steps.size(); ++i) { |
|
route.steps[i].distance = sum_distance; |
|
} |
whereas all other distances are properly rounded.
Also I have a feeling that this last loop could probably be avoided or simplified.
I spotted an edge case where the accumulated distance provided for the end step is slightly off. If the previous step right before the end of route is a
breakand there is no travel time left between break and end, then we may return an accumulated distance for the end that is lower by 1m than the accumulated distance at the previous break step (and the total distance for the route).This is due to the fact that the total distance is a double and it can get truncated here:
vroom/src/routing/http_wrapper.cpp
Lines 246 to 249 in 313e1f9
whereas all other distances are properly rounded.
Also I have a feeling that this last loop could probably be avoided or simplified.