diff --git a/descriptors/json_descriptor.hpp b/descriptors/json_descriptor.hpp index 4904e8527..eb5edbf4a 100644 --- a/descriptors/json_descriptor.hpp +++ b/descriptors/json_descriptor.hpp @@ -214,7 +214,7 @@ template class JSONDescriptor final : public BaseDescriptor< osrm::json::Array json_current_alt_instructions; if (config.instructions) { - json_alt_instructions = BuildTextualDescription(alternate_description_factory, alternative_path_segments); + json_current_alt_instructions = BuildTextualDescription(alternate_description_factory, alternative_path_segments); json_alt_instructions.values.push_back(json_current_alt_instructions); json_result.values["alternative_instructions"] = json_alt_instructions; } diff --git a/features/step_definitions/routing.rb b/features/step_definitions/routing.rb index 6a73d8604..21fcf489a 100644 --- a/features/step_definitions/routing.rb +++ b/features/step_definitions/routing.rb @@ -82,6 +82,10 @@ When /^I route I should get$/ do |table| end if table.headers.include? 'route' got['route'] = (instructions || '').strip + if table.headers.include?('alternative') + raise "*** No alternative found ***" unless json['found_alternative'] + got['alternative'] = way_list json['alternative_instructions'].first + end if table.headers.include?('distance') if row['distance']!='' raise "*** Distance must be specied in meters. (ex: 250m)" unless row['distance'] =~ /\d+m/ diff --git a/features/testbot/via.feature b/features/testbot/via.feature index a70ee9f7f..393e1d052 100644 --- a/features/testbot/via.feature +++ b/features/testbot/via.feature @@ -52,6 +52,31 @@ Feature: Via points | a,c,f | ab,bcd,bcd,de,efg | | a,c,f,h | ab,bcd,bcd,de,efg,efg,gh | + Scenario: Alternative via points + Given the node map + | | b | c | d | | | + | a | | | | | z | + | | g | h | i | j | | + + And the ways + | nodes | + | ab | + | bc | + | cd | + | dz | + | ag | + | gh | + | hi | + | ij | + | jz | + + And the query options + | alt | true | + + When I route I should get + | waypoints | route | alternative | + | a,z | ab,bc,cd,dz | ag,gh,hi,ij,jz | + Scenario: Duplicate via point Given the node map | x | | | | | | diff --git a/scripts/bisect_cucumber.sh b/scripts/bisect_cucumber.sh new file mode 100755 index 000000000..38c2b8c5e --- /dev/null +++ b/scripts/bisect_cucumber.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# Automates bisecting cucumber tests in a portable way; usage: +# +# git bisect start GOODGITSHA BADGITSHA +# git bisect run /path/to/bisect_cucumber.sh +# +# XXX: store this file outside source control first, e.g. by copying it over +# to /tmp, otherwise jumping through commits will change this script, too. + + +# e: exit on first error, x: print commands +set -ex + +BUILD_DIR=build + +cmake -E remove_directory $BUILD_DIR +cmake -E make_directory $BUILD_DIR +cmake -E chdir $BUILD_DIR cmake .. -DCMAKE_BUILD_TYPE=Release +cmake -E chdir $BUILD_DIR cmake --build . +cucumber -p verify + + +# notes on the return codes git bisect understands: +# - exit code 0 means okay +# - exit code 125 means skip this commit and try a commit nearby +# - every other exit code means bad