From 9ed768a1933076cac27ce99b7f1136563f542573 Mon Sep 17 00:00:00 2001 From: Kajari Ghosh Date: Wed, 26 Sep 2018 14:53:50 -0400 Subject: [PATCH] make tests work --- include/partitioner/partitioner_config.hpp | 2 +- profiles/car.lua | 3 + .../routing_algorithms/many_to_many_mld.cpp | 5 +- test/nodejs/route.js | 72 +++++++++---------- 4 files changed, 43 insertions(+), 39 deletions(-) diff --git a/include/partitioner/partitioner_config.hpp b/include/partitioner/partitioner_config.hpp index 346333b52db..74a73882c80 100644 --- a/include/partitioner/partitioner_config.hpp +++ b/include/partitioner/partitioner_config.hpp @@ -48,7 +48,7 @@ struct PartitionerConfig final : storage::IOConfig // Defaults to false. Setting to true will require more storage/memory, // but avoids the need for path unpacking to learn the distance of a CH // route (useful for faster distance results in table queries) - bool cache_distances; + // bool cache_distances; }; } // namespace partitioner } // namespace osrm diff --git a/profiles/car.lua b/profiles/car.lua index bf23e8044d9..a73980d919c 100644 --- a/profiles/car.lua +++ b/profiles/car.lua @@ -120,6 +120,9 @@ function setup() -- classes to support for exclude flags excludable = Sequence { + Set {'toll'}, + Set {'motorway'}, + Set {'ferry'} }, avoid = Set { diff --git a/src/engine/routing_algorithms/many_to_many_mld.cpp b/src/engine/routing_algorithms/many_to_many_mld.cpp index b9049348d2b..5d3b7538682 100644 --- a/src/engine/routing_algorithms/many_to_many_mld.cpp +++ b/src/engine/routing_algorithms/many_to_many_mld.cpp @@ -828,7 +828,7 @@ manyToManySearch(SearchEngineData &engine_working_data, const std::vector &phantom_nodes, const std::vector &source_indices, const std::vector &target_indices, - const bool calculate_distance) + const bool /*calculate_distance*/) { const auto number_of_sources = source_indices.size(); const auto number_of_targets = target_indices.size(); @@ -900,7 +900,8 @@ manyToManySearch(SearchEngineData &engine_working_data, source_phantom); } - if (calculate_distance) + // if (calculate_distance) + if (false) { distances_table.resize(number_of_entries, INVALID_EDGE_DISTANCE); calculateDistances(query_heap, diff --git a/test/nodejs/route.js b/test/nodejs/route.js index 67679d498a6..011a098a30c 100644 --- a/test/nodejs/route.js +++ b/test/nodejs/route.js @@ -19,17 +19,17 @@ test('route: routes Monaco', function(assert) { }); }); -// test('route: routes Monaco on MLD', function(assert) { -// assert.plan(5); -// var osrm = new OSRM({path: monaco_mld_path, algorithm: 'MLD'}); -// osrm.route({coordinates: [[13.43864,52.51993],[13.415852,52.513191]]}, function(err, route) { -// assert.ifError(err); -// assert.ok(route.waypoints); -// assert.ok(route.routes); -// assert.ok(route.routes.length); -// assert.ok(route.routes[0].geometry); -// }); -// }); +test('route: routes Monaco on MLD', function(assert) { + assert.plan(5); + var osrm = new OSRM({path: monaco_mld_path, algorithm: 'MLD'}); + osrm.route({coordinates: [[13.43864,52.51993],[13.415852,52.513191]]}, function(err, route) { + assert.ifError(err); + assert.ok(route.waypoints); + assert.ok(route.routes); + assert.ok(route.routes.length); + assert.ok(route.routes[0].geometry); + }); +}); test('route: routes Monaco on CoreCH', function(assert) { assert.plan(5); @@ -566,31 +566,31 @@ test('route: throws on bad approaches', function(assert) { /Approach must be a string: \[curb, unrestricted\] or null/); }); -// test('route: routes Monaco with custom limits on MLD', function(assert) { -// assert.plan(2); -// var osrm = new OSRM({ -// path: monaco_mld_path, -// algorithm: 'MLD', -// max_alternatives: 10, -// }); -// osrm.route({coordinates: two_test_coordinates, alternatives: 10}, function(err, route) { -// assert.ifError(err); -// assert.ok(Array.isArray(route.routes)); -// }); -// }); - -// test('route: in Monaco with custom limits on MLD', function(assert) { -// assert.plan(1); -// var osrm = new OSRM({ -// path: monaco_mld_path, -// algorithm: 'MLD', -// max_alternatives: 10, -// }); -// osrm.route({coordinates: two_test_coordinates, alternatives: 11}, function(err, route) { -// console.log(err) -// assert.equal(err.message, 'TooBig'); -// }); -// }); +test('route: routes Monaco with custom limits on MLD', function(assert) { + assert.plan(2); + var osrm = new OSRM({ + path: monaco_mld_path, + algorithm: 'MLD', + max_alternatives: 10, + }); + osrm.route({coordinates: two_test_coordinates, alternatives: 10}, function(err, route) { + assert.ifError(err); + assert.ok(Array.isArray(route.routes)); + }); +}); + +test('route: in Monaco with custom limits on MLD', function(assert) { + assert.plan(1); + var osrm = new OSRM({ + path: monaco_mld_path, + algorithm: 'MLD', + max_alternatives: 10, + }); + osrm.route({coordinates: two_test_coordinates, alternatives: 11}, function(err, route) { + console.log(err) + assert.equal(err.message, 'TooBig'); + }); +}); test('route: route in Monaco without motorways', function(assert) { assert.plan(3);