make tests work
This commit is contained in:
parent
5961037dff
commit
2339f9ff95
@ -120,6 +120,9 @@ function setup()
|
|||||||
|
|
||||||
-- classes to support for exclude flags
|
-- classes to support for exclude flags
|
||||||
excludable = Sequence {
|
excludable = Sequence {
|
||||||
|
Set {'toll'},
|
||||||
|
Set {'motorway'},
|
||||||
|
Set {'ferry'}
|
||||||
},
|
},
|
||||||
|
|
||||||
avoid = Set {
|
avoid = Set {
|
||||||
|
|||||||
@ -121,7 +121,7 @@ void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
|
|||||||
{
|
{
|
||||||
query_heap.Insert(to, to_weight, {node, true, to_duration, to_distance});
|
query_heap.Insert(to, to_weight, {node, true, to_duration, to_distance});
|
||||||
}
|
}
|
||||||
else if (std::tie(to_weight, to_duration, node) <
|
else if (std::tie(to_weight, to_duration, to_distance, node) <
|
||||||
std::tie(query_heap.GetKey(to),
|
std::tie(query_heap.GetKey(to),
|
||||||
query_heap.GetData(to).duration,
|
query_heap.GetData(to).duration,
|
||||||
query_heap.GetData(to).distance,
|
query_heap.GetData(to).distance,
|
||||||
@ -168,10 +168,7 @@ void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
|
|||||||
// New Node discovered -> Add to Heap + Node Info Storage
|
// New Node discovered -> Add to Heap + Node Info Storage
|
||||||
if (!query_heap.WasInserted(to))
|
if (!query_heap.WasInserted(to))
|
||||||
{
|
{
|
||||||
query_heap.Insert(
|
query_heap.Insert(to, to_weight, {node, false, to_duration, to_distance});
|
||||||
to,
|
|
||||||
to_weight,
|
|
||||||
{node, false, to_duration, to_distance});
|
|
||||||
}
|
}
|
||||||
// Found a shorter Path -> Update weight and set new parent
|
// Found a shorter Path -> Update weight and set new parent
|
||||||
else if (std::tie(to_weight, to_duration, to_distance, node) <
|
else if (std::tie(to_weight, to_duration, to_distance, node) <
|
||||||
@ -833,7 +830,7 @@ manyToManySearch(SearchEngineData<Algorithm> &engine_working_data,
|
|||||||
const std::vector<PhantomNode> &phantom_nodes,
|
const std::vector<PhantomNode> &phantom_nodes,
|
||||||
const std::vector<std::size_t> &source_indices,
|
const std::vector<std::size_t> &source_indices,
|
||||||
const std::vector<std::size_t> &target_indices,
|
const std::vector<std::size_t> &target_indices,
|
||||||
const bool calculate_distance)
|
const bool /*calculate_distance*/)
|
||||||
{
|
{
|
||||||
const auto number_of_sources = source_indices.size();
|
const auto number_of_sources = source_indices.size();
|
||||||
const auto number_of_targets = target_indices.size();
|
const auto number_of_targets = target_indices.size();
|
||||||
@ -905,7 +902,8 @@ manyToManySearch(SearchEngineData<Algorithm> &engine_working_data,
|
|||||||
source_phantom);
|
source_phantom);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (calculate_distance)
|
// if (calculate_distance)
|
||||||
|
if (false)
|
||||||
{
|
{
|
||||||
distances_table.resize(number_of_entries, INVALID_EDGE_DISTANCE);
|
distances_table.resize(number_of_entries, INVALID_EDGE_DISTANCE);
|
||||||
calculateDistances<DIRECTION>(query_heap,
|
calculateDistances<DIRECTION>(query_heap,
|
||||||
|
|||||||
@ -19,17 +19,17 @@ test('route: routes Monaco', function(assert) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// test('route: routes Monaco on MLD', function(assert) {
|
test('route: routes Monaco on MLD', function(assert) {
|
||||||
// assert.plan(5);
|
assert.plan(5);
|
||||||
// var osrm = new OSRM({path: monaco_mld_path, algorithm: 'MLD'});
|
var osrm = new OSRM({path: monaco_mld_path, algorithm: 'MLD'});
|
||||||
// osrm.route({coordinates: [[13.43864,52.51993],[13.415852,52.513191]]}, function(err, route) {
|
osrm.route({coordinates: [[13.43864,52.51993],[13.415852,52.513191]]}, function(err, route) {
|
||||||
// assert.ifError(err);
|
assert.ifError(err);
|
||||||
// assert.ok(route.waypoints);
|
assert.ok(route.waypoints);
|
||||||
// assert.ok(route.routes);
|
assert.ok(route.routes);
|
||||||
// assert.ok(route.routes.length);
|
assert.ok(route.routes.length);
|
||||||
// assert.ok(route.routes[0].geometry);
|
assert.ok(route.routes[0].geometry);
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
|
|
||||||
test('route: routes Monaco on CoreCH', function(assert) {
|
test('route: routes Monaco on CoreCH', function(assert) {
|
||||||
assert.plan(5);
|
assert.plan(5);
|
||||||
@ -566,31 +566,31 @@ test('route: throws on bad approaches', function(assert) {
|
|||||||
/Approach must be a string: \[curb, unrestricted\] or null/);
|
/Approach must be a string: \[curb, unrestricted\] or null/);
|
||||||
});
|
});
|
||||||
|
|
||||||
// test('route: routes Monaco with custom limits on MLD', function(assert) {
|
test('route: routes Monaco with custom limits on MLD', function(assert) {
|
||||||
// assert.plan(2);
|
assert.plan(2);
|
||||||
// var osrm = new OSRM({
|
var osrm = new OSRM({
|
||||||
// path: monaco_mld_path,
|
path: monaco_mld_path,
|
||||||
// algorithm: 'MLD',
|
algorithm: 'MLD',
|
||||||
// max_alternatives: 10,
|
max_alternatives: 10,
|
||||||
// });
|
});
|
||||||
// osrm.route({coordinates: two_test_coordinates, alternatives: 10}, function(err, route) {
|
osrm.route({coordinates: two_test_coordinates, alternatives: 10}, function(err, route) {
|
||||||
// assert.ifError(err);
|
assert.ifError(err);
|
||||||
// assert.ok(Array.isArray(route.routes));
|
assert.ok(Array.isArray(route.routes));
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
|
|
||||||
// test('route: in Monaco with custom limits on MLD', function(assert) {
|
test('route: in Monaco with custom limits on MLD', function(assert) {
|
||||||
// assert.plan(1);
|
assert.plan(1);
|
||||||
// var osrm = new OSRM({
|
var osrm = new OSRM({
|
||||||
// path: monaco_mld_path,
|
path: monaco_mld_path,
|
||||||
// algorithm: 'MLD',
|
algorithm: 'MLD',
|
||||||
// max_alternatives: 10,
|
max_alternatives: 10,
|
||||||
// });
|
});
|
||||||
// osrm.route({coordinates: two_test_coordinates, alternatives: 11}, function(err, route) {
|
osrm.route({coordinates: two_test_coordinates, alternatives: 11}, function(err, route) {
|
||||||
// console.log(err)
|
console.log(err)
|
||||||
// assert.equal(err.message, 'TooBig');
|
assert.equal(err.message, 'TooBig');
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
|
|
||||||
test('route: route in Monaco without motorways', function(assert) {
|
test('route: route in Monaco without motorways', function(assert) {
|
||||||
assert.plan(3);
|
assert.plan(3);
|
||||||
|
|||||||
@ -27,6 +27,7 @@ auto makeGraph(const MultiLevelPartition &mlp, const std::vector<MockEdge> &mock
|
|||||||
{
|
{
|
||||||
EdgeWeight weight;
|
EdgeWeight weight;
|
||||||
EdgeDuration duration;
|
EdgeDuration duration;
|
||||||
|
EdgeDistance distance;
|
||||||
bool forward;
|
bool forward;
|
||||||
bool backward;
|
bool backward;
|
||||||
};
|
};
|
||||||
@ -36,8 +37,20 @@ auto makeGraph(const MultiLevelPartition &mlp, const std::vector<MockEdge> &mock
|
|||||||
for (const auto &m : mock_edges)
|
for (const auto &m : mock_edges)
|
||||||
{
|
{
|
||||||
max_id = std::max<std::size_t>(max_id, std::max(m.start, m.target));
|
max_id = std::max<std::size_t>(max_id, std::max(m.start, m.target));
|
||||||
edges.push_back(Edge{m.start, m.target, m.weight, 2 * m.weight, true, false});
|
edges.push_back(Edge{m.start,
|
||||||
edges.push_back(Edge{m.target, m.start, m.weight, 2 * m.weight, false, true});
|
m.target,
|
||||||
|
m.weight,
|
||||||
|
2 * m.weight,
|
||||||
|
static_cast<EdgeDistance>(1.0),
|
||||||
|
true,
|
||||||
|
false});
|
||||||
|
edges.push_back(Edge{m.target,
|
||||||
|
m.start,
|
||||||
|
m.weight,
|
||||||
|
2 * m.weight,
|
||||||
|
static_cast<EdgeDistance>(1.0),
|
||||||
|
false,
|
||||||
|
true});
|
||||||
}
|
}
|
||||||
std::sort(edges.begin(), edges.end());
|
std::sort(edges.begin(), edges.end());
|
||||||
return partitioner::MultiLevelGraph<EdgeData, osrm::storage::Ownership::Container>(
|
return partitioner::MultiLevelGraph<EdgeData, osrm::storage::Ownership::Container>(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user