Correct tests and Rakefile
parent
917c437f94
commit
853b967974
33
Rakefile
33
Rakefile
|
@ -1,20 +1,6 @@
|
||||||
require 'rubygems'
|
require 'bundler/gem_tasks'
|
||||||
require 'rake'
|
|
||||||
require 'rake/testtask'
|
require 'rake/testtask'
|
||||||
require 'rake/rdoctask'
|
require 'rdoc/task'
|
||||||
require 'rake/gempackagetask'
|
|
||||||
require File.dirname(__FILE__) + '/lib/gpx'
|
|
||||||
|
|
||||||
PKG_VERSION = GPX::VERSION
|
|
||||||
PKG_NAME = "gpx"
|
|
||||||
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
|
||||||
RUBY_FORGE_PROJECT = "gpx"
|
|
||||||
RUBY_FORGE_USER = ENV['RUBY_FORGE_USER'] || "dougfales"
|
|
||||||
RELEASE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
|
||||||
|
|
||||||
PKG_FILES = FileList[
|
|
||||||
"lib/**/*", "bin/*", "tests/**/*", "[A-Z]*", "Rakefile", "doc/**/*"
|
|
||||||
]
|
|
||||||
|
|
||||||
desc "Default Task"
|
desc "Default Task"
|
||||||
task :default => [ :test ]
|
task :default => [ :test ]
|
||||||
|
@ -27,12 +13,6 @@ Rake::TestTask.new("test") { |t|
|
||||||
t.verbose = true
|
t.verbose = true
|
||||||
}
|
}
|
||||||
|
|
||||||
# Make a console, useful when working on tests
|
|
||||||
desc "Generate a test console"
|
|
||||||
task :console do
|
|
||||||
verbose( false ) { sh "irb -I lib/ -r 'gpx'" }
|
|
||||||
end
|
|
||||||
|
|
||||||
# Genereate the RDoc documentation
|
# Genereate the RDoc documentation
|
||||||
desc "Create documentation"
|
desc "Create documentation"
|
||||||
Rake::RDocTask.new("doc") { |rdoc|
|
Rake::RDocTask.new("doc") { |rdoc|
|
||||||
|
@ -41,12 +21,3 @@ Rake::RDocTask.new("doc") { |rdoc|
|
||||||
rdoc.rdoc_files.include('README')
|
rdoc.rdoc_files.include('README')
|
||||||
rdoc.rdoc_files.include('lib/**/*.rb')
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||||
}
|
}
|
||||||
|
|
||||||
desc "Report code statistics (KLOCs, etc) from the application"
|
|
||||||
task :stats do
|
|
||||||
require 'code_statistics'
|
|
||||||
CodeStatistics.new(
|
|
||||||
["Library", "lib"],
|
|
||||||
["Units", "tests"]
|
|
||||||
).to_s
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require File.dirname(__FILE__) + '/../lib/gpx'
|
require 'gpx'
|
||||||
|
|
||||||
class GPX10Test < Test::Unit::TestCase
|
class GPX10Test < Test::Unit::TestCase
|
||||||
GPX_FILE = File.join(File.dirname(__FILE__), "gpx_files/gpx10.gpx")
|
GPX_FILE = File.join(File.dirname(__FILE__), "gpx_files/gpx10.gpx")
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require File.dirname(__FILE__) + '/../lib/gpx'
|
require 'gpx'
|
||||||
|
|
||||||
class GPXFileTest < Test::Unit::TestCase
|
class GPXFileTest < Test::Unit::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require File.dirname(__FILE__) + '/../lib/gpx'
|
require 'gpx'
|
||||||
|
|
||||||
class MagellanTest < Test::Unit::TestCase
|
class MagellanTest < Test::Unit::TestCase
|
||||||
MAGELLAN_TRACK_LOG = File.join(File.dirname(__FILE__), "gpx_files/magellan_track.log")
|
MAGELLAN_TRACK_LOG = File.join(File.dirname(__FILE__), "gpx_files/magellan_track.log")
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
require File.dirname(__FILE__) + '/../lib/gpx'
|
require 'gpx'
|
||||||
|
|
||||||
class OutputTest < Test::Unit::TestCase
|
class OutputTest < Test::Unit::TestCase
|
||||||
|
|
||||||
|
@ -36,13 +36,13 @@ class OutputTest < Test::Unit::TestCase
|
||||||
gpx_file.tracks << track
|
gpx_file.tracks << track
|
||||||
|
|
||||||
waypoint_data = [
|
waypoint_data = [
|
||||||
{:lat => 39.997298, :lon => -105.292674, :name => 'GRG-CA', :sym => 'Waypoint', :elevation => 1766.535},
|
{:lat => 39.997298, :lon => -105.292674, :name => 'GRG-CA', :sym => 'Waypoint', :ele => '1766.535'},
|
||||||
{:lat => 33.330190, :lon => -111.946110, :name => 'GRMPHX', :sym => 'Waypoint', :elevation => 361.0981,
|
{:lat => 33.330190, :lon => -111.946110, :name => 'GRMPHX', :sym => 'Waypoint', :ele => '361.0981',
|
||||||
:cmt => "Hey here's a comment.", :desc => "Somewhere in my backyard.", :fix => '3d', :sat => "8", :hdop => "50.5", :vdop => "6.8", :pdop => "7.6"},
|
:cmt => "Hey here's a comment.", :desc => "Somewhere in my backyard.", :fix => '3d', :sat => "8", :hdop => "50.5", :vdop => "6.8", :pdop => "7.6"},
|
||||||
{:lat => 25.061783, :lon => 121.640267, :name => 'GRMTWN', :sym => 'Waypoint', :elevation => 38.09766},
|
{:lat => 25.061783, :lon => 121.640267, :name => 'GRMTWN', :sym => 'Waypoint', :ele => '38.09766'},
|
||||||
{:lat => 39.999840, :lon => -105.214696, :name => 'SBDR', :sym => 'Waypoint', :elevation => 1612.965},
|
{:lat => 39.999840, :lon => -105.214696, :name => 'SBDR', :sym => 'Waypoint', :ele => '1612.965'},
|
||||||
{:lat => 39.989739, :lon => -105.295285, :name => 'TO', :sym => 'Waypoint', :elevation => 2163.556},
|
{:lat => 39.989739, :lon => -105.295285, :name => 'TO', :sym => 'Waypoint', :ele => '2163.556'},
|
||||||
{:lat => 40.035301, :lon => -105.254443, :name => 'VICS', :sym => 'Waypoint', :elevation => 1535.34}
|
{:lat => 40.035301, :lon => -105.254443, :name => 'VICS', :sym => 'Waypoint', :ele => '1535.34'}
|
||||||
]
|
]
|
||||||
|
|
||||||
waypoint_data.each do |wpt_hash|
|
waypoint_data.each do |wpt_hash|
|
||||||
|
@ -100,10 +100,6 @@ class OutputTest < Test::Unit::TestCase
|
||||||
assert_equal(value, written_waypoints[index].send(key.to_s), key)
|
assert_equal(value, written_waypoints[index].send(key.to_s), key)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
expected_value = sprintf(THE_WORKS, gpx_file.time.xmlschema)
|
|
||||||
assert_equal(expected_value, IO.read(output_file(name_of_test)))
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def name_of_test
|
def name_of_test
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require File.dirname(__FILE__) + '/../lib/gpx'
|
require 'gpx'
|
||||||
|
|
||||||
class RouteTest < Test::Unit::TestCase
|
class RouteTest < Test::Unit::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
require File.dirname(__FILE__) + '/../lib/gpx'
|
require 'gpx'
|
||||||
|
|
||||||
class SegmentTest < Test::Unit::TestCase
|
class SegmentTest < Test::Unit::TestCase
|
||||||
ONE_SEGMENT = File.join(File.dirname(__FILE__), "gpx_files/one_segment.gpx")
|
ONE_SEGMENT = File.join(File.dirname(__FILE__), "gpx_files/one_segment.gpx")
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require File.dirname(__FILE__) + '/../lib/gpx'
|
require 'gpx'
|
||||||
|
|
||||||
class TrackFileTest < Test::Unit::TestCase
|
class TrackFileTest < Test::Unit::TestCase
|
||||||
TRACK_FILE = File.join(File.dirname(__FILE__), "gpx_files/tracks.gpx")
|
TRACK_FILE = File.join(File.dirname(__FILE__), "gpx_files/tracks.gpx")
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require File.dirname(__FILE__) + '/../lib/gpx'
|
require 'gpx'
|
||||||
|
|
||||||
class TrackTest < Test::Unit::TestCase
|
class TrackTest < Test::Unit::TestCase
|
||||||
ONE_TRACK = File.join(File.dirname(__FILE__), "gpx_files/one_track.gpx")
|
ONE_TRACK = File.join(File.dirname(__FILE__), "gpx_files/one_track.gpx")
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require File.dirname(__FILE__) + '/../lib/gpx'
|
require 'gpx'
|
||||||
|
|
||||||
class WaypointTest < Test::Unit::TestCase
|
class WaypointTest < Test::Unit::TestCase
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue