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
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
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