Correct tests and Rakefile

master
Guillaume Dott 2013-06-16 01:35:46 +02:00
parent 917c437f94
commit 853b967974
12 changed files with 19 additions and 52 deletions

View File

@ -1,20 +1,6 @@
require 'rubygems'
require 'rake'
require 'bundler/gem_tasks'
require 'rake/testtask'
require 'rake/rdoctask'
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/**/*"
]
require 'rdoc/task'
desc "Default Task"
task :default => [ :test ]
@ -27,12 +13,6 @@ Rake::TestTask.new("test") { |t|
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
desc "Create documentation"
Rake::RDocTask.new("doc") { |rdoc|
@ -41,12 +21,3 @@ Rake::RDocTask.new("doc") { |rdoc|
rdoc.rdoc_files.include('README')
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

View File

@ -1,5 +1,5 @@
require 'test/unit'
require File.dirname(__FILE__) + '/../lib/gpx'
require 'gpx'
class GPX10Test < Test::Unit::TestCase
GPX_FILE = File.join(File.dirname(__FILE__), "gpx_files/gpx10.gpx")

View File

@ -1,5 +1,5 @@
require 'test/unit'
require File.dirname(__FILE__) + '/../lib/gpx'
require 'gpx'
class GPXFileTest < Test::Unit::TestCase

View File

@ -1,5 +1,5 @@
require 'test/unit'
require File.dirname(__FILE__) + '/../lib/gpx'
require 'gpx'
class MagellanTest < Test::Unit::TestCase
MAGELLAN_TRACK_LOG = File.join(File.dirname(__FILE__), "gpx_files/magellan_track.log")

View File

@ -1,6 +1,6 @@
require 'test/unit'
require 'fileutils'
require File.dirname(__FILE__) + '/../lib/gpx'
require 'gpx'
class OutputTest < Test::Unit::TestCase
@ -36,13 +36,13 @@ class OutputTest < Test::Unit::TestCase
gpx_file.tracks << track
waypoint_data = [
{:lat => 39.997298, :lon => -105.292674, :name => 'GRG-CA', :sym => 'Waypoint', :elevation => 1766.535},
{:lat => 33.330190, :lon => -111.946110, :name => 'GRMPHX', :sym => 'Waypoint', :elevation => 361.0981,
{:lat => 39.997298, :lon => -105.292674, :name => 'GRG-CA', :sym => 'Waypoint', :ele => '1766.535'},
{: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"},
{:lat => 25.061783, :lon => 121.640267, :name => 'GRMTWN', :sym => 'Waypoint', :elevation => 38.09766},
{:lat => 39.999840, :lon => -105.214696, :name => 'SBDR', :sym => 'Waypoint', :elevation => 1612.965},
{:lat => 39.989739, :lon => -105.295285, :name => 'TO', :sym => 'Waypoint', :elevation => 2163.556},
{:lat => 40.035301, :lon => -105.254443, :name => 'VICS', :sym => 'Waypoint', :elevation => 1535.34}
{:lat => 25.061783, :lon => 121.640267, :name => 'GRMTWN', :sym => 'Waypoint', :ele => '38.09766'},
{:lat => 39.999840, :lon => -105.214696, :name => 'SBDR', :sym => 'Waypoint', :ele => '1612.965'},
{:lat => 39.989739, :lon => -105.295285, :name => 'TO', :sym => 'Waypoint', :ele => '2163.556'},
{:lat => 40.035301, :lon => -105.254443, :name => 'VICS', :sym => 'Waypoint', :ele => '1535.34'}
]
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)
end
end
expected_value = sprintf(THE_WORKS, gpx_file.time.xmlschema)
assert_equal(expected_value, IO.read(output_file(name_of_test)))
end
def name_of_test

View File

@ -1,5 +1,5 @@
require 'test/unit'
require File.dirname(__FILE__) + '/../lib/gpx'
require 'gpx'
class RouteTest < Test::Unit::TestCase

View File

@ -1,6 +1,6 @@
require 'test/unit'
require 'yaml'
require File.dirname(__FILE__) + '/../lib/gpx'
require 'gpx'
class SegmentTest < Test::Unit::TestCase
ONE_SEGMENT = File.join(File.dirname(__FILE__), "gpx_files/one_segment.gpx")

View File

@ -1,5 +1,5 @@
require 'test/unit'
require File.dirname(__FILE__) + '/../lib/gpx'
require 'gpx'
class TrackFileTest < Test::Unit::TestCase
TRACK_FILE = File.join(File.dirname(__FILE__), "gpx_files/tracks.gpx")

View File

@ -1,5 +1,5 @@
require 'test/unit'
require File.dirname(__FILE__) + '/../lib/gpx'
require 'gpx'
class TrackTest < Test::Unit::TestCase
ONE_TRACK = File.join(File.dirname(__FILE__), "gpx_files/one_track.gpx")

View File

@ -1,5 +1,5 @@
require 'test/unit'
require File.dirname(__FILE__) + '/../lib/gpx'
require 'gpx'
class WaypointTest < Test::Unit::TestCase