Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TODO: fix trivial route for CostMatrix #4634

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions test/gurka/test_failing.cc
@@ -0,0 +1,26 @@
#include "gurka.h"
#include "test.h"

#include <gtest/gtest.h>

using namespace valhalla;

TEST(StandAlone, CostMatrixTrivialRoutes) {
const std::string ascii_map = R"(
A-1---2-B
)";
const gurka::ways ways = {
{"AB", {{"highway", "residential"}, {"maxspeed:forward", "10"}, {"maxspeed:backward", "100"}}},
};
const auto layout = gurka::detail::map_to_coordinates(ascii_map, 100);
auto map =
gurka::buildtiles(layout, ways, {}, {}, VALHALLA_BUILD_DIR "test/data/costmatrix_trivial");

{
auto matrix = gurka::do_action(valhalla::Options::sources_to_targets, map, {"1"}, {"2"}, "auto");
EXPECT_EQ(matrix.matrix().distances(0), 400);
// this fails because it's getting the wrong directed edge with 100 kmh:
// https://github.com/valhalla/valhalla/issues/4433
EXPECT_NEAR(matrix.matrix().times(0), 144.f, 0.1);
}
}