add fuzzy match to table tests, add more tests

This commit is contained in:
Emil Tin
2015-01-01 20:19:41 +01:00
parent 593808f24d
commit 67f68b47db
2 changed files with 101 additions and 2 deletions
+15 -1
View File
@@ -30,8 +30,22 @@ When /^I request a travel time matrix I should get$/ do |table|
# compare actual and expected result, one row at a time
table.rows.each_with_index do |row,ri|
# fuzzy match
ok = true
0.upto(nodes.size-1) do |i|
if FuzzyMatch.match result[ri][i], row[i+1]
result[ri][i] = row[i+1]
else
result[ri][i] = result[ri][i].to_s
ok = false
end
end
# add row header
r = [row[0],result[ri]].flatten
r.map! { |v| v.to_s }
# store row for comparison
actual << r
end
end