require 'test/unit' require File.dirname(__FILE__) + '/../lib/gpx' class RouteTest < Test::Unit::TestCase def test_read_routes gpx = GPX::GPXFile.new(:gpx_file => File.join(File.dirname(__FILE__), "gpx_files/routes.gpx")) assert_equal(2, gpx.routes.size) first_route = gpx.routes.first assert_equal(3, first_route.points.size) assert_equal('GRG-CA-TO', first_route.name) # Route 1, First Point # # # Waypoint # 1766.535 # assert_equal(39.997298, first_route.points[0].lat) assert_equal(-105.292674, first_route.points[0].lon) assert_equal(1766.535, first_route.points[0].elevation) # Route 1, Second Point # # # Waypoint # 1854.735 # assert_equal(39.995700, first_route.points[1].lat) assert_equal(-105.292805, first_route.points[1].lon) assert_equal(1854.735, first_route.points[1].elevation) # Route 1, Third Point # # # Waypoint # 2163.556 # assert_equal(39.989739, first_route.points[2].lat) assert_equal(-105.295285, first_route.points[2].lon) assert_equal(2163.556, first_route.points[2].elevation) second_route = gpx.routes[1] assert_equal(1, second_route.points.size) assert_equal('SBDR-SBDR', second_route.name) # Route 2, Only Point # # # Waypoint # 1612.965 # assert_equal(39.999840, second_route.points[0].lat) assert_equal(-105.214696, second_route.points[0].lon) assert_equal(1612.965, second_route.points[0].elevation) end end