+-1m in distance tests, remove huge scale tests

This commit is contained in:
Emil Tin 2012-09-21 19:54:22 +02:00
parent 7e5d5a6d90
commit e36a517e86
3 changed files with 120 additions and 274 deletions

View File

@ -1,5 +1,81 @@
@routing @distance
Feature: Distance calculation
Scenario: 1m distances
Given a grid size of 1 meters
Given the node map
| a | b |
| | c |
And the ways
| nodes |
| abc |
When I route I should get
| from | to | route | distance |
| a | b | abc | 1 +-1 |
| b | a | abc | 1 +-1 |
| b | c | abc | 1 +-1 |
| c | b | abc | 1 +-1 |
| a | c | abc | 2 +-1 |
| c | a | abc | 2 +-1 |
Scenario: 10m distances
Given a grid size of 10 meters
Given the node map
| a | b |
| | c |
And the ways
| nodes |
| abc |
When I route I should get
| from | to | route | distance |
| a | b | abc | 10 +-1 |
| b | a | abc | 10 +-1 |
| b | c | abc | 10 +-1 |
| c | b | abc | 10 +-1 |
| a | c | abc | 20 +-1 |
| c | a | abc | 20 +-1 |
Scenario: 100m distances
Given a grid size of 100 meters
Given the node map
| a | b |
| | c |
And the ways
| nodes |
| abc |
When I route I should get
| from | to | route | distance |
| a | b | abc | 100 +-1 |
| b | a | abc | 100 +-1 |
| b | c | abc | 100 +-1 |
| c | b | abc | 100 +-1 |
| a | c | abc | 200 +-1 |
| c | a | abc | 200 +-1 |
Scenario: 1km distance
Given a grid size of 1000 meters
Given the node map
| a | b |
| | c |
And the ways
| nodes |
| abc |
When I route I should get
| from | to | route | distance |
| a | b | abc | 1000 +-1 |
| b | a | abc | 1000 +-1 |
| b | c | abc | 1000 +-1 |
| c | b | abc | 1000 +-1 |
| a | c | abc | 2000 +-1 |
| c | a | abc | 2000 +-1 |
Scenario: Distance of a winding south-north path
Given a grid size of 10 meters
@ -15,13 +91,13 @@ Feature: Distance calculation
When I route I should get
| from | to | route | distance |
| a | b | abcdefgh | 10 |
| a | c | abcdefgh | 20 |
| a | d | abcdefgh | 30 |
| a | e | abcdefgh | 40 |
| a | f | abcdefgh | 50 |
| a | g | abcdefgh | 60 |
| a | h | abcdefgh | 70 |
| a | b | abcdefgh | 10 +-1 |
| a | c | abcdefgh | 20 +-1 |
| a | d | abcdefgh | 30 +-1 |
| a | e | abcdefgh | 40 +-1 |
| a | f | abcdefgh | 50 +-1 |
| a | g | abcdefgh | 60 +-1 |
| a | h | abcdefgh | 70 +-1 |
Scenario: Distance of a winding east-west path
Given a grid size of 10 meters
@ -35,50 +111,13 @@ Feature: Distance calculation
When I route I should get
| from | to | route | distance |
| a | b | abcdefgh | 10 |
| a | c | abcdefgh | 20 |
| a | d | abcdefgh | 30 |
| a | e | abcdefgh | 40 |
| a | f | abcdefgh | 50 |
| a | g | abcdefgh | 60 |
| a | h | abcdefgh | 70 |
Scenario: Distances when traversing part of a way
Given a grid size of 100 meters
Given the node map
| a | 0 | 1 | 2 |
| 9 | | | 3 |
| 8 | | | 4 |
| 7 | 6 | 5 | b |
And the ways
| nodes |
| ab |
When I route I should get
| from | to | route | distance |
| a | 0 | ab | 70 |
| a | 1 | ab | 140 |
| a | 2 | ab | 210 |
| a | 3 | ab | 280 |
| a | 4 | ab | 350 |
| a | b | ab | 420 |
| a | 5 | ab | 350 |
| a | 6 | ab | 280 |
| a | 7 | ab | 210 |
| a | 8 | ab | 140 |
| a | 9 | ab | 70 |
| b | 5 | ab | 70 |
| b | 6 | ab | 140 |
| b | 7 | ab | 210 |
| b | 8 | ab | 280 |
| b | 9 | ab | 350 |
| b | a | ab | 420 |
| b | 0 | ab | 350 |
| b | 1 | ab | 280 |
| b | 2 | ab | 210 |
| b | 3 | ab | 140 |
| b | 4 | ab | 70 |
| a | b | abcdefgh | 10 +-1 |
| a | c | abcdefgh | 20 +-1 |
| a | d | abcdefgh | 30 +-1 |
| a | e | abcdefgh | 40 +-1 |
| a | f | abcdefgh | 50 +-1 |
| a | g | abcdefgh | 60 +-1 |
| a | h | abcdefgh | 70 +-1 |
Scenario: Geometric distances
Given a grid size of 1000 meters
@ -120,180 +159,27 @@ Feature: Distance calculation
When I route I should get
| from | to | route | distance |
| x | a | xa | 3000 |
| x | b | xb | 3160 |
| x | c | xc | 3610 |
| x | d | xd | 4240 |
| x | e | xe | 3610 |
| x | f | xf | 3160 |
| x | g | xg | 3000 |
| x | h | xh | 3160 |
| x | i | xi | 3610 |
| x | j | xj | 4240 |
| x | k | xk | 3610 |
| x | l | xl | 3160 |
| x | m | xm | 3000 |
| x | n | xn | 3160 |
| x | o | xo | 3610 |
| x | p | xp | 4240 |
| x | q | xq | 3610 |
| x | r | xr | 3160 |
| x | s | xs | 3000 |
| x | t | xt | 3160 |
| x | u | xu | 3610 |
| x | v | xv | 4240 |
| x | w | xw | 3610 |
| x | y | xy | 3160 |
Scenario: 1-10m distances
Given a grid size of 2 meters
Given the node map
| a | b | c | d | e | f |
And the ways
| nodes |
| abcdee |
When I route I should get
| from | to | route | distance |
| a | b | abcedf | 2 |
| a | c | abcedf | 4 |
| a | d | abcedf | 6 |
| a | e | abcedf | 8 |
| a | f | abcedf | 10 |
Scenario: 1m distances
Given a grid size of 1 meters
Given the node map
| a | b |
| | c |
And the ways
| nodes |
| abc |
When I route I should get
| from | to | route | distance |
| a | b | abc | 1 |
| b | a | abc | 1 |
| b | c | abc | 1 |
| c | b | abc | 1 |
| a | c | abc | 2 |
| c | a | abc | 2 |
Scenario: 10m distances
Given a grid size of 10 meters
Given the node map
| a | b |
| | c |
And the ways
| nodes |
| abc |
When I route I should get
| from | to | route | distance |
| a | b | abc | 10 |
| b | a | abc | 10 |
| b | c | abc | 10 |
| c | b | abc | 10 |
| a | c | abc | 20 |
| c | a | abc | 20 |
Scenario: 100m distances
Given a grid size of 100 meters
Given the node map
| a | b |
| | c |
And the ways
| nodes |
| abc |
When I route I should get
| from | to | route | distance |
| a | b | abc | 100 |
| b | a | abc | 100 |
| b | c | abc | 100 |
| c | b | abc | 100 |
| a | c | abc | 200 |
| c | a | abc | 200 |
Scenario: 1km distance
Given a grid size of 1000 meters
Given the node map
| a | b |
| | c |
And the ways
| nodes |
| abc |
When I route I should get
| from | to | route | distance |
| a | b | abc | 1000 ~0.01% |
| b | a | abc | 1000 ~0.01% |
| b | c | abc | 1000 ~0.01% |
| c | b | abc | 1000 ~0.01% |
| a | c | abc | 2000 ~0.01% |
| c | a | abc | 2000 ~0.01% |
Scenario: 10km distances
Given a grid size of 10000 meters
Given the node map
| a | b |
| | c |
And the ways
| nodes |
| abc |
When I route I should get
| from | to | route | distance |
| a | b | abc | 10000 ~0.01% |
| b | a | abc | 10000 ~0.01% |
| b | c | abc | 10000 ~0.01% |
| c | b | abc | 10000 ~0.01% |
| a | c | abc | 20000 ~0.01% |
| c | a | abc | 20000 ~0.01% |
Scenario: 100km distances
Given a grid size of 100000 meters
Given the node map
| a | b |
| | c |
And the ways
| nodes |
| abc |
When I route I should get
| from | to | route | distance |
| a | b | abc | 100000 ~0.01% |
| b | a | abc | 100000 ~0.01% |
| b | c | abc | 100000 ~0.01% |
| c | b | abc | 100000 ~0.01% |
| a | c | abc | 200000 ~0.01% |
| c | a | abc | 200000 ~0.01% |
Scenario: Angles at 1000km scale
Given a grid size of 1000 meters
Given the node map
| | | | b | | | |
| | | | | | | c |
| a | | | | | | |
| | | | e | | | |
| | | | | | | f |
| d | | | | | | |
And the ways
| nodes |
| ba |
| bc |
| ed |
| ef |
When I route I should get
| from | to | route | distance |
| b | c | bc | 3160 |
| e | f | ef | 3160 |
| x | a | xa | 3000 +-1 |
| x | b | xb | 3160 +-1 |
| x | c | xc | 3610 +-1 |
| x | d | xd | 4240 +-1 |
| x | e | xe | 3610 +-1 |
| x | f | xf | 3160 +-1 |
| x | g | xg | 3000 +-1 |
| x | h | xh | 3160 +-1 |
| x | i | xi | 3610 +-1 |
| x | j | xj | 4240 +-1 |
| x | k | xk | 3610 +-1 |
| x | l | xl | 3160 +-1 |
| x | m | xm | 3000 +-1 |
| x | n | xn | 3160 +-1 |
| x | o | xo | 3610 +-1 |
| x | p | xp | 4240 +-1 |
| x | q | xq | 3610 +-1 |
| x | r | xr | 3160 +-1 |
| x | s | xs | 3000 +-1 |
| x | t | xt | 3160 +-1 |
| x | u | xu | 3610 +-1 |
| x | v | xv | 4240 +-1 |
| x | w | xw | 3610 +-1 |
| x | y | xy | 3160 +-1 |

View File

@ -14,10 +14,13 @@ DEFAULT_SPEEDPROFILE = 'bicycle'
WAY_SPACING = 100
DEFAULT_GRID_SIZE = 100 #meters
ORIGIN = [12,55]
ORIGIN = [0,0]
def set_grid_size meters
@zoom = 0.001*(meters.to_f/111.21)
def set_grid_size meters
#the constant is calculated (with BigDecimal as: 1.0/(DEG_TO_RAD*EARTH_RADIUS_IN_METERS
#see ApproximateDistance() in ExtractorStructs.h
#it's only accurate when measuring along the equator, or going exactly north-south
@zoom = meters.to_f*0.8990679362704610899694577444566908445396483347536032203503E-5
end
def build_ways_from_table table

View File

@ -1,43 +0,0 @@
@uturn @routing
Feature: Routing related to u-turns.
Scenario: Don't add u-turns when not needed.
Given the node map
| a | b | c | d | e | f |
And the ways
| nodes |
| abcdef |
When I route I should get
| from | to | route | compass | bearing |
| a | b | abcdef | E | 90 |
| a | c | abcdef | E | 90 |
| a | d | abcdef | E | 90 |
| a | e | abcdef | E | 90 |
| a | f | abcdef | E | 90 |
| b | a | abcdef | W | 270 |
| b | c | abcdef | E | 90 |
| b | d | abcdef | E | 90 |
| b | e | abcdef | E | 90 |
| b | f | abcdef | E | 90 |
| c | a | abcdef | W | 90 |
| c | b | abcdef | W | 270 |
| c | d | abcdef | E | 90 |
| c | e | abcdef | E | 90 |
| c | f | abcdef | E | 90 |
| d | a | abcdef | W | 270 |
| d | b | abcdef | W | 270 |
| d | c | abcdef | W | 270 |
| d | e | abcdef | E | 90 |
| d | f | abcdef | E | 90 |
| e | a | abcdef | W | 270 |
| e | b | abcdef | W | 270 |
| e | c | abcdef | W | 270 |
| e | d | abcdef | W | 270 |
| e | f | abcdef | E | 90 |
| f | a | abcdef | W | 270 |
| f | b | abcdef | W | 270 |
| f | c | abcdef | W | 270 |
| f | d | abcdef | W | 270 |
| f | e | abcdef | W | 270 |