From c8b72759c02a77a91d10d94e4928afaa6dc6db21 Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Fri, 15 Mar 2024 19:27:15 +0100 Subject: [PATCH 1/2] showcase https://github.com/valhalla/valhalla/issues/4433 --- test/gurka/test_failing.cc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/gurka/test_failing.cc diff --git a/test/gurka/test_failing.cc b/test/gurka/test_failing.cc new file mode 100644 index 0000000000..591103c0a9 --- /dev/null +++ b/test/gurka/test_failing.cc @@ -0,0 +1,26 @@ +#include "gurka.h" +#include "test.h" + +#include + +using namespace valhalla; + +TEST(StandAlone, CostMatrixTrivialRoutes) { + const std::string ascii_map = R"( + A-2---1-B + )"; + const gurka::ways ways = { + {"AB", {{"highway", "residential"}, {"maxspeed:forward", "100"}, {"maxspeed:backward", "10"}}}, + }; + 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: + // https://github.com/valhalla/valhalla/issues/4433 + EXPECT_NEAR(matrix.matrix().times(0), 144.f, 0.1); + } +} From 00e58496ba5335b50e3d2911183fddcdaf81cf9e Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Fri, 15 Mar 2024 19:33:49 +0100 Subject: [PATCH 2/2] clearer now --- test/gurka/test_failing.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/gurka/test_failing.cc b/test/gurka/test_failing.cc index 591103c0a9..fcb1eaa3e7 100644 --- a/test/gurka/test_failing.cc +++ b/test/gurka/test_failing.cc @@ -7,10 +7,10 @@ using namespace valhalla; TEST(StandAlone, CostMatrixTrivialRoutes) { const std::string ascii_map = R"( - A-2---1-B + A-1---2-B )"; const gurka::ways ways = { - {"AB", {{"highway", "residential"}, {"maxspeed:forward", "100"}, {"maxspeed:backward", "10"}}}, + {"AB", {{"highway", "residential"}, {"maxspeed:forward", "10"}, {"maxspeed:backward", "100"}}}, }; const auto layout = gurka::detail::map_to_coordinates(ascii_map, 100); auto map = @@ -19,7 +19,7 @@ TEST(StandAlone, CostMatrixTrivialRoutes) { { 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: + // 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); }