[geocode-glib/wip/hadess/nominatim-crasher: 2/2] tests: Add test for issue #5



commit b6794ac0c67a13d063c9296ab1d59e70393db1c4
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Mar 12 13:46:35 2019 +0100

    tests: Add test for issue #5

 geocode-glib/tests/geocode-glib.c                  | 8 +++++---
 geocode-glib/tests/nominatim-data-type-change.json | 1 +
 2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/geocode-glib/tests/geocode-glib.c b/geocode-glib/tests/geocode-glib.c
index ce26b3d..5da23e5 100644
--- a/geocode-glib/tests/geocode-glib.c
+++ b/geocode-glib/tests/geocode-glib.c
@@ -781,12 +781,14 @@ test_resolve_json (void)
        guint i;
        struct {
                const char *fname;
+               guint num_results;
                const char *error;
                const char *prop;
                const char *value;
        } tests[] = {
-               { "nominatim-area.json", NULL, "area", "Guildford Park" },
-               { "nominatim-no-results.json", "No matches found for request", NULL, NULL },
+               { "nominatim-area.json", 1, NULL, "area", "Guildford Park" },
+               { "nominatim-no-results.json", 1, "No matches found for request", NULL, NULL },
+               { "nominatim-data-type-change.json", 12, NULL, "osm_id", "335673748" },
        };
 
        for (i = 0; i < G_N_ELEMENTS (tests); i++) {
@@ -811,7 +813,7 @@ test_resolve_json (void)
                        g_assert_cmpstr (error->message, ==, tests[i].error);
                } else {
                         g_assert (list != NULL);
-                        g_assert_cmpint (g_list_length (list), ==, 1);
+                        g_assert_cmpint (g_list_length (list), ==, tests[i].num_results);
                }
 
                if (list == NULL) {
diff --git a/geocode-glib/tests/nominatim-data-type-change.json 
b/geocode-glib/tests/nominatim-data-type-change.json
new file mode 100644
index 0000000..2e68902
--- /dev/null
+++ b/geocode-glib/tests/nominatim-data-type-change.json
@@ -0,0 +1 @@
+[{"place_id":1484796,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. 
https://osm.org/copyright","osm_type":"node","osm_id":335673748,"boundingbox":["60.0684261","60.1084261","17.5353792","17.5753792"],"lat":"60.0884261","lon":"17.5553792","display_name":"Läby,
 Uppsala kommun, Uppsala län, Svealand, 74372, 
Sverige","place_rank":19,"category":"place","type":"village","importance":0.41732695533476405,"icon":"https://nominatim.openstreetmap.org/images/mapicons/poi_place_village.p.20.png","address":{"village":"Läby","county":"Uppsala
 kommun","state":"Uppsala 
län","postcode":"74372","country":"Sverige","country_code":"se"}},{"place_id":54443946,"licence":"Data © 
OpenStreetMap contributors, ODbL 1.0. 
https://osm.org/copyright","osm_type":"node","osm_id":4362794461,"boundingbox":["59.8285267","59.8685267","17.5027922","17.5427922"],"lat":"59.8485267","lon":"17.5227922","display_name":"Läby,
 Uppsala kommun, Uppsala län, Svealand, 75592, Sverige","place_rank":19,"categ
 ory":"pl
 
ace","type":"hamlet","importance":0.375,"icon":"https://nominatim.openstreetmap.org/images/mapicons/poi_place_village.p.20.png","address":{"hamlet":"Läby","county":"Uppsala
 kommun","state":"Uppsala 
län","postcode":"75592","country":"Sverige","country_code":"se"}},{"place_id":4523898,"licence":"Data © 
OpenStreetMap contributors, ODbL 1.0. 
https://osm.org/copyright","osm_type":"node","osm_id":488567113,"boundingbox":["49.600219","49.640219","14.803646","14.843646"],"lat":"49.620219","lon":"14.823646","display_name":"Laby,
 okres Benešov, Středočeský kraj, Střední Čechy, 25706, 
Tjeckien","place_rank":19,"category":"place","type":"hamlet","importance":0.275,"icon":"https://nominatim.openstreetmap.org/images/mapicons/poi_place_village.p.20.png","address":{"hamlet":"Laby","county":"okres
 Benešov","state":"Střední 
Čechy","postcode":"25706","country":"Tjeckien","country_code":"cz"}},{"place_id":61965574,"licence":"Data © 
OpenStreetMap contributors, ODbL 1.0. https://os
 m.org/co
 
pyright","osm_type":"node","osm_id":5054371008,"boundingbox":["48.5229788","48.5429788","3.4614936","3.4814936"],"lat":"48.5329788","lon":"3.4714936","display_name":"Laby,
 Saint-Nicolas-la-Chapelle, Nogent-sur-Seine, Aube, Grand Est, Metropolitan Frankrike, 10400, 
Frankrike","place_rank":20,"category":"place","type":"locality","importance":0.25,"icon":"https://nominatim.openstreetmap.org/images/mapicons/poi_place_village.p.20.png","address":{"locality":"Laby","village":"Saint-Nicolas-la-Chapelle","county":"Nogent-sur-Seine","state":"Grand
 Est","country":"Frankrike","postcode":"10400","country_code":"fr"}},{"place_id":678264,"licence":"Data © 
OpenStreetMap contributors, ODbL 1.0. 
https://osm.org/copyright","osm_type":"node","osm_id":253146579,"boundingbox":["59.1090262","59.1490262","11.3477701","11.3877701"],"lat":"59.1290262","lon":"11.3677701","display_name":"Låby,
 Rød, Halden, Østfold, 1781, Norge","place_rank":20,"category":"place","type":"suburb","importance":0.25,"
 icon":"h
 
ttps://nominatim.openstreetmap.org/images/mapicons/poi_place_village.p.20.png","address":{"suburb":"Låby","hamlet":"Rød","county":"Østfold","postcode":"1781","country":"Norge","country_code":"no"}},{"place_id":198278042,"licence":"Data
 © OpenStreetMap contributors, ODbL 1.0. 
https://osm.org/copyright","osm_type":"relation","osm_id":426449,"boundingbox":["49.6147714","49.6299627","14.8122181","14.8417143"],"lat":"49.6223386","lon":"14.8278537750364","display_name":"Laby,
 Zvěstov, okres Benešov, Středočeský kraj, Střední Čechy, 
Tjeckien","place_rank":20,"category":"boundary","type":"administrative","importance":0.25,"icon":"https://nominatim.openstreetmap.org/images/mapicons/poi_boundary_administrative.p.20.png","address":{"suburb":"Laby","village":"Zvěstov","county":"okres
 Benešov","state":"Střední 
Čechy","country":"Tjeckien","country_code":"cz"}},{"place_id":252565848,"licence":"Data © OpenStreetMap 
contributors, ODbL 1.0. https://osm.org/copyright","osm_ty
 pe":"nod
 
e","osm_id":6259990008,"boundingbox":["59.3303","59.3503","11.45645","11.47645"],"lat":"59.3403","lon":"11.46645","display_name":"Låby,
 Nakkjum, Rakkestad, Østfold, 1892, 
Norge","place_rank":20,"category":"place","type":"farm","importance":0.25,"address":{"farm":"Låby","hamlet":"Nakkjum","county":"Østfold","postcode":"1892","country":"Norge","country_code":"no"}},{"place_id":199085752,"licence":"Data
 © OpenStreetMap contributors, ODbL 1.0. 
https://osm.org/copyright","osm_type":"relation","osm_id":7535162,"boundingbox":["54.0451","54.04999","27.03332","27.04053"],"lat":"54.0479636","lon":"27.0380371","display_name":"Лабы,
 Раковский сельский Совет, Воложинский район, Минская область, 
Vitryssland","place_rank":20,"category":"boundary","type":"administrative","importance":0.25,"icon":"https://nominatim.openstreetmap.org/images/mapicons/poi_boundary_administrative.p.20.png","address":{"suburb":"Лабы","city":"Рак�
 �вск�
 �й сельский Совет","county":"Воложинский район","state":"Минская 
область","country":"Vitryssland","country_code":"by"}},{"place_id":26706407,"licence":"Data © OpenStreetMap 
contributors, ODbL 1.0. 
https://osm.org/copyright","osm_type":"node","osm_id":2586479869,"boundingbox":["59.848771","59.848871","17.5328345","17.5329345"],"lat":"59.848821","lon":"17.5328845","display_name":"Läby,
 72, Kvarnbolund, Kristineberg, Läby, Uppsala kommun, Uppsala län, Svealand, 75592, 
Sverige","place_rank":30,"category":"highway","type":"bus_stop","importance":0.101,"icon":"https://nominatim.openstreetmap.org/images/mapicons/transport_bus_stop2.p.20.png","address":{"bus_stop":"Läby","road":"72","neighbourhood":"Kvarnbolund","suburb":"Kristineberg","hamlet":"Läby","county":"Uppsala
 kommun","state":"Uppsala 
län","postcode":"75592","country":"Sverige","country_code":"se"}},{"place_id":26785299,"licence":"Data © 
OpenStreetMap contributors, ODbL 1.
 0. https
 
://osm.org/copyright","osm_type":"node","osm_id":2573658162,"boundingbox":["48.2139118","48.2140118","16.3295261","16.3296261"],"lat":"48.2139618","lon":"16.3295761","display_name":"Laby,
 Ottakringer Straße, KG Hernals, Ottakring, Wien, 1160, 
Österrike","place_rank":30,"category":"amenity","type":"cafe","importance":0.001,"icon":"https://nominatim.openstreetmap.org/images/mapicons/food_cafe.p.20.png","address":{"cafe":"Laby","road":"Ottakringer
 Straße","suburb":"KG 
Hernals","city_district":"Ottakring","state":"Wien","postcode":"1160","country":"Österrike","country_code":"at"}},{"place_id":5037437,"licence":"Data
 © OpenStreetMap contributors, ODbL 1.0. 
https://osm.org/copyright","osm_type":"node","osm_id":564100750,"boundingbox":["49.6242619","49.6243619","14.8187762","14.8188762"],"lat":"49.6243119","lon":"14.8188262","display_name":"Laby,
 01816, Bořkovice, Zvěstov, okres Benešov, Středočeský kraj, Střední Čechy, 25706, 
Tjeckien","place_rank":30,"category":"tou
 rism","t
 
ype":"information","importance":0.001,"icon":"https://nominatim.openstreetmap.org/images/mapicons/amenity_information.p.20.png","address":{"information":"Laby","road":"01816","suburb":"Bořkovice","village":"Zvěstov","county":"okres
 Benešov","state":"Střední 
Čechy","postcode":"25706","country":"Tjeckien","country_code":"cz"}},{"place_id":239522513,"licence":"Data © 
OpenStreetMap contributors, ODbL 1.0. 
https://osm.org/copyright","osm_type":"node","osm_id":5919537959,"boundingbox":["60.3183959","60.3184959","19.996537","19.996637"],"lat":"60.3184459","lon":"19.996587","display_name":"Laby,
 Saltviksvägen, Näs, Saltvik, Ålands landsbygd, Landskapet Åland, Regional State Agency Åland, Åland, 22320, 
Finland","place_rank":30,"category":"highway","type":"bus_stop","importance":0.001,"icon":"https://nominatim.openstreetmap.org/images/mapicons/transport_bus_stop2.p.20.png","address":{"bus_stop":"Laby","road":"Saltviksvägen","suburb":"Näs","village":"Saltvik","county":"�
 �land","
 state_district":"Regional State Agency 
Åland","state":"Åland","postcode":"22320","country":"Finland","country_code":"fi"}}]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]