Skip to content

Commit

Permalink
Cucumner tests for data_version in matching
Browse files Browse the repository at this point in the history
  • Loading branch information
Lev Dragunov committed Mar 4, 2019
1 parent 4ddf739 commit 72d703b
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 11 deletions.
4 changes: 4 additions & 0 deletions features/step_definitions/matching.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ module.exports = function () {
got.duration = duration.toString();
}

if (headers.has('data_version')) {
got.data_version = json.data_version || '';
}

// if header matches 'a:*', parse out the values for *
// and return in that header
headers.forEach((k) => {
Expand Down
2 changes: 1 addition & 1 deletion features/testbot/distance_matrix.feature
Original file line number Diff line number Diff line change
Expand Up @@ -722,4 +722,4 @@ Feature: Basic Distance Matrix
When I request a travel distance matrix I should get
| | 1 | 2 |
| 1 | 0 | 1000.7 |
| 2 | 1000.7 | 0 |
| 2 | 1000.7 | 0 |
25 changes: 22 additions & 3 deletions features/testbot/matching.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,27 @@ Feature: Basic Map Matching
| abcd | no |

When I match I should get
| trace | timestamps | matchings |
| ab1d | 0 1 2 3 | ad |
| trace | timestamps | matchings | data_version |
| ab1d | 0 1 2 3 | ad | |

Scenario: Data_version test on matching
Given a grid size of 100 meters
Given the node map
"""
a b c d
1
"""

And the extract extra arguments "--data_version cucumber_data_version"

And the ways
| nodes | oneway |
| abcd | no |

When I match I should get
| trace | timestamps | matchings | data_version |
| ab1d | 0 1 2 3 | ad | cucumber_data_version |

Scenario: Testbot - Map matching with trace splitting
Given the node map
Expand Down Expand Up @@ -792,4 +811,4 @@ Feature: Basic Map Matching
When I match I should get
| trace | geometry | a:distance | a:duration | a:weight | duration |
| 2345 | 1.00018,1,1.000315,1 | 15.013264 | 1.5 | 1.5 | 1.5 |
| 4321 | 1.00027,1,1.000135,1 | 15.013264 | 1.5 | 1.5 | 1.5 |
| 4321 | 1.00027,1,1.000135,1 | 15.013264 | 1.5 | 1.5 | 1.5 |
32 changes: 26 additions & 6 deletions features/testbot/snap.feature
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,31 @@ Feature: Snap start/end point to the nearest way
| adb |

When I route I should get
| from | to | route |
| 1 | b | adb,adb |
| 2 | b | adb,adb |
| 6 | b | aub,aub |
| 7 | b | aub,aub |
| from | to | route | data_version |
| 1 | b | adb,adb | |
| 2 | b | adb,adb | |
| 6 | b | aub,aub | |
| 7 | b | aub,aub | |

Scenario: Data_version check on nearest
Given the node map
"""
4 5 6 7
3 a u
2
1 d b
"""

And the extract extra arguments "--data_version cucumber_data_version"

And the ways
| nodes |
| aub |
| adb |

When I route I should get
| from | to | route | data_version |
| 1 | b | adb,adb | cucumber_data_version |

Scenario: Snap to edge right under start/end point
Given the node map
Expand Down Expand Up @@ -182,4 +202,4 @@ Feature: Snap start/end point to the nearest way
| x | m | xe,xe |
| x | n | xf,xf |
| x | o | xg,xg |
| x | p | xh,xh |
| x | p | xh,xh |
2 changes: 1 addition & 1 deletion features/testbot/trip.feature
Original file line number Diff line number Diff line change
Expand Up @@ -370,4 +370,4 @@ Feature: Basic trip planning
When I plan a trip I should get
| waypoints | trips | durations | geometry |
| a,b,c,d | abcda | 7.6 | 1,1,1,1.00009,0.99991,1,1,1.00009,1,1,0.99991,1.00009,1,1 |
| d,b,c,a | dbcad | 7.6 | 0.99991,1.00009,1,1,1,1.00009,0.99991,1,1,1.00009,1,1,0.99991,1.00009 |
| d,b,c,a | dbcad | 7.6 | 0.99991,1.00009,1,1,1,1.00009,0.99991,1,1,1.00009,1,1,0.99991,1.00009 |

0 comments on commit 72d703b

Please sign in to comment.