Make tests/code compatibile with ruby 1.9.3
parent
7cf19bfd70
commit
2d665f2625
|
@ -60,11 +60,11 @@ module GPX
|
||||||
|
|
||||||
# Takes the name of a magellan file, converts the contents to GPX, and
|
# Takes the name of a magellan file, converts the contents to GPX, and
|
||||||
# writes the result to gpx_filename.
|
# writes the result to gpx_filename.
|
||||||
def convert_to_gpx(magellan_filename, gpx_filename)
|
def convert_to_gpx(magellan_filename, gpx_filename)
|
||||||
|
|
||||||
segment = Segment.new
|
segment = Segment.new
|
||||||
|
|
||||||
CSV.open(magellan_filename, "r") do |row|
|
CSV.open(magellan_filename, "r").each do |row|
|
||||||
next if(row.size < 10 or row[INVALID_FLAG] == 'V')
|
next if(row.size < 10 or row[INVALID_FLAG] == 'V')
|
||||||
|
|
||||||
lat_deg = row[LAT][0..1]
|
lat_deg = row[LAT][0..1]
|
||||||
|
|
|
@ -12,11 +12,11 @@ class SegmentTest < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_segment_read
|
def test_segment_read
|
||||||
assert_equal(189, @segment.points.size)
|
assert_equal(189, @segment.points.size)
|
||||||
assert_equal("Fri Apr 07 18:12:05 UTC 2006", @segment.earliest_point.time.to_s)
|
assert_equal(1144433525, @segment.earliest_point.time.to_i)
|
||||||
assert_equal("Fri Apr 07 19:26:31 UTC 2006", @segment.latest_point.time.to_s)
|
assert_equal(1144437991, @segment.latest_point.time.to_i)
|
||||||
assert_equal(1334.447, @segment.lowest_point.elevation)
|
assert_equal(1334.447, @segment.lowest_point.elevation)
|
||||||
assert_equal(1480.087, @segment.highest_point.elevation)
|
assert_equal(1480.087, @segment.highest_point.elevation)
|
||||||
assert_equal("6.98803359528853", @segment.distance.to_s)
|
assert_in_delta(6.98803359528853, @segment.distance, 0.001)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_segment_crop
|
def test_segment_crop
|
||||||
|
@ -27,9 +27,9 @@ class SegmentTest < Test::Unit::TestCase
|
||||||
@segment.crop(crop_rectangle)
|
@segment.crop(crop_rectangle)
|
||||||
|
|
||||||
assert_equal(106, @segment.points.size)
|
assert_equal(106, @segment.points.size)
|
||||||
assert_equal("4.11422061733046", @segment.distance.to_s)
|
assert_in_delta(4.11422061733046, @segment.distance, 0.001)
|
||||||
assert_equal("Fri Apr 07 18:37:21 UTC 2006", @segment.earliest_point.time.to_s)
|
assert_equal(1144435041, @segment.earliest_point.time.to_i)
|
||||||
assert_equal("Fri Apr 07 19:22:32 UTC 2006", @segment.latest_point.time.to_s)
|
assert_equal(1144437752, @segment.latest_point.time.to_i)
|
||||||
assert_equal(1407.027, @segment.lowest_point.elevation)
|
assert_equal(1407.027, @segment.lowest_point.elevation)
|
||||||
assert_equal(1480.087, @segment.highest_point.elevation)
|
assert_equal(1480.087, @segment.highest_point.elevation)
|
||||||
assert_equal(39.173834, @segment.bounds.min_lat)
|
assert_equal(39.173834, @segment.bounds.min_lat)
|
||||||
|
@ -45,9 +45,9 @@ class SegmentTest < Test::Unit::TestCase
|
||||||
:max_lon=> -108.999000)
|
:max_lon=> -108.999000)
|
||||||
@segment.delete_area(delete_rectangle)
|
@segment.delete_area(delete_rectangle)
|
||||||
assert_equal(83, @segment.points.size)
|
assert_equal(83, @segment.points.size)
|
||||||
assert_equal("3.35967118153605", @segment.distance.to_s)
|
assert_in_delta(3.35967118153605, @segment.distance, 0.001)
|
||||||
assert_equal("Fri Apr 07 18:12:05 UTC 2006", @segment.earliest_point.time.to_s)
|
assert_equal(1144433525, @segment.earliest_point.time.to_i)
|
||||||
assert_equal("Fri Apr 07 19:26:31 UTC 2006", @segment.latest_point.time.to_s)
|
assert_equal(1144437991, @segment.latest_point.time.to_i)
|
||||||
assert_equal(1334.447, @segment.lowest_point.elevation)
|
assert_equal(1334.447, @segment.lowest_point.elevation)
|
||||||
assert_equal(1428.176, @segment.highest_point.elevation)
|
assert_equal(1428.176, @segment.highest_point.elevation)
|
||||||
assert_equal(39.180572, @segment.bounds.min_lat)
|
assert_equal(39.180572, @segment.bounds.min_lat)
|
||||||
|
|
|
@ -13,7 +13,7 @@ class TrackTest < Test::Unit::TestCase
|
||||||
assert_equal("ACTIVE LOG", @track.name)
|
assert_equal("ACTIVE LOG", @track.name)
|
||||||
assert_equal( 182, @track.points.size)
|
assert_equal( 182, @track.points.size)
|
||||||
assert_equal(8, @track.segments.size)
|
assert_equal(8, @track.segments.size)
|
||||||
assert_equal("3.07249668492626", @track.distance.to_s)
|
assert_in_delta(3.07249668492626, @track.distance, 0.001)
|
||||||
assert_equal(1267.155, @track.lowest_point.elevation)
|
assert_equal(1267.155, @track.lowest_point.elevation)
|
||||||
assert_equal(1594.003, @track.highest_point.elevation)
|
assert_equal(1594.003, @track.highest_point.elevation)
|
||||||
assert_equal(38.681488, @track.bounds.min_lat)
|
assert_equal(38.681488, @track.bounds.min_lat)
|
||||||
|
@ -32,7 +32,7 @@ class TrackTest < Test::Unit::TestCase
|
||||||
assert_equal("ACTIVE LOG", @track.name)
|
assert_equal("ACTIVE LOG", @track.name)
|
||||||
assert_equal( 111, @track.points.size)
|
assert_equal( 111, @track.points.size)
|
||||||
assert_equal(4, @track.segments.size)
|
assert_equal(4, @track.segments.size)
|
||||||
assert_equal("1.62136024923607", @track.distance.to_s)
|
assert_in_delta(1.62136024923607, @track.distance, 0.001)
|
||||||
assert_equal(1557.954, @track.lowest_point.elevation)
|
assert_equal(1557.954, @track.lowest_point.elevation)
|
||||||
assert_equal(1582.468, @track.highest_point.elevation)
|
assert_equal(1582.468, @track.highest_point.elevation)
|
||||||
assert_equal(38.782511, @track.bounds.min_lat)
|
assert_equal(38.782511, @track.bounds.min_lat)
|
||||||
|
|
Loading…
Reference in New Issue