add BDD tests for DB

This commit is contained in:
Sarah Hoffmann
2025-04-09 14:52:34 +02:00
parent 5f44aa2873
commit b34991d85f
33 changed files with 6095 additions and 46 deletions

View File

@@ -0,0 +1,320 @@
Feature: Searching of house numbers
Test for specialised treeatment of housenumbers
Background:
Given the grid
| 1 | | 2 | | 3 |
| | 9 | | | |
| | | | | 4 |
Scenario: A simple ascii digit housenumber is found
Given the places
| osm | class | type | housenr | geometry |
| N1 | building | yes | 45 | 9 |
And the places
| osm | class | type | name | geometry |
| W10 | highway | path | North Road | 1,2,3 |
When importing
And geocoding "45, North Road"
Then the result set contains
| object |
| N1 |
When geocoding "North Road 45"
Then the result set contains
| object |
| N1 |
Scenario Outline: Numeral housenumbers in any script are found
Given the places
| osm | class | type | housenr | geometry |
| N1 | building | yes | <number> | 9 |
And the places
| osm | class | type | name | geometry |
| W10 | highway | path | North Road | 1,2,3 |
When importing
And geocoding "45, North Road"
Then the result set contains
| object |
| N1 |
When geocoding "North Road "
Then the result set contains
| object |
| N1 |
When geocoding "North Road 𑁪𑁫"
Then the result set contains
| object |
| N1 |
Examples:
| number |
| 45 |
| |
| 𑁪𑁫 |
Scenario Outline: Each housenumber in a list is found
Given the places
| osm | class | type | housenr | geometry |
| N1 | building | yes | <hnrs> | 9 |
And the places
| osm | class | type | name | geometry |
| W10 | highway | path | Multistr | 1,2,3 |
When importing
When geocoding "2 Multistr"
Then the result set contains
| object |
| N1 |
When geocoding "4 Multistr"
Then the result set contains
| object |
| N1 |
When geocoding "12 Multistr"
Then the result set contains
| object |
| N1 |
Examples:
| hnrs |
| 2;4;12 |
| 2,4,12 |
| 2, 4, 12 |
Scenario Outline: Housenumber - letter combinations are found
Given the places
| osm | class | type | housenr | geometry |
| N1 | building | yes | <hnr> | 9 |
And the places
| osm | class | type | name | geometry |
| W10 | highway | path | Multistr | 1,2,3 |
When importing
When geocoding "2A Multistr"
Then the result set contains
| object |
| N1 |
When geocoding "2 a Multistr"
Then the result set contains
| object |
| N1 |
When geocoding "2-A Multistr"
Then the result set contains
| object |
| N1 |
When geocoding "Multistr 2 A"
Then the result set contains
| object |
| N1 |
Examples:
| hnr |
| 2a |
| 2 A |
| 2-a |
| 2/A |
Scenario Outline: Number - Number combinations as a housenumber are found
Given the places
| osm | class | type | housenr | geometry |
| N1 | building | yes | <hnr> | 9 |
And the places
| osm | class | type | name | geometry |
| W10 | highway | path | Chester St | 1,2,3 |
When importing
When geocoding "34-10 Chester St"
Then the result set contains
| object |
| N1 |
When geocoding "34/10 Chester St"
Then the result set contains
| object |
| N1 |
When geocoding "34 10 Chester St"
Then the result set contains
| object |
| N1 |
When geocoding "3410 Chester St"
Then the result set contains
| object |
| W10 |
Examples:
| hnr |
| 34-10 |
| 34 10 |
| 34/10 |
Scenario Outline: a bis housenumber is found
Given the places
| osm | class | type | housenr | geometry |
| N1 | building | yes | <hnr> | 9 |
And the places
| osm | class | type | name | geometry |
| W10 | highway | path | Rue Paris | 1,2,3 |
When importing
When geocoding "Rue Paris 45bis"
Then the result set contains
| object |
| N1 |
When geocoding "Rue Paris 45 BIS"
Then the result set contains
| object |
| N1 |
When geocoding "Rue Paris 45BIS"
Then the result set contains
| object |
| N1 |
When geocoding "Rue Paris 45 bis"
Then the result set contains
| object |
| N1 |
Examples:
| hnr |
| 45bis |
| 45BIS |
| 45 BIS |
| 45 bis |
Scenario Outline: a ter housenumber is found
Given the places
| osm | class | type | housenr | geometry |
| N1 | building | yes | <hnr> | 9 |
And the places
| osm | class | type | name | geometry |
| W10 | highway | path | Rue du Berger | 1,2,3 |
When importing
When geocoding "Rue du Berger 45ter"
Then the result set contains
| object |
| N1 |
When geocoding "Rue du Berger 45 TER"
Then the result set contains
| object |
| N1 |
When geocoding "Rue du Berger 45TER"
Then the result set contains
| object |
| N1 |
When geocoding "Rue du Berger 45 ter"
Then the result set contains
| object |
| N1 |
Examples:
| hnr |
| 45ter |
| 45TER |
| 45 ter |
| 45 TER |
Scenario Outline: a number - letter - number combination housenumber is found
Given the places
| osm | class | type | housenr | geometry |
| N1 | building | yes | <hnr> | 9 |
And the places
| osm | class | type | name | geometry |
| W10 | highway | path | Herengracht | 1,2,3 |
When importing
When geocoding "501-H 1 Herengracht"
Then the result set contains
| object |
| N1 |
When geocoding "501H-1 Herengracht"
Then the result set contains
| object |
| N1 |
When geocoding "501H1 Herengracht"
Then the result set contains
| object |
| N1 |
When geocoding "501-H1 Herengracht"
Then the result set contains
| object |
| N1 |
Examples:
| hnr |
| 501 H1 |
| 501H 1 |
| 501/H/1 |
| 501h1 |
Scenario Outline: Russian housenumbers are found
Given the places
| osm | class | type | housenr | geometry |
| N1 | building | yes | <hnr> | 9 |
And the places
| osm | class | type | name | geometry |
| W10 | highway | path | Голубинская улица | 1,2,3 |
When importing
When geocoding "Голубинская улица 55к3"
Then the result set contains
| object |
| N1 |
When geocoding "Голубинская улица 55 k3"
Then the result set contains
| object |
| N1 |
When geocoding "Голубинская улица 55 к-3"
Then the result set contains
| object |
| N1 |
Examples:
| hnr |
| 55к3 |
| 55 к3 |
Scenario: A name mapped as a housenumber is found
Given the places
| osm | class | type | housenr | geometry |
| N1 | building | yes | Warring | 9 |
And the places
| osm | class | type | name | geometry |
| W10 | highway | path | Chester St | 1,2,3 |
When importing
When geocoding "Chester St Warring"
Then the result set contains
| object |
| N1 |
Scenario: Interpolations are found according to their type
Given the grid
| 10 | | 11 |
| 100 | | 101 |
| 20 | | 21 |
And the places
| osm | class | type | name | geometry |
| W100 | highway | residential | Ringstr | 100, 101 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W10 | place | houses | even | 10, 11 |
| W20 | place | houses | odd | 20, 21 |
And the places
| osm | class | type | housenr | geometry |
| N10 | place | house | 10 | 10 |
| N11 | place | house | 20 | 11 |
| N20 | place | house | 11 | 20 |
| N21 | place | house | 21 | 21 |
And the ways
| id | nodes |
| 10 | 10, 11 |
| 20 | 20, 21 |
When importing
When geocoding "Ringstr 12"
Then the result set contains
| object |
| W10 |
When geocoding "Ringstr 13"
Then the result set contains
| object |
| W20 |

View File

@@ -0,0 +1,57 @@
Feature: Query of address interpolations
Tests that interpolated addresses can be queried correctly
Background:
Given the grid
| 1 | | 2 | | 3 |
| 10 | | 12 | | 13 |
| 7 | | 8 | | 9 |
Scenario: Find interpolations with single number
Given the places
| osm | class | type | name | geometry |
| W10 | highway | primary | Nickway | 10,12,13 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | odd | 1,3 |
And the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 1 | 1 |
| N3 | place | house | 5 | 3 |
And the ways
| id | nodes |
| 1 | 1,3 |
When importing
When reverse geocoding at node 2
Then the result contains
| display_name |
| 3, Nickway |
When geocoding "Nickway 3"
Then all results contain
| object | display_name |
| W1 | 3, Nickway |
Scenario: Find interpolations with multiple numbers
Given the places
| osm | class | type | name | geometry |
| W10 | highway | primary | Nickway | 10,12,13 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | even | 1,3 |
And the places
| osm | class | type | housenr | geometry |
| N1 | place | house | 2 | 1 |
| N3 | place | house | 18 | 3 |
And the ways
| id | nodes |
| 1 | 1,3 |
When importing
When reverse geocoding at node 2
Then the result contains
| display_name | centroid!wkt |
| 10, Nickway | 2 |
When geocoding "Nickway 10"
Then all results contain
| object | display_name | centroid!wkt |
| W1 | 10, Nickway | 2 |

View File

@@ -0,0 +1,28 @@
Feature: Searches in Japan
Test specifically for searches of Japanese addresses and in Japanese language.
Scenario: A block house-number is parented to the neighbourhood
Given the grid with origin JP
| 1 | | | | 2 |
| | 3 | | | |
| | | 9 | | |
| | | | 6 | |
And the places
| osm | class | type | name | geometry |
| W1 | highway | residential | | 1,2 |
And the places
| osm | class | type | housenr | addr+block_number | addr+neighbourhood | geometry |
| N3 | amenity | restaurant | 2 | 6 | 2 | 3 |
And the places
| osm | class | type | name | geometry |
| N9 | place | neighbourhood | 2 | 9 |
And the places
| osm | class | type | name | geometry |
| N6 | place | quarter | | 6 |
When importing
Then placex contains
| object | parent_place_id |
| N3 | N9 |
When geocoding "2 6-2"
Then all results contain
| object |
| N3 |

View File

@@ -0,0 +1,63 @@
Feature: Searching linked places
Tests that information from linked places can be searched correctly
Scenario: Additional names from linked places are searchable
Given the 0.1 grid
| 10 | | 11 |
| | 2 | |
| 13 | | 12 |
Given the places
| osm | class | type | admin | name | geometry |
| R13 | boundary | administrative | 6 | Garbo | (10,11,12,13,10) |
Given the places
| osm | class | type | admin | name+name:it |
| N2 | place | hamlet | 15 | Vario |
And the relations
| id | members | tags+type |
| 13 | N2:label | boundary |
When importing
Then placex contains
| object | linked_place_id |
| N2 | R13 |
When geocoding "Vario"
| namedetails |
| 1 |
Then all results contain
| object | display_name | namedetails!dict |
| R13 | Garbo | "name": "Garbo", "name:it": "Vario" |
When geocoding "Vario"
| accept-language |
| it |
Then all results contain
| object | display_name |
| R13 | Vario |
Scenario: Differing names from linked places are searchable
Given the 0.1 grid
| 10 | | 11 |
| | 2 | |
| 13 | | 12 |
Given the places
| osm | class | type | admin | name | geometry |
| R13 | boundary | administrative | 6 | Garbo | (10,11,12,13,10) |
Given the places
| osm | class | type | admin | name |
| N2 | place | hamlet | 15 | Vario |
And the relations
| id | members | tags+type |
| 13 | N2:label | boundary |
When importing
Then placex contains
| object | linked_place_id |
| N2 | R13 |
When geocoding "Vario"
| namedetails |
| 1 |
Then all results contain
| object | display_name | namedetails!dict |
| R13 | Garbo | "name": "Garbo", "_place_name": "Vario" |
When geocoding "Garbo"
Then all results contain
| object | display_name |
| R13 | Garbo |

View File

@@ -0,0 +1,225 @@
Feature: Import and search of names
Tests all naming related issues: normalisation,
abbreviations, internationalisation, etc.
Scenario: non-latin scripts can be found
Given the places
| osm | class | type | name |
| N1 | place | locality | Речицкий район |
| N2 | place | locality | Refugio de montaña |
| N3 | place | locality | |
| N4 | place | locality | الدوحة |
When importing
When geocoding "Речицкий район"
Then result 0 contains
| object |
| N1 |
When geocoding "Refugio de montaña"
Then result 0 contains
| object |
| N2 |
When geocoding ""
Then result 0 contains
| object |
| N3 |
When geocoding "الدوحة"
Then result 0 contains
| object |
| N4 |
Scenario: Case-insensitivity of search
Given the places
| osm | class | type | name |
| N1 | place | locality | FooBar |
When importing
Then placex contains
| object | class | type | name+name |
| N1 | place | locality | FooBar |
When geocoding "FooBar"
Then result 0 contains
| object |
| N1 |
When geocoding "foobar"
Then result 0 contains
| object |
| N1 |
When geocoding "fOObar"
Then result 0 contains
| object |
| N1 |
When geocoding "FOOBAR"
Then result 0 contains
| object |
| N1 |
Scenario: Multiple spaces in name
Given the places
| osm | class | type | name |
| N1 | place | locality | one two three |
When importing
When geocoding "one two three"
Then result 0 contains
| object |
| N1 |
When geocoding "one two three"
Then result 0 contains
| object |
| N1 |
When geocoding "one two three"
Then result 0 contains
| object |
| N1 |
When geocoding " one two three"
Then result 0 contains
| object |
| N1 |
Scenario: Special characters in name
Given the places
| osm | class | type | name+name:de |
| N1 | place | locality | Jim-Knopf-Straße |
| N2 | place | locality | Smith/Weston |
| N3 | place | locality | space mountain |
| N4 | place | locality | space |
| N5 | place | locality | mountain |
When importing
When geocoding "Jim-Knopf-Str"
Then result 0 contains
| object |
| N1 |
When geocoding "Jim Knopf-Str"
Then result 0 contains
| object |
| N1 |
When geocoding "Jim Knopf Str"
Then result 0 contains
| object |
| N1 |
When geocoding "Jim/Knopf-Str"
Then result 0 contains
| object |
| N1 |
When geocoding "Jim-Knopfstr"
Then result 0 contains
| object |
| N1 |
When geocoding "Smith/Weston"
Then result 0 contains
| object |
| N2 |
When geocoding "Smith Weston"
Then result 0 contains
| object |
| N2 |
When geocoding "Smith-Weston"
Then result 0 contains
| object |
| N2 |
When geocoding "space mountain"
Then result 0 contains
| object |
| N3 |
When geocoding "space-mountain"
Then result 0 contains
| object |
| N3 |
When geocoding "space/mountain"
Then result 0 contains
| object |
| N3 |
When geocoding "space\mountain"
Then result 0 contains
| object |
| N3 |
When geocoding "space(mountain)"
Then result 0 contains
| object |
| N3 |
Scenario: Landuse with name are found
Given the grid
| 1 | 2 |
| 3 | |
Given the places
| osm | class | type | name | geometry |
| R1 | natural | meadow | landuse1 | (1,2,3,1) |
| R2 | landuse | industrial | landuse2 | (2,3,1,2) |
When importing
When geocoding "landuse1"
Then result 0 contains
| object |
| R1 |
When geocoding "landuse2"
Then result 0 contains
| object |
| R2 |
Scenario: Postcode boundaries without ref
Given the grid with origin FR
| | 2 | |
| 1 | | 3 |
Given the places
| osm | class | type | postcode | geometry |
| R1 | boundary | postal_code | 123-45 | (1,2,3,1) |
When importing
When geocoding "123-45"
Then result 0 contains
| object |
| R1 |
Scenario Outline: Housenumbers with special characters are found
Given the grid
| 1 | | | | 2 |
| | | 9 | | |
And the places
| osm | class | type | name | geometry |
| W1 | highway | primary | Main St | 1,2 |
And the places
| osm | class | type | housenr | geometry |
| N1 | building | yes | <nr> | 9 |
When importing
And geocoding "Main St <nr>"
Then result 0 contains
| object | display_name |
| N1 | <nr>, Main St |
Examples:
| nr |
| 1 |
| 3456 |
| 1 a |
| 56b |
| 1 A |
| 2 |
| 1Б |
| 1 к1 |
| 23-123 |
Scenario Outline: Housenumbers in lists are found
Given the grid
| 1 | | | | 2 |
| | | 9 | | |
And the places
| osm | class | type | name | geometry |
| W1 | highway | primary | Main St | 1,2 |
And the places
| osm | class | type | housenr | geometry |
| N1 | building | yes | <nr-list> | 9 |
When importing
And geocoding "Main St <nr>"
Then result 0 contains
| object | display_name |
| N1 | <nr-list>, Main St |
Examples:
| nr-list | nr |
| 1,2,3 | 1 |
| 1,2,3 | 2 |
| 1, 2, 3 | 3 |
| 45 ;67;3 | 45 |
| 45 ;67;3 | 67 |
| 1a;1k | 1a |
| 1a;1k | 1k |
| 34/678 | 34 |
| 34/678 | 678 |
| 34/678 | 34/678 |

View File

@@ -0,0 +1,109 @@
Feature: Querying fo postcode variants
Scenario: Postcodes in Singapore (6-digit postcode)
Given the grid with origin SG
| 10 | | | | 11 |
And the places
| osm | class | type | name | addr+postcode | geometry |
| W1 | highway | path | Lorang | 399174 | 10,11 |
When importing
When geocoding "399174"
Then result 0 contains
| type | display_name |
| postcode | 399174, Singapore |
Scenario Outline: Postcodes in the Netherlands (mixed postcode with spaces)
Given the grid with origin NL
| 10 | | | | 11 |
And the places
| osm | class | type | name | addr+postcode | geometry |
| W1 | highway | path | De Weide | 3993 DX | 10,11 |
When importing
When geocoding "3993 DX"
Then result 0 contains
| type | display_name |
| postcode | 3993 DX, Nederland |
When geocoding "3993dx"
Then result 0 contains
| type | display_name |
| postcode | 3993 DX, Nederland |
Examples:
| postcode |
| 3993 DX |
| 3993DX |
| 3993 dx |
Scenario: Postcodes in Singapore (6-digit postcode)
Given the grid with origin SG
| 10 | | | | 11 |
And the places
| osm | class | type | name | addr+postcode | geometry |
| W1 | highway | path | Lorang | 399174 | 10,11 |
When importing
When geocoding "399174"
Then result 0 contains
| type | display_name |
| postcode | 399174, Singapore |
Scenario Outline: Postcodes in Andorra (with country code)
Given the grid with origin AD
| 10 | | | | 11 |
And the places
| osm | class | type | name | addr+postcode | geometry |
| W1 | highway | path | Lorang | <postcode> | 10,11 |
When importing
When geocoding "675"
Then result 0 contains
| type | display_name |
| postcode | AD675, Andorra |
When geocoding "AD675"
Then result 0 contains
| type | display_name |
| postcode | AD675, Andorra |
Examples:
| postcode |
| 675 |
| AD 675 |
| AD675 |
Scenario: Different postcodes with the same normalization can both be found
Given the places
| osm | class | type | addr+postcode | addr+housenumber | geometry |
| N34 | place | house | EH4 7EA | 111 | country:gb |
| N35 | place | house | E4 7EA | 111 | country:gb |
When importing
Then location_postcode contains exactly
| country_code | postcode | geometry!wkt |
| gb | EH4 7EA | country:gb |
| gb | E4 7EA | country:gb |
When geocoding "EH4 7EA"
Then result 0 contains
| type | display_name |
| postcode | EH4 7EA, United Kingdom |
When geocoding "E4 7EA"
Then result 0 contains
| type | display_name |
| postcode | E4 7EA, United Kingdom |
Scenario: Postcode areas are preferred over postcode points
Given the grid with origin DE
| 1 | 2 |
| 4 | 3 |
Given the places
| osm | class | type | postcode | geometry |
| R23 | boundary | postal_code | 12345 | (1,2,3,4,1) |
When importing
Then location_postcode contains exactly
| country_code | postcode |
| de | 12345 |
When geocoding "12345, de"
Then result 0 contains
| object |
| R23 |

View File

@@ -0,0 +1,21 @@
Feature: Reverse searches
Test results of reverse queries
Scenario: POI in POI area
Given the 0.0001 grid with origin 1,1
| 1 | | | | | | | | 2 |
| | 9 | | | | | | | |
| 4 | | | | | | | | 3 |
And the places
| osm | class | type | geometry |
| W1 | aeroway | terminal | (1,2,3,4,1) |
| N1 | amenity | restaurant | 9 |
When importing
And reverse geocoding 1.0001,1.0001
Then the result contains
| object |
| N1 |
When reverse geocoding 1.0003,1.0001
Then the result contains
| object |
| W1 |

View File

@@ -0,0 +1,84 @@
Feature: Searching of simple objects
Testing simple stuff
Scenario: Search for place node
Given the places
| osm | class | type | name+name | geometry |
| N1 | place | village | Foo | 10.0 -10.0 |
When importing
And geocoding "Foo"
Then result 0 contains
| object | category | type | centroid!wkt |
| N1 | place | village | 10 -10 |
# github #1763
Scenario: Correct translation of highways under construction
Given the grid
| 1 | | | | 2 |
| | | 9 | | |
And the places
| osm | class | type | name | geometry |
| W1 | highway | construction | The build | 1,2 |
| N1 | amenity | cafe | Bean | 9 |
When importing
And geocoding "Bean"
Then result 0 contains in field address
| amenity | road |
| Bean | The build |
Scenario: when missing housenumbers in search don't return a POI
Given the places
| osm | class | type | name |
| N3 | amenity | restaurant | Wood Street |
And the places
| osm | class | type | name | housenr |
| N20 | amenity | restaurant | Red Way | 34 |
When importing
And geocoding "Wood Street 45"
Then exactly 0 results are returned
When geocoding "Red Way 34"
Then all results contain
| object |
| N20 |
Scenario: when the housenumber is missing the street is still returned
Given the grid
| 1 | | 2 |
Given the places
| osm | class | type | name | geometry |
| W1 | highway | residential | Wood Street | 1, 2 |
When importing
And geocoding "Wood Street"
Then all results contain
| object |
| W1 |
Scenario Outline: Special cased american states will be found
Given the grid
| 1 | | 2 |
| | 10 | |
| 4 | | 3 |
Given the places
| osm | class | type | admin | name | name+ref | geometry |
| R1 | boundary | administrative | 4 | <state> | <ref> | (1,2,3,4,1) |
Given the places
| osm | class | type | name | geometry |
| N2 | place | town | <city> | 10 |
| N3 | place | city | <city> | country:ca |
When importing
And geocoding "<city>, <state>"
Then all results contain
| object |
| N2 |
When geocoding "<city>, <ref>"
| accept-language |
| en |
Then all results contain
| object |
| N2 |
Examples:
| city | state | ref |
| Chicago | Illinois | IL |
| Auburn | Alabama | AL |
| New Orleans | Louisiana | LA |