Sha256: 1545e74355b8e6b851f0dde6f3747e16733318a29b2d0dc9efbc2b3a788bb3ac

Contents?: true

Size: 749 Bytes

Versions: 2

Compression:

Stored size: 749 Bytes

Contents

require 'minitest/autorun'
require 'gpx'

class TrackPointTest < Minitest::Test
  def setup
    @point1 = GPX::TrackPoint.new({
      :lat => 37.7985474,
      :lon => -122.2554386
    })
    @point2 = GPX::TrackPoint.new({
      :lat => 37.7985583,
      :lon => -122.2554564
    })
  end

  def test_haversine_distance_from
    distance = @point1.haversine_distance_from(@point2)
    assert_equal(0.00197862991592239, distance)
  end

  def test_pythagorean_distance_from
    distance = @point1.pythagorean_distance_from(@point2)
    assert_equal(3.642891416092969e-07, distance)
  end

  def test_law_of_cosines_distance_from
    distance = @point1.law_of_cosines_distance_from(@point2)
    assert_equal(0.001982307218559664, distance)
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
gpx-0.8.1 tests/track_point_test.rb
andrewhao-gpx-0.8 tests/track_point_test.rb