aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/paulmach/orb/project/define_test.go
blob: 9137ef40248c82ceca105a4eb4df0e5ac007dac4 (plain) (blame)
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
31
32
33
34
35
36
package project

import (
	"math"
	"testing"

	"github.com/paulmach/orb/internal/mercator"
)

func TestDefineDeg2Rad(t *testing.T) {
	if math.Abs(deg2rad(0.0)) > mercator.Epsilon {
		t.Error("define, deg2rad error")
	}

	if math.Abs(deg2rad(180.0)-math.Pi) > mercator.Epsilon {
		t.Error("define, deg2rad error")
	}

	if math.Abs(deg2rad(360.0)-2*math.Pi) > mercator.Epsilon {
		t.Error("define, deg2rad error")
	}
}

func TestDefineRad2Deg(t *testing.T) {
	if math.Abs(rad2deg(0.0)-0.0) > mercator.Epsilon {
		t.Error("define, rad2deg error")
	}

	if math.Abs(rad2deg(math.Pi)-180.0) > mercator.Epsilon {
		t.Error("define, rad2deg error")
	}

	if math.Abs(rad2deg(2*math.Pi)-360.0) > mercator.Epsilon {
		t.Error("define, rad2deg error")
	}
}