X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/392d3d12264c83d7ab03d34471792476fac31cf6..7d4cc85a312cb79fd1c4b0f22626722bea1d736d:/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