blob: 0a2a8e3b3e3b0e2645c15ceef4f20ca6e500c6e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
// Copyright 2013, 2014 Peter Vasil, Tomo Krajina. All
// rights reserved. Use of this source code is governed
// by a BSD-style license that can be found in the
// LICENSE file.
package gpx
import (
"math"
"testing"
)
func TestToRad(t *testing.T) {
radVal := ToRad(360)
if radVal != math.Pi*2 {
t.Errorf("Test failed: %f", radVal)
}
}
func TestElevationAngle(t *testing.T) {
loc1 := Point{Latitude: 52.5113534275, Longitude: 13.4571944922, Elevation: *NewNullableFloat64(59.26)}
loc2 := Point{Latitude: 52.5113568641, Longitude: 13.4571697656, Elevation: *NewNullableFloat64(65.51)}
elevAngleA := ElevationAngle(loc1, loc2, false)
elevAngleE := 74.65347905197362
if elevAngleE != elevAngleA {
t.Errorf("Elevation angle expected: %f, actual: %f", elevAngleE, elevAngleA)
}
}
|