Sha256: 80089bc3f4e1e4f616d46d2a848124bba0444c8010572223283ad9271cacd6d1
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
require_relative '../lib/geo_swap' module GeoSwap describe GeoSwap do DATA = [ { lat: 29.979175, long: 31.1343583, utm: "36R 320010mE 3317942mN", }, { lat: 41.8901694, long: 12.4922694, utm: "33T 291952mE 4640622mN", } ] describe 'lat_long_to_utm' do def conversion(lat, long) GeoSwap.lat_long_to_utm(lat, long) end def check_error(lat, long, message) expect { conversion(lat, long) }. to raise_error(InputError, message) end it 'rejects data too close to the north pole' do check_error(84.1, 0.0, 'Conversions are unreliable close to the polar regions') end it 'rejects data too close to the south pole' do check_error(-80.1, 0.0, 'Conversions are unreliable close to the polar regions') end it 'rejects data outside the possible lat/long range' do check_error(0.0,200.0, 'Input coordinates are invalid') end it 'correctly converts several reference points' do DATA.each do |data| GeoSwap.lat_long_to_utm(data[:lat], data[:long]).to_s. should == data[:utm] end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geo_swap-0.1.0 | spec/geo_swap_spec.rb |