parent
ddb25cdf22
commit
7ff8428ad1
@ -365,7 +365,7 @@ install:
|
||||
script:
|
||||
- if [[ $TARGET_ARCH == armhf ]] ; then echo "Skip tests for $TARGET_ARCH" && exit 0 ; fi
|
||||
- make -C test/data benchmark
|
||||
# - ./example/build/osrm-example test/data/mld/monaco.osrm
|
||||
- ./example/build/osrm-example test/data/mld/monaco.osrm
|
||||
# All tests assume to be run from the build directory
|
||||
- pushd ${OSRM_BUILD_DIR}
|
||||
- ./unit_tests/library-tests
|
||||
|
@ -16,7 +16,7 @@ PROFILE:=$(PROFILE_ROOT)/car.lua
|
||||
|
||||
all: data
|
||||
|
||||
data: ch/$(DATA_NAME).osrm.hsgr corech/$(DATA_NAME).osrm.hsgr
|
||||
data: ch/$(DATA_NAME).osrm.hsgr corech/$(DATA_NAME).osrm.hsgr mld/$(DATA_NAME).osrm.partition
|
||||
|
||||
clean:
|
||||
-rm -r $(DATA_NAME).*
|
||||
@ -36,9 +36,9 @@ corech/$(DATA_NAME).osrm: $(DATA_NAME).osrm
|
||||
mkdir -p corech
|
||||
cp $(DATA_NAME).osrm $(DATA_NAME).osrm.* corech/
|
||||
|
||||
# mld/$(DATA_NAME).osrm: $(DATA_NAME).osrm
|
||||
# mkdir -p mld
|
||||
# cp $(DATA_NAME).osrm $(DATA_NAME).osrm.* mld/
|
||||
mld/$(DATA_NAME).osrm: $(DATA_NAME).osrm
|
||||
mkdir -p mld
|
||||
cp $(DATA_NAME).osrm $(DATA_NAME).osrm.* mld/
|
||||
|
||||
$(DATA_NAME).osrm: $(DATA_NAME).osm.pbf $(DATA_NAME).poly $(PROFILE) $(OSRM_EXTRACT)
|
||||
@echo "Verifiyng data file integrity..."
|
||||
@ -54,10 +54,10 @@ corech/$(DATA_NAME).osrm.hsgr: corech/$(DATA_NAME).osrm $(PROFILE) $(OSRM_CONTRA
|
||||
@echo "Running osrm-contract..."
|
||||
$(TIMER) "osrm-contract\t$@" $(OSRM_CONTRACT) --core=0.5 $<
|
||||
|
||||
# mld/$(DATA_NAME).osrm.partition: mld/$(DATA_NAME).osrm $(PROFILE) $(OSRM_PARTITION)
|
||||
# @echo "Running osrm-partition..."
|
||||
# $(TIMER) "osrm-partition\t$@" $(OSRM_PARTITION) $<
|
||||
# $(TIMER) "osrm-customize\t$@" $(OSRM_CUSTOMIZE) $<
|
||||
mld/$(DATA_NAME).osrm.partition: mld/$(DATA_NAME).osrm $(PROFILE) $(OSRM_PARTITION)
|
||||
@echo "Running osrm-partition..."
|
||||
$(TIMER) "osrm-partition\t$@" $(OSRM_PARTITION) $<
|
||||
$(TIMER) "osrm-customize\t$@" $(OSRM_CUSTOMIZE) $<
|
||||
|
||||
$(DATA_NAME).requests: $(DATA_NAME).poly
|
||||
$(POLY2REQ) $(DATA_NAME).poly > $(DATA_NAME).requests
|
||||
@ -74,11 +74,11 @@ benchmark: data $(DATA_NAME).requests
|
||||
$(TIMER) "queries\tCoreCH" "cat $(DATA_NAME).requests | xargs curl &> /dev/null"
|
||||
@cat osrm-routed.pid | xargs kill
|
||||
@rm osrm-routed.pid
|
||||
# @/bin/sh -c '$(OSRM_ROUTED) --algorithm=MLD mld/$(DATA_NAME).osrm > /dev/null & echo "$$!" > osrm-routed.pid'
|
||||
# @sleep 1
|
||||
# $(TIMER) "queries\tMLD" "cat $(DATA_NAME).requests | xargs curl &> /dev/null"
|
||||
# @cat osrm-routed.pid | xargs kill
|
||||
# @rm osrm-routed.pid
|
||||
@/bin/sh -c '$(OSRM_ROUTED) --algorithm=MLD mld/$(DATA_NAME).osrm > /dev/null & echo "$$!" > osrm-routed.pid'
|
||||
@sleep 1
|
||||
$(TIMER) "queries\tMLD" "cat $(DATA_NAME).requests | xargs curl &> /dev/null"
|
||||
@cat osrm-routed.pid | xargs kill
|
||||
@rm osrm-routed.pid
|
||||
@echo "**** timings ***"
|
||||
@cat /tmp/osrm.timings
|
||||
@echo "****************"
|
||||
|
@ -28,8 +28,8 @@ test('constructor: throws if necessary files do not exist', function(assert) {
|
||||
assert.throws(function() { new OSRM('missing.osrm'); },
|
||||
/Required files are missing, cannot continue/);
|
||||
|
||||
// assert.throws(function() { new OSRM({path: 'missing.osrm', algorithm: 'MLD'}); },
|
||||
// /Required files are missing, cannot continue/);
|
||||
assert.throws(function() { new OSRM({path: 'missing.osrm', algorithm: 'MLD'}); },
|
||||
/Required files are missing, cannot continue/);
|
||||
});
|
||||
|
||||
test('constructor: takes a shared memory argument', function(assert) {
|
||||
@ -74,11 +74,11 @@ test('constructor: throws if given an invalid algorithm', function(assert) {
|
||||
/algorithm option must be a string and one of 'CH', 'CoreCH', or 'MLD'/);
|
||||
});
|
||||
|
||||
// test('constructor: loads MLD if given as algorithm', function(assert) {
|
||||
// assert.plan(1);
|
||||
// var osrm = new OSRM({algorithm: 'MLD', path: monaco_mld_path});
|
||||
// assert.ok(osrm);
|
||||
// });
|
||||
test('constructor: loads MLD if given as algorithm', function(assert) {
|
||||
assert.plan(1);
|
||||
var osrm = new OSRM({algorithm: 'MLD', path: monaco_mld_path});
|
||||
assert.ok(osrm);
|
||||
});
|
||||
|
||||
test('constructor: loads CH if given as algorithm', function(assert) {
|
||||
assert.plan(1);
|
||||
@ -102,7 +102,7 @@ test('constructor: throws if data doesn\'t match algorithm', function(assert) {
|
||||
assert.plan(3);
|
||||
assert.throws(function() { new OSRM({algorithm: 'CoreCH', path: monaco_mld_path}); }, /Could not find any metrics for CH/, 'CoreCH with MLD data');
|
||||
assert.ok(new OSRM({algorithm: 'CoreCH', path: monaco_path}), 'CoreCH with CH data');
|
||||
// assert.throws(function() { new OSRM({algorithm: 'MLD', path: monaco_path}); }, /Could not find any metrics for MLD/, 'MLD with CH data');
|
||||
assert.throws(function() { new OSRM({algorithm: 'MLD', path: monaco_path}); }, /Could not find any metrics for MLD/, 'MLD with CH data');
|
||||
});
|
||||
|
||||
test('constructor: throws if dataset_name is not a string', function(assert) {
|
||||
@ -112,36 +112,36 @@ test('constructor: throws if dataset_name is not a string', function(assert) {
|
||||
assert.throws(function() { new OSRM({dataset_name: "unsued_name___", shared_memory: true}); }, /Could not find shared memory region/, 'Does not accept wrong name');
|
||||
});
|
||||
|
||||
// test('constructor: parses custom limits', function(assert) {
|
||||
// assert.plan(1);
|
||||
// var osrm = new OSRM({
|
||||
// path: monaco_mld_path,
|
||||
// algorithm: 'MLD',
|
||||
// max_locations_trip: 1,
|
||||
// max_locations_viaroute: 1,
|
||||
// max_locations_distance_table: 1,
|
||||
// max_locations_map_matching: 1,
|
||||
// max_results_nearest: 1,
|
||||
// max_alternatives: 1,
|
||||
// });
|
||||
// assert.ok(osrm);
|
||||
// });
|
||||
test('constructor: parses custom limits', function(assert) {
|
||||
assert.plan(1);
|
||||
var osrm = new OSRM({
|
||||
path: monaco_mld_path,
|
||||
algorithm: 'MLD',
|
||||
max_locations_trip: 1,
|
||||
max_locations_viaroute: 1,
|
||||
max_locations_distance_table: 1,
|
||||
max_locations_map_matching: 1,
|
||||
max_results_nearest: 1,
|
||||
max_alternatives: 1,
|
||||
});
|
||||
assert.ok(osrm);
|
||||
});
|
||||
|
||||
// test('constructor: throws on invalid custom limits', function(assert) {
|
||||
// assert.plan(1);
|
||||
// assert.throws(function() {
|
||||
// var osrm = new OSRM({
|
||||
// path: monaco_mld_path,
|
||||
// algorithm: 'MLD',
|
||||
// max_locations_trip: 'unlimited',
|
||||
// max_locations_viaroute: true,
|
||||
// max_locations_distance_table: false,
|
||||
// max_locations_map_matching: 'a lot',
|
||||
// max_results_nearest: null,
|
||||
// max_alternatives: '10'
|
||||
// })
|
||||
// });
|
||||
// });
|
||||
test('constructor: throws on invalid custom limits', function(assert) {
|
||||
assert.plan(1);
|
||||
assert.throws(function() {
|
||||
var osrm = new OSRM({
|
||||
path: monaco_mld_path,
|
||||
algorithm: 'MLD',
|
||||
max_locations_trip: 'unlimited',
|
||||
max_locations_viaroute: true,
|
||||
max_locations_distance_table: false,
|
||||
max_locations_map_matching: 'a lot',
|
||||
max_results_nearest: null,
|
||||
max_alternatives: '10'
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
require('./route.js');
|
||||
require('./trip.js');
|
||||
|
@ -247,29 +247,29 @@ test('match: throws on invalid tidy param', function(assert) {
|
||||
/tidy must be of type Boolean/);
|
||||
});
|
||||
|
||||
// test('match: throws on invalid config param', function(assert) {
|
||||
// assert.plan(1);
|
||||
// var osrm = new OSRM({path: mld_data_path, algorithm: 'MLD'});
|
||||
// var options = {
|
||||
// coordinates: three_test_coordinates,
|
||||
// };
|
||||
// assert.throws(function() { osrm.match(options, { format: 'invalid' }, function(err, response) {}) },
|
||||
// /format must be a string:/);
|
||||
// });
|
||||
test('match: throws on invalid config param', function(assert) {
|
||||
assert.plan(1);
|
||||
var osrm = new OSRM({path: mld_data_path, algorithm: 'MLD'});
|
||||
var options = {
|
||||
coordinates: three_test_coordinates,
|
||||
};
|
||||
assert.throws(function() { osrm.match(options, { format: 'invalid' }, function(err, response) {}) },
|
||||
/format must be a string:/);
|
||||
});
|
||||
|
||||
// test('match: match in Monaco without motorways', function(assert) {
|
||||
// assert.plan(3);
|
||||
// var osrm = new OSRM({path: mld_data_path, algorithm: 'MLD'});
|
||||
// var options = {
|
||||
// coordinates: three_test_coordinates,
|
||||
// exclude: ['motorway']
|
||||
// };
|
||||
// osrm.match(options, function(err, response) {
|
||||
// assert.ifError(err);
|
||||
// assert.equal(response.tracepoints.length, 3);
|
||||
// assert.equal(response.matchings.length, 1);
|
||||
// });
|
||||
// });
|
||||
test('match: match in Monaco without motorways', function(assert) {
|
||||
assert.plan(3);
|
||||
var osrm = new OSRM({path: mld_data_path, algorithm: 'MLD'});
|
||||
var options = {
|
||||
coordinates: three_test_coordinates,
|
||||
exclude: ['motorway']
|
||||
};
|
||||
osrm.match(options, function(err, response) {
|
||||
assert.ifError(err);
|
||||
assert.equal(response.tracepoints.length, 3);
|
||||
assert.equal(response.matchings.length, 1);
|
||||
});
|
||||
});
|
||||
|
||||
test('match: throws on invalid waypoints values needs at least two', function(assert) {
|
||||
assert.plan(1);
|
||||
|
@ -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,43 +566,43 @@ 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: 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: 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);
|
||||
// var osrm = new OSRM({path: monaco_mld_path, algorithm: 'MLD'});
|
||||
// var options = {
|
||||
// coordinates: two_test_coordinates,
|
||||
// exclude: ['motorway']
|
||||
// };
|
||||
// osrm.route(options, function(err, response) {
|
||||
// assert.ifError(err);
|
||||
// assert.equal(response.waypoints.length, 2);
|
||||
// assert.equal(response.routes.length, 1);
|
||||
// });
|
||||
// });
|
||||
test('route: route in Monaco without motorways', function(assert) {
|
||||
assert.plan(3);
|
||||
var osrm = new OSRM({path: monaco_mld_path, algorithm: 'MLD'});
|
||||
var options = {
|
||||
coordinates: two_test_coordinates,
|
||||
exclude: ['motorway']
|
||||
};
|
||||
osrm.route(options, function(err, response) {
|
||||
assert.ifError(err);
|
||||
assert.equal(response.waypoints.length, 2);
|
||||
assert.equal(response.routes.length, 1);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -233,17 +233,17 @@ tables.forEach(function(annotation) {
|
||||
});
|
||||
});
|
||||
|
||||
// test('table: ' + annotation + ' table in Monaco without motorways', function(assert) {
|
||||
// assert.plan(1);
|
||||
// var osrm = new OSRM({path: mld_data_path, algorithm: 'MLD'});
|
||||
// var options = {
|
||||
// coordinates: two_test_coordinates,
|
||||
// exclude: ['motorway'],
|
||||
// annotations: [annotation.slice(0,-1)]
|
||||
// };
|
||||
// osrm.table(options, function(err, response) {
|
||||
// assert.equal(response[annotation].length, 2);
|
||||
// });
|
||||
// });
|
||||
test('table: ' + annotation + ' table in Monaco without motorways', function(assert) {
|
||||
assert.plan(1);
|
||||
var osrm = new OSRM({path: mld_data_path, algorithm: 'MLD'});
|
||||
var options = {
|
||||
coordinates: two_test_coordinates,
|
||||
exclude: ['motorway'],
|
||||
annotations: [annotation.slice(0,-1)]
|
||||
};
|
||||
osrm.table(options, function(err, response) {
|
||||
assert.equal(response[annotation].length, 2);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -342,17 +342,17 @@ test('trip: fixed start and end combinations', function(assert) {
|
||||
assert.end();
|
||||
});
|
||||
|
||||
// test('trip: trip in Monaco without motorways', function(assert) {
|
||||
// assert.plan(3);
|
||||
// var osrm = new OSRM({path: mld_data_path, algorithm: 'MLD'});
|
||||
// var options = {
|
||||
// coordinates: two_test_coordinates,
|
||||
// exclude: ['motorway']
|
||||
// };
|
||||
// osrm.trip(options, function(err, response) {
|
||||
// assert.ifError(err);
|
||||
// assert.equal(response.waypoints.length, 2);
|
||||
// assert.equal(response.trips.length, 1);
|
||||
// });
|
||||
// });
|
||||
test('trip: trip in Monaco without motorways', function(assert) {
|
||||
assert.plan(3);
|
||||
var osrm = new OSRM({path: mld_data_path, algorithm: 'MLD'});
|
||||
var options = {
|
||||
coordinates: two_test_coordinates,
|
||||
exclude: ['motorway']
|
||||
};
|
||||
osrm.trip(options, function(err, response) {
|
||||
assert.ifError(err);
|
||||
assert.equal(response.waypoints.length, 2);
|
||||
assert.equal(response.trips.length, 1);
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user