From a0b55f9df3bd3491f5ff08baa2a8e6e0e18711a1 Mon Sep 17 00:00:00 2001 From: Emil Tin Date: Sat, 3 Jan 2015 11:12:27 +0100 Subject: [PATCH] table tests: use empty string to mean no route --- features/step_definitions/distance_matrix.rb | 3 +++ features/testbot/distance_matrix.feature | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/features/step_definitions/distance_matrix.rb b/features/step_definitions/distance_matrix.rb index 3d34c38dd..f85bdcc07 100644 --- a/features/step_definitions/distance_matrix.rb +++ b/features/step_definitions/distance_matrix.rb @@ -1,5 +1,6 @@ When /^I request a travel time matrix I should get$/ do |table| + no_route = 2147483647 # MAX_INT raise "*** Top-left cell of matrix table must be empty" unless table.headers[0]=="" @@ -36,6 +37,8 @@ When /^I request a travel time matrix I should get$/ do |table| 0.upto(nodes.size-1) do |i| if FuzzyMatch.match result[ri][i], row[i+1] result[ri][i] = row[i+1] + elsif row[i+1]=="" and result[ri][i]==no_route + result[ri][i] = "" else result[ri][i] = result[ri][i].to_s ok = false diff --git a/features/testbot/distance_matrix.feature b/features/testbot/distance_matrix.feature index dee9f92bf..bab32431e 100644 --- a/features/testbot/distance_matrix.feature +++ b/features/testbot/distance_matrix.feature @@ -70,7 +70,7 @@ Feature: Basic Distance Matrix | e | 200 | 100 | 0 | 100 | | f | 300 | 200 | 100 | 0 | - @todo + @x Scenario: Testbot - Travel time matrix of network with unroutable parts Given the node map | a | b | @@ -82,7 +82,7 @@ Feature: Basic Distance Matrix When I request a travel time matrix I should get | | a | b | | a | 0 | 100 | - | b | -1 | 0 | + | b | | 0 | Scenario: Testbot - Travel time matrix of network with oneways Given the node map