Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added better dist calc specs

  • Loading branch information...
commit cd999a31262bf03586807a17cc4d022c8b3ffa69 1 parent f43aec8
@kristianmandrup authored
Showing with 24 additions and 25 deletions.
  1. +1 −1  .rspec
  2. +23 −24 spec/geo_magic_calculate_spec.rb
View
2  .rspec
@@ -1 +1 @@
---color
+--format nested --color
View
47 spec/geo_magic_calculate_spec.rb
@@ -10,18 +10,17 @@
@lat2 = @lat1
end
- it "calculates distance using array args" do
+ it "calculates distance using array args - using algorithm haversine" do
dist = GeoMagic::Calculate.distance [@long1, @lat1], [@long2, @lat2]
puts dist
end
- it "Changing default distance algorithm" do
+ it "Changing default distance algorithm to vincenty" do
GeoDistance.default_algorithm = :vincenty
dist = GeoMagic::Calculate.distance [@long1, @lat1], [@long2, @lat2]
puts dist
end
-
it "calculates distance using Point args" do
from_point = GeoMagic::Point.new @long1, @lat1
to_point = GeoMagic::Point.new @long2, @lat2
@@ -32,7 +31,7 @@
puts dist
end
- it "calculates distance using Location arg" do
+ it "calculates distance using Location arg from my location" do
from_point = GeoMagic::Remote.my_location
to_point = GeoMagic::Point.new @long2, @lat2
@@ -41,24 +40,24 @@
dist = GeoMagic::Calculate.distance from_point, to_point
puts dist
end
- #
- # it "calculates distance using Hash args (short)" do
- # from_point = GeoMagic::Point.new(@long1, @lat1).to_hash :short
- # to_point = GeoMagic::Point.new(@long2, @lat2).to_hash :short
- #
- # puts "from: #{from_point}, to: #{to_point}"
- #
- # dist = GeoMagic::Calculate.distance from_point, to_point
- # puts dist
- # end
- #
- # it "calculates distance using Hash args (long)" do
- # from_point = GeoMagic::Point.new(@long1, @lat1)
- # to_point = GeoMagic::Point.new(@long2, @lat2)
- #
- # puts "from: #{from_point}, to: #{to_point}"
- #
- # dist = GeoMagic::Calculate.distance from_point, to_point
- # puts dist
- # end
+
+ it "calculates distance using Hash args (short)" do
+ from_point = GeoMagic::Point.new(@long1, @lat1).to_hash :short
+ to_point = GeoMagic::Point.new(@long2, @lat2).to_hash :short
+
+ puts "from: #{from_point}, to: #{to_point}"
+
+ dist = GeoMagic::Calculate.distance from_point, to_point
+ puts dist
+ end
+
+ it "calculates distance using Hash args (long)" do
+ from_point = GeoMagic::Point.new(@long1, @lat1)
+ to_point = GeoMagic::Point.new(@long2, @lat2)
+
+ puts "from: #{from_point}, to: #{to_point}"
+
+ dist = GeoMagic::Calculate.distance from_point, to_point
+ puts dist
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.