more test coverage
This commit is contained in:
parent
8575eef1c9
commit
5420d56ed5
@ -596,7 +596,6 @@ Feature: Basic Distance Matrix
|
|||||||
| e | 198.8 | 298.9 | 499 | 710.3 | 0 | 1592.8 |
|
| e | 198.8 | 298.9 | 499 | 710.3 | 0 | 1592.8 |
|
||||||
| f | 596.4 | 696.5 | 896.6 | 1107.9 | 397.6 | 0 |
|
| f | 596.4 | 696.5 | 896.6 | 1107.9 | 397.6 | 0 |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Testbot - Filling in noroutes with estimates (defaults to input coordinate location)
|
Scenario: Testbot - Filling in noroutes with estimates (defaults to input coordinate location)
|
||||||
Given a grid size of 300 meters
|
Given a grid size of 300 meters
|
||||||
Given the extract extra arguments "--small-component-size 4"
|
Given the extract extra arguments "--small-component-size 4"
|
||||||
@ -620,7 +619,18 @@ Feature: Basic Distance Matrix
|
|||||||
| f | 900.7 | 600.5 | 0 | 302.2 |
|
| f | 900.7 | 600.5 | 0 | 302.2 |
|
||||||
| 1 | 1501.1 | 1200.9 | 300.2 | 0 |
|
| 1 | 1501.1 | 1200.9 | 300.2 | 0 |
|
||||||
|
|
||||||
Scenario: Testbot - Filling in noroutes with estimates - use input coordinate
|
When I request a travel distance matrix I should get
|
||||||
|
| | a | b | f | 1 |
|
||||||
|
| a | 0 | 300.2 | 900.7 | 1501.1 |
|
||||||
|
|
||||||
|
When I request a travel distance matrix I should get
|
||||||
|
| | a |
|
||||||
|
| a | 0 |
|
||||||
|
| b | 300.2 |
|
||||||
|
| f | 900.7 |
|
||||||
|
| 1 | 1501.1 |
|
||||||
|
|
||||||
|
Scenario: Testbot - Fise input coordinate
|
||||||
Given a grid size of 300 meters
|
Given a grid size of 300 meters
|
||||||
Given the extract extra arguments "--small-component-size 4"
|
Given the extract extra arguments "--small-component-size 4"
|
||||||
Given the query options
|
Given the query options
|
||||||
@ -644,6 +654,18 @@ Feature: Basic Distance Matrix
|
|||||||
| f | 900.7 | 600.5 | 0 | 302.2 |
|
| f | 900.7 | 600.5 | 0 | 302.2 |
|
||||||
| 1 | 1501.1 | 1200.9 | 300.2 | 0 |
|
| 1 | 1501.1 | 1200.9 | 300.2 | 0 |
|
||||||
|
|
||||||
|
When I request a travel distance matrix I should get
|
||||||
|
| | a | b | f | 1 |
|
||||||
|
| a | 0 | 300.2 | 900.7 | 1501.1 |
|
||||||
|
|
||||||
|
When I request a travel distance matrix I should get
|
||||||
|
| | a |
|
||||||
|
| a | 0 |
|
||||||
|
| b | 300.2 |
|
||||||
|
| f | 900.7 |
|
||||||
|
| 1 | 1501.1 |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Testbot - Filling in noroutes with estimates - use snapped coordinate
|
Scenario: Testbot - Filling in noroutes with estimates - use snapped coordinate
|
||||||
Given a grid size of 300 meters
|
Given a grid size of 300 meters
|
||||||
Given the extract extra arguments "--small-component-size 4"
|
Given the extract extra arguments "--small-component-size 4"
|
||||||
@ -668,22 +690,9 @@ Feature: Basic Distance Matrix
|
|||||||
| f | 900.7 | 600.5 | 0 | 302.2 |
|
| f | 900.7 | 600.5 | 0 | 302.2 |
|
||||||
| 1 | 1200.9 | 900.7 | 300.2 | 0 |
|
| 1 | 1200.9 | 900.7 | 300.2 | 0 |
|
||||||
|
|
||||||
Scenario: Testbot - Asymetric fallback_speed - more sources than destinations
|
When I request a travel distance matrix I should get
|
||||||
Given a grid size of 300 meters
|
| | a | b | f | 1 |
|
||||||
Given the extract extra arguments "--small-component-size 4"
|
| a | 0 | 300.2 | 900.7 | 1200.9 |
|
||||||
Given the query options
|
|
||||||
| fallback_speed | 5 |
|
|
||||||
| fallback_coordinate | snapped |
|
|
||||||
Given the node map
|
|
||||||
"""
|
|
||||||
a b f h 1
|
|
||||||
d e g i
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes |
|
|
||||||
| abeda |
|
|
||||||
| fhigf |
|
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
When I request a travel distance matrix I should get
|
||||||
| | a |
|
| | a |
|
||||||
@ -692,23 +701,3 @@ Feature: Basic Distance Matrix
|
|||||||
| f | 900.7 |
|
| f | 900.7 |
|
||||||
| 1 | 1200.9 |
|
| 1 | 1200.9 |
|
||||||
|
|
||||||
Scenario: Testbot - Asymetric fallback_speed - more destinations than sources
|
|
||||||
Given a grid size of 300 meters
|
|
||||||
Given the extract extra arguments "--small-component-size 4"
|
|
||||||
Given the query options
|
|
||||||
| fallback_speed | 5 |
|
|
||||||
| fallback_coordinate | snapped |
|
|
||||||
Given the node map
|
|
||||||
"""
|
|
||||||
a b f h 1
|
|
||||||
d e g i
|
|
||||||
"""
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes |
|
|
||||||
| abeda |
|
|
||||||
| fhigf |
|
|
||||||
|
|
||||||
When I request a travel distance matrix I should get
|
|
||||||
| | a | b | f | 1 |
|
|
||||||
| a | 0 | 300.2 | 900.7 | 1200.9 |
|
|
||||||
|
|||||||
@ -534,6 +534,17 @@ Feature: Basic Duration Matrix
|
|||||||
| f | 18 | 12 | 0 | 30 |
|
| f | 18 | 12 | 0 | 30 |
|
||||||
| 1 | 30 | 24 | 30 | 0 |
|
| 1 | 30 | 24 | 30 | 0 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a | b | f | 1 |
|
||||||
|
| a | 0 | 30 | 18 | 30 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a |
|
||||||
|
| a | 0 |
|
||||||
|
| b | 30 |
|
||||||
|
| f | 18 |
|
||||||
|
| 1 | 30 |
|
||||||
|
|
||||||
Scenario: Testbot - Filling in noroutes with estimates - use input coordinate
|
Scenario: Testbot - Filling in noroutes with estimates - use input coordinate
|
||||||
Given a grid size of 300 meters
|
Given a grid size of 300 meters
|
||||||
Given the extract extra arguments "--small-component-size 4"
|
Given the extract extra arguments "--small-component-size 4"
|
||||||
@ -558,6 +569,17 @@ Feature: Basic Duration Matrix
|
|||||||
| f | 18 | 12 | 0 | 30 |
|
| f | 18 | 12 | 0 | 30 |
|
||||||
| 1 | 30 | 24 | 30 | 0 |
|
| 1 | 30 | 24 | 30 | 0 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a | b | f | 1 |
|
||||||
|
| a | 0 | 30 | 18 | 30 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a |
|
||||||
|
| a | 0 |
|
||||||
|
| b | 30 |
|
||||||
|
| f | 18 |
|
||||||
|
| 1 | 30 |
|
||||||
|
|
||||||
Scenario: Testbot - Filling in noroutes with estimates - use snapped coordinate
|
Scenario: Testbot - Filling in noroutes with estimates - use snapped coordinate
|
||||||
Given a grid size of 300 meters
|
Given a grid size of 300 meters
|
||||||
Given the extract extra arguments "--small-component-size 4"
|
Given the extract extra arguments "--small-component-size 4"
|
||||||
@ -582,25 +604,33 @@ Feature: Basic Duration Matrix
|
|||||||
| f | 18 | 12 | 0 | 30 |
|
| f | 18 | 12 | 0 | 30 |
|
||||||
| 1 | 24 | 18 | 30 | 0 |
|
| 1 | 24 | 18 | 30 | 0 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a | b | f | 1 |
|
||||||
|
| a | 0 | 30 | 18 | 24 |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a
|
||||||
|
| a | 0
|
||||||
|
| b | 30
|
||||||
|
| f | 18
|
||||||
|
| 1 | 24
|
||||||
|
|
||||||
|
|
||||||
Scenario: Testbot - Travel time matrix of minimal network with scale factor
|
Scenario: Testbot - Travel time matrix of minimal network with scale factor
|
||||||
Given the query options
|
Given the query options
|
||||||
| scale_factor | 2 |
|
| scale_factor | 2 |
|
||||||
|
Given the node map
|
||||||
Given the node map
|
|
||||||
"""
|
"""
|
||||||
a b
|
a b
|
||||||
"""
|
"""
|
||||||
|
And the ways
|
||||||
And the ways
|
|
||||||
| nodes |
|
| nodes |
|
||||||
| ab |
|
| ab |
|
||||||
|
When I request a travel time matrix I should get
|
||||||
When I request a travel time matrix I should get
|
|
||||||
| | a | b |
|
| | a | b |
|
||||||
| a | 0 | 20 |
|
| a | 0 | 20 |
|
||||||
| b | 20 | 0 |
|
| b | 20 | 0 |
|
||||||
|
Scenario: Testbot - Test fallback speeds and scale factor
|
||||||
Scenario: Testbot - Test fallback speeds and scale factor
|
|
||||||
Given a grid size of 300 meters
|
Given a grid size of 300 meters
|
||||||
Given the extract extra arguments "--small-component-size 4"
|
Given the extract extra arguments "--small-component-size 4"
|
||||||
Given the query options
|
Given the query options
|
||||||
@ -608,68 +638,67 @@ Feature: Basic Duration Matrix
|
|||||||
| fallback_speed | 5 |
|
| fallback_speed | 5 |
|
||||||
| fallback_coordinate | snapped |
|
| fallback_coordinate | snapped |
|
||||||
|
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
a b f h 1
|
a b f h 1
|
||||||
d e g i
|
d e g i
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes |
|
| nodes |
|
||||||
| abeda |
|
| abeda |
|
||||||
| fhigf |
|
| fhigf |
|
||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a | b | f | 1 |
|
| | a | b | f | 1 |
|
||||||
| a | 0 | 60 | 36 | 48 |
|
| a | 0 | 60 | 36 | 48 |
|
||||||
| b | 60 | 0 | 24 | 36 |
|
| b | 60 | 0 | 24 | 36 |
|
||||||
| f | 36 | 24 | 0 | 60 |
|
| f | 36 | 24 | 0 | 60 |
|
||||||
| 1 | 48 | 36 | 60 | 0 |
|
| 1 | 48 | 36 | 60 | 0 |
|
||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a | b | f | 1 |
|
| | a | b | f | 1 |
|
||||||
| a | 0 | 60 | 36 | 48 |
|
| a | 0 | 60 | 36 | 48 |
|
||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a |
|
| | a |
|
||||||
| a | 0 |
|
| a | 0 |
|
||||||
| b | 60 |
|
| b | 60 |
|
||||||
| f | 36 |
|
| f | 36 |
|
||||||
| 1 | 48 |
|
| 1 | 48 |
|
||||||
|
|
||||||
|
Scenario: Testbot - Travel time matrix of minimal network with overflow scale factor
|
||||||
Scenario: Testbot - Travel time matrix of minimal network with overflow scale factor
|
|
||||||
Given the query options
|
Given the query options
|
||||||
| scale_factor | 2147483647 |
|
| scale_factor | 2147483647 |
|
||||||
|
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
a b
|
a b
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes |
|
| nodes |
|
||||||
| ab |
|
| ab |
|
||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a | b |
|
| | a | b |
|
||||||
| a | 0 | 214748364.6 |
|
| a | 0 | 214748364.6 |
|
||||||
| b | 214748364.6 | 0 |
|
| b | 214748364.6 | 0 |
|
||||||
|
|
||||||
Scenario: Testbot - Travel time matrix of minimal network with fraction scale factor
|
Scenario: Testbot - Travel time matrix of minimal network with fraction scale factor
|
||||||
Given the query options
|
Given the query options
|
||||||
| scale_factor | 0.5 |
|
| scale_factor | 0.5 |
|
||||||
|
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
a b
|
a b
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes |
|
| nodes |
|
||||||
| ab |
|
| ab |
|
||||||
|
|
||||||
When I request a travel time matrix I should get
|
When I request a travel time matrix I should get
|
||||||
| | a | b |
|
| | a | b |
|
||||||
| a | 0 | 5 |
|
| a | 0 | 5 |
|
||||||
| b | 5 | 0 |
|
| b | 5 | 0 |
|
||||||
|
|||||||
@ -276,12 +276,9 @@ tables.forEach(function(annotation) {
|
|||||||
|
|
||||||
options.fallback_speed = 10;
|
options.fallback_speed = 10;
|
||||||
options.fallback_coordinate = 'bla';
|
options.fallback_coordinate = 'bla';
|
||||||
|
|
||||||
assert.throws(()=>osrm.table(options, (err, res) => {}), /fallback_coordinate' param must be one of \[input, snapped\]/, "should throw on invalid fallback_coordinate");
|
assert.throws(()=>osrm.table(options, (err, res) => {}), /fallback_coordinate' param must be one of \[input, snapped\]/, "should throw on invalid fallback_coordinate");
|
||||||
|
|
||||||
|
|
||||||
options.fallback_coordinate = 10;
|
options.fallback_coordinate = 10;
|
||||||
|
|
||||||
assert.throws(()=>osrm.table(options, (err, res) => {}), /fallback_coordinate must be a string: \[input, snapped\]/, "should throw on invalid fallback_coordinate");
|
assert.throws(()=>osrm.table(options, (err, res) => {}), /fallback_coordinate must be a string: \[input, snapped\]/, "should throw on invalid fallback_coordinate");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -91,6 +91,7 @@ BOOST_AUTO_TEST_CASE(invalid_table_urls)
|
|||||||
49UL);
|
49UL);
|
||||||
BOOST_CHECK_EQUAL(testInvalidOptions<TableParameters>("1,2;3,4?fallback_coordinate=asdf"),
|
BOOST_CHECK_EQUAL(testInvalidOptions<TableParameters>("1,2;3,4?fallback_coordinate=asdf"),
|
||||||
28UL);
|
28UL);
|
||||||
|
BOOST_CHECK_EQUAL(testInvalidOptions<TableParameters>("1,2;3,4?fallback_coordinate=10"), 28UL);
|
||||||
BOOST_CHECK_EQUAL(
|
BOOST_CHECK_EQUAL(
|
||||||
testInvalidOptions<TableParameters>("1,2;3,4?annotations=durations&scale_factor=-1"), 28UL);
|
testInvalidOptions<TableParameters>("1,2;3,4?annotations=durations&scale_factor=-1"), 28UL);
|
||||||
BOOST_CHECK_EQUAL(
|
BOOST_CHECK_EQUAL(
|
||||||
@ -580,31 +581,43 @@ BOOST_AUTO_TEST_CASE(valid_table_urls)
|
|||||||
CHECK_EQUAL_RANGE(reference_7.sources, result_7->sources);
|
CHECK_EQUAL_RANGE(reference_7.sources, result_7->sources);
|
||||||
CHECK_EQUAL_RANGE(reference_7.destinations, result_7->destinations);
|
CHECK_EQUAL_RANGE(reference_7.destinations, result_7->destinations);
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
auto result_8 = parseParameters<TableParameters>("1,2;3,4?sources=all&destinations=all&"
|
|
||||||
"annotations=duration&fallback_speed=1&"
|
|
||||||
"fallback_coordinate=snapped&scale_factor=2");
|
|
||||||
=======
|
|
||||||
TableParameters reference_8{};
|
TableParameters reference_8{};
|
||||||
reference_8.coordinates = coords_1;
|
reference_8.coordinates = coords_1;
|
||||||
auto result_8 =
|
auto result_8 =
|
||||||
parseParameters<TableParameters>("1,2;3,4?annotations=distance&fallback_speed=2.5");
|
parseParameters<TableParameters>("1,2;3,4?annotations=distance&fallback_speed=2.5");
|
||||||
>>>>>>> fix formatting
|
|
||||||
BOOST_CHECK(result_8);
|
BOOST_CHECK(result_8);
|
||||||
CHECK_EQUAL_RANGE(reference_1.sources, result_3->sources);
|
BOOST_CHECK_EQUAL(result_8->annotations & TableParameters::AnnotationsType::Distance, true);
|
||||||
CHECK_EQUAL_RANGE(reference_1.destinations, result_3->destinations);
|
CHECK_EQUAL_RANGE(reference_8.sources, result_8->sources);
|
||||||
CHECK_EQUAL_RANGE(reference_1.bearings, result_3->bearings);
|
CHECK_EQUAL_RANGE(reference_8.destinations, result_8->destinations);
|
||||||
CHECK_EQUAL_RANGE(reference_1.radiuses, result_3->radiuses);
|
|
||||||
CHECK_EQUAL_RANGE(reference_1.approaches, result_3->approaches);
|
|
||||||
CHECK_EQUAL_RANGE(reference_1.coordinates, result_3->coordinates);
|
|
||||||
|
|
||||||
TableParameters reference_9{};
|
TableParameters reference_9{};
|
||||||
reference_9.coordinates = coords_1;
|
reference_9.coordinates = coords_1;
|
||||||
auto result_9 = parseParameters<TableParameters>("1,2;3,4?annotations=distance&fallback_speed=2.5");
|
auto result_9 = parseParameters<TableParameters>(
|
||||||
|
"1,2;3,4?annotations=distance&fallback_speed=2.5&fallback_coordinate=input");
|
||||||
BOOST_CHECK(result_9);
|
BOOST_CHECK(result_9);
|
||||||
BOOST_CHECK_EQUAL(result_9->annotations & TableParameters::AnnotationsType::Distance, true);
|
BOOST_CHECK_EQUAL(result_9->annotations & TableParameters::AnnotationsType::Distance, true);
|
||||||
CHECK_EQUAL_RANGE(reference_9.sources, result_9->sources);
|
CHECK_EQUAL_RANGE(reference_9.sources, result_9->sources);
|
||||||
CHECK_EQUAL_RANGE(reference_9.destinations, result_9->destinations);
|
CHECK_EQUAL_RANGE(reference_9.destinations, result_9->destinations);
|
||||||
|
|
||||||
|
TableParameters reference_10{};
|
||||||
|
reference_10.coordinates = coords_1;
|
||||||
|
auto result_10 = parseParameters<TableParameters>(
|
||||||
|
"1,2;3,4?annotations=distance&fallback_speed=20&fallback_coordinate=snapped");
|
||||||
|
BOOST_CHECK(result_10);
|
||||||
|
BOOST_CHECK_EQUAL(result_10->annotations & TableParameters::AnnotationsType::Distance, true);
|
||||||
|
CHECK_EQUAL_RANGE(reference_10.sources, result_10->sources);
|
||||||
|
CHECK_EQUAL_RANGE(reference_10.destinations, result_10->destinations);
|
||||||
|
|
||||||
|
auto result_11 = parseParameters<TableParameters>("1,2;3,4?sources=all&destinations=all&"
|
||||||
|
"annotations=duration&fallback_speed=1&"
|
||||||
|
"fallback_coordinate=snapped&scale_factor=2");
|
||||||
|
BOOST_CHECK(result_11);
|
||||||
|
CHECK_EQUAL_RANGE(reference_1.sources, result_11->sources);
|
||||||
|
CHECK_EQUAL_RANGE(reference_1.destinations, result_11->destinations);
|
||||||
|
CHECK_EQUAL_RANGE(reference_1.bearings, result_11->bearings);
|
||||||
|
CHECK_EQUAL_RANGE(reference_1.radiuses, result_11->radiuses);
|
||||||
|
CHECK_EQUAL_RANGE(reference_1.approaches, result_11->approaches);
|
||||||
|
CHECK_EQUAL_RANGE(reference_1.coordinates, result_11->coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(valid_match_urls)
|
BOOST_AUTO_TEST_CASE(valid_match_urls)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user