Matrix times are on seconds now. Removing POST matrix tests
This commit is contained in:
parent
2f793473cc
commit
eba5f7d275
@ -43,14 +43,13 @@ module.exports = function () {
|
||||
if (err) return callback(err);
|
||||
if (!response.body.length) return callback(new Error('Invalid response body'));
|
||||
|
||||
var jsonResult = JSON.parse(response.body),
|
||||
result = jsonResult['distance_table'].map((row) => {
|
||||
var hashes = {};
|
||||
row.forEach((c, j) => {
|
||||
hashes[tableRows[0][j+1]] = c;
|
||||
});
|
||||
return hashes;
|
||||
});
|
||||
var json = JSON.parse(response.body);
|
||||
|
||||
var result = json['durations'].map(row => {
|
||||
var hashes = {};
|
||||
row.forEach((v, i) => hashes[tableRows[0][i+1]] = v);
|
||||
return hashes;
|
||||
});
|
||||
|
||||
var testRow = (row, ri, cb) => {
|
||||
var ok = true;
|
||||
|
@ -21,16 +21,9 @@ module.exports = function () {
|
||||
|
||||
var runRequest = (cb) => {
|
||||
var params = this.paramsToString(parameters);
|
||||
|
||||
this.query = baseUri + (params.length ? '/' + params : '');
|
||||
|
||||
var options = this.httpMethod === 'POST' ? {
|
||||
method: 'POST',
|
||||
body: params,
|
||||
url: baseUri
|
||||
} : this.query;
|
||||
|
||||
request(options, (err, res, body) => {
|
||||
request(this.query, (err, res, body) => {
|
||||
if (err && err.code === 'ECONNREFUSED') {
|
||||
throw new Error('*** osrm-routed is not running.');
|
||||
} else if (err && err.statusCode === 408) {
|
||||
|
@ -36,6 +36,7 @@ module.exports = function () {
|
||||
var json = JSON.parse(body);
|
||||
|
||||
var hasRoute = json.code === 'ok';
|
||||
//console.log(json.routes[0].legs[0].steps);
|
||||
|
||||
if (hasRoute) {
|
||||
instructions = this.wayList(json.routes[0]);
|
||||
|
@ -16,9 +16,9 @@ Feature: Basic Distance Matrix
|
||||
| ab |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a | b |
|
||||
| a | 0 | 100 |
|
||||
| b | 100 | 0 |
|
||||
| | a | b |
|
||||
| a | 0 | 10 |
|
||||
| b | 10 | 0 |
|
||||
|
||||
Scenario: Testbot - Travel time matrix with different way speeds
|
||||
Given the node map
|
||||
@ -31,11 +31,11 @@ Feature: Basic Distance Matrix
|
||||
| cd | tertiary |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a | b | c | d |
|
||||
| a | 0 | 100 | 300 | 600 |
|
||||
| b | 100 | 0 | 200 | 500 |
|
||||
| c | 300 | 200 | 0 | 300 |
|
||||
| d | 600 | 500 | 300 | 0 |
|
||||
| | a | b | c | d |
|
||||
| a | 0 | 10 | 30 | 60 |
|
||||
| b | 10 | 0 | 20 | 50 |
|
||||
| c | 30 | 20 | 0 | 30 |
|
||||
| d | 60 | 50 | 30 | 0 |
|
||||
|
||||
Scenario: Testbot - Travel time matrix with fuzzy match
|
||||
Given the node map
|
||||
@ -64,11 +64,11 @@ Feature: Basic Distance Matrix
|
||||
| cf |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a | b | e | f |
|
||||
| a | 0 | 100 | 200 | 300 |
|
||||
| b | 100 | 0 | 100 | 200 |
|
||||
| e | 200 | 100 | 0 | 100 |
|
||||
| f | 300 | 200 | 100 | 0 |
|
||||
| | a | b | e | f |
|
||||
| a | 0 | 10 | 20 | 30 |
|
||||
| b | 10 | 0 | 10 | 20 |
|
||||
| e | 20 | 10 | 0 | 10 |
|
||||
| f | 30 | 20 | 10 | 0 |
|
||||
|
||||
Scenario: Testbot - Travel time matrix of network with unroutable parts
|
||||
Given the node map
|
||||
@ -79,9 +79,9 @@ Feature: Basic Distance Matrix
|
||||
| ab | yes |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a | b |
|
||||
| a | 0 | 100 |
|
||||
| b | | 0 |
|
||||
| | a | b |
|
||||
| a | 0 | 10 |
|
||||
| b | | 0 |
|
||||
|
||||
Scenario: Testbot - Travel time matrix of network with oneways
|
||||
Given the node map
|
||||
@ -95,11 +95,11 @@ Feature: Basic Distance Matrix
|
||||
| by | |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | x | y | d | e |
|
||||
| x | 0 | 300 | 400 | 300 |
|
||||
| y | 500 | 0 | 300 | 200 |
|
||||
| d | 200 | 300 | 0 | 300 |
|
||||
| e | 300 | 400 | 100 | 0 |
|
||||
| | x | y | d | e |
|
||||
| x | 0 | 30 | 40 | 30 |
|
||||
| y | 50 | 0 | 30 | 20 |
|
||||
| d | 20 | 30 | 0 | 30 |
|
||||
| e | 30 | 40 | 10 | 0 |
|
||||
|
||||
Scenario: Testbot - Travel time matrix and with only one source
|
||||
Given the node map
|
||||
@ -115,8 +115,8 @@ Feature: Basic Distance Matrix
|
||||
| cf |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | a | b | e | f |
|
||||
| a | 0 | 100 | 200 | 300 |
|
||||
| | a | b | e | f |
|
||||
| a | 0 | 10 | 20 | 30 |
|
||||
|
||||
Scenario: Testbot - Travel time 3x2 matrix
|
||||
Given the node map
|
||||
@ -132,9 +132,9 @@ Feature: Basic Distance Matrix
|
||||
| cf |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | b | e | f |
|
||||
| a | 100 | 200 | 300 |
|
||||
| b | 0 | 100 | 200 |
|
||||
| | b | e | f |
|
||||
| a | 10 | 20 | 30 |
|
||||
| b | 0 | 10 | 20 |
|
||||
|
||||
Scenario: Testbot - All coordinates are from same small component
|
||||
Given a grid size of 300 meters
|
||||
@ -152,9 +152,9 @@ Feature: Basic Distance Matrix
|
||||
| fg |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | f | g |
|
||||
| f | 0 | 300 |
|
||||
| g | 300 | 0 |
|
||||
| | f | g |
|
||||
| f | 0 | 30 |
|
||||
| g | 30 | 0 |
|
||||
|
||||
Scenario: Testbot - Coordinates are from different small component and snap to big CC
|
||||
Given a grid size of 300 meters
|
||||
@ -173,11 +173,11 @@ Feature: Basic Distance Matrix
|
||||
| hi |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | f | g | h | i |
|
||||
| f | 0 | 300 | 0 | 300 |
|
||||
| g | 300 | 0 | 300 | 0 |
|
||||
| h | 0 | 300 | 0 | 300 |
|
||||
| i | 300 | 0 | 300 | 0 |
|
||||
| | f | g | h | i |
|
||||
| f | 0 | 30 | 0 | 30 |
|
||||
| g | 30 | 0 | 30 | 0 |
|
||||
| h | 0 | 30 | 0 | 30 |
|
||||
| i | 30 | 0 | 30 | 0 |
|
||||
|
||||
Scenario: Testbot - Travel time matrix with loops
|
||||
Given the node map
|
||||
@ -192,8 +192,8 @@ Feature: Basic Distance Matrix
|
||||
| da | yes |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | 1 | 2 | 3 | 4 |
|
||||
| 1 | 0 | 100 +-1 | 400 +-1 | 500 +-1 |
|
||||
| 2 | 700 +-1 | 0 | 300 +-1 | 400 +-1 |
|
||||
| 3 | 400 +-1 | 500 +-1 | 0 | 100 +-1 |
|
||||
| 4 | 300 +-1 | 400 +-1 | 700 +-1 | 0 |
|
||||
| | 1 | 2 | 3 | 4 |
|
||||
| 1 | 0 | 10 +-1 | 40 +-1 | 50 +-1 |
|
||||
| 2 | 70 +-1 | 0 | 30 +-1 | 40 +-1 |
|
||||
| 3 | 40 +-1 | 50 +-1 | 0 | 10 +-1 |
|
||||
| 4 | 30 +-1 | 40 +-1 | 70 +-1 | 0 |
|
||||
|
@ -1,83 +0,0 @@
|
||||
@post @testbot
|
||||
Feature: POST request
|
||||
|
||||
Background:
|
||||
Given the profile "testbot"
|
||||
And the HTTP method "POST"
|
||||
|
||||
Scenario: Testbot - viaroute POST request
|
||||
Given the node locations
|
||||
| node | lat | lon |
|
||||
| a | 55.68740 | 12.52430 |
|
||||
| b | 55.68745 | 12.52409 |
|
||||
| c | 55.68711 | 12.52383 |
|
||||
| x | -55.68740 | 12.52430 |
|
||||
| y | -55.68745 | 12.52409 |
|
||||
| z | -55.68711 | 12.52383 |
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
| xy |
|
||||
| yz |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | turns |
|
||||
| a | c | ab,bc | depart,straight,arrive |
|
||||
| c | a | bc,ab | depart,straight,arrive |
|
||||
| x | z | xy,yz | depart,straight,arrive |
|
||||
| z | x | yz,xy | depart,straight,arrive |
|
||||
|
||||
Scenario: Testbot - match POST request
|
||||
Given a grid size of 10 meters
|
||||
Given the node map
|
||||
| a | b | c | d |
|
||||
| e | f | g | h |
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| abcd | yes |
|
||||
| hgfe | yes |
|
||||
|
||||
When I match I should get
|
||||
| trace | matchings |
|
||||
| dcba | hgfe |
|
||||
|
||||
Scenario: Testbot - table POST request
|
||||
Given the node map
|
||||
| x | a | b | y |
|
||||
| | d | e | |
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| abeda | yes |
|
||||
| xa | |
|
||||
| by | |
|
||||
|
||||
When I request a travel time matrix I should get
|
||||
| | x | y | d | e |
|
||||
| x | 0 | 300 | 400 | 300 |
|
||||
| y | 500 | 0 | 300 | 200 |
|
||||
| d | 200 | 300 | 0 | 300 |
|
||||
| e | 300 | 400 | 100 | 0 |
|
||||
|
||||
Scenario: Testbot - nearest POST request
|
||||
Given the node locations
|
||||
| node | lat | lon |
|
||||
| a | -85 | -180 |
|
||||
| b | -85 | -160 |
|
||||
| c | -85 | -140 |
|
||||
| x | -84.999 | -180 |
|
||||
| y | -84.999 | -160 |
|
||||
| z | -84.999 | -140 |
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| abc |
|
||||
|
||||
When I request nearest I should get
|
||||
| in | out |
|
||||
| x | a |
|
||||
| y | b |
|
||||
| z | c |
|
Loading…
Reference in New Issue
Block a user