Skip to content
Snippets Groups Projects
Commit 078733d2 authored by Alex Reisner's avatar Alex Reisner
Browse files

Add test to catch regression in v1.4.1.

parent 4c6bebcf
No related branches found
No related tags found
No related merge requests found
......@@ -161,14 +161,21 @@ class CalculationsTest < GeocoderTestCase
assert_equal l.bearing_from([50,-86.1]), l.bearing_to([50,-86.1]) - 180
end
def test_extract_coordinates
coords = [-23,47]
def test_extract_coordinates_when_integers
coords = [-23, 47]
l = PlaceReverseGeocoded.new("Madagascar", coords[0], coords[1])
assert_equal coords, Geocoder::Calculations.extract_coordinates(l)
assert_equal coords, Geocoder::Calculations.extract_coordinates(coords)
assert_equal coords.map(&:to_f), Geocoder::Calculations.extract_coordinates(l)
assert_equal coords.map(&:to_f), Geocoder::Calculations.extract_coordinates(coords)
end
def test_extract_nan_coordinates
def test_extract_coordinates_when_strings
coords = ["-23.1", "47.2"]
l = PlaceReverseGeocoded.new("Madagascar", coords[0], coords[1])
assert_equal coords.map(&:to_f), Geocoder::Calculations.extract_coordinates(l)
assert_equal coords.map(&:to_f), Geocoder::Calculations.extract_coordinates(coords)
end
def test_extract_coordinates_when_nan
result = Geocoder::Calculations.extract_coordinates([ nil, nil ])
assert_nan_coordinates?(result)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment