X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/6d217da3b65be4f2973c536fd8fb0765e2a6e450..9f341430493cdaafb6ea9ce6ac29fc6af291d57c:/test/controllers/geocoder_controller_test.rb diff --git a/test/controllers/geocoder_controller_test.rb b/test/controllers/geocoder_controller_test.rb index 4d5d345c3..ac9905589 100644 --- a/test/controllers/geocoder_controller_test.rb +++ b/test/controllers/geocoder_controller_test.rb @@ -261,6 +261,17 @@ class GeocoderControllerTest < ActionDispatch::IntegrationTest end end + # + # Test identification of lat/lon pairs with mixed precision + def test_identify_latlon_ne_mixed_precision + latlon_check "N1 5 E15", 1.083333, 15 + latlon_check "N1 5 9 E15", 1.085833, 15 + latlon_check "N1 5 9 E1 5", 1.085833, 1.083333 + latlon_check "N15 E1 5", 15, 1.083333 + latlon_check "N15 E1 5 9", 15, 1.085833 + latlon_check "N1 5 E1 5 9", 1.083333, 1.085833 + end + # # Test identification of lat/lon pairs with values close to zero def test_identify_latlon_close_to_zero @@ -418,8 +429,8 @@ class GeocoderControllerTest < ActionDispatch::IntegrationTest assert_template :layout => "map" assert_equal %w[latlon osm_nominatim_reverse], assigns(:sources).pluck(:name) assert_nil @controller.params[:query] - assert_match(/^[+-]?\d+(?:\.\d*)?$/, @controller.params[:lat]) - assert_match(/^[+-]?\d+(?:\.\d*)?$/, @controller.params[:lon]) + assert_match(/^[+-]?\d+(?:\.\d+)?$/, @controller.params[:lat]) + assert_match(/^[+-]?\d+(?:\.\d+)?$/, @controller.params[:lon]) assert_in_delta lat, @controller.params[:lat].to_f assert_in_delta lon, @controller.params[:lon].to_f @@ -429,8 +440,8 @@ class GeocoderControllerTest < ActionDispatch::IntegrationTest assert_template :layout => "xhr" assert_equal %w[latlon osm_nominatim_reverse], assigns(:sources).pluck(:name) assert_nil @controller.params[:query] - assert_match(/^[+-]?\d+(?:\.\d*)?$/, @controller.params[:lat]) - assert_match(/^[+-]?\d+(?:\.\d*)?$/, @controller.params[:lon]) + assert_match(/^[+-]?\d+(?:\.\d+)?$/, @controller.params[:lat]) + assert_match(/^[+-]?\d+(?:\.\d+)?$/, @controller.params[:lon]) assert_in_delta lat, @controller.params[:lat].to_f assert_in_delta lon, @controller.params[:lon].to_f end