Cucumber test support for alternatives count parameter

This commit is contained in:
Lev Dragunov 2017-01-17 13:49:31 +03:00 committed by Patrick Niklaus
parent 5be6f8959a
commit 421d336b0f
3 changed files with 30 additions and 1 deletions

View File

@ -39,7 +39,8 @@ module.exports = function () {
duration = '',
annotation = '',
geometry = '',
OSMIDs = '';
OSMIDs = '',
alternatives = '';
if (res.statusCode === 200) {
@ -95,6 +96,10 @@ module.exports = function () {
if (json.matchings.length != 1) throw new Error('*** Checking geometry only supported for matchings with one subtrace');
geometry = json.matchings[0].geometry;
}
if (headers.has('alternatives')) {
alternatives = this.alternativesList(json);
}
}
if (headers.has('turns')) {
@ -137,6 +142,9 @@ module.exports = function () {
got['OSM IDs'] = OSMIDs;
}
if (headers.has('alternatives')) {
got['alternatives'] = alternatives;
}
var ok = true;
var encodedResult = '',
extendedTarget = '';

View File

@ -180,6 +180,11 @@ module.exports = function () {
return merged;
};
this.alternativesList = (instructions) => {
// alternatives_count come from tracepoints list
return instructions.tracepoints.map(t => t.alternatives_count.toString()).join(',');
};
this.lanesList = (instructions) => {
return this.extractInstructionList(instructions, instruction => {
if( 'lanes' in instruction.intersections[0] )

View File

@ -263,6 +263,22 @@ Feature: Basic Map Matching
| trace | matchings | geometry |
| abd | abd | 1,1,1,1.00009,1,1.00009,0.99991,1.00009 |
Scenario: Testbot - Matching alternatives count test
Given the node map
"""
a b c d e f
g h i
"""
And the ways
| nodes | oneway |
| abcdef | yes |
| dghi | yes |
When I match I should get
| trace | matchings | alternatives |
| abcdef | abcde | 1,1,1,1,2,2 |
Scenario: Testbot - Speed greater than speed threshhold
Given a grid size of 10 meters
Given the query options