aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/paulmach/orb/equal_test.go
blob: 95b7158308b5bfaed929bb423d6d0f517c870b9a (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
37
38
39
40
41
package orb

import (
	"fmt"
	"testing"
)

func TestEqual(t *testing.T) {
	for _, g := range AllGeometries {
		// this closure is necessary if tests are run in parallel, maybe
		func(geom Geometry) {
			t.Run(fmt.Sprintf("%T", g), func(t *testing.T) {
				if !Equal(geom, geom) {
					t.Errorf("%T not equal", g)
				}
			})
		}(g)
	}
}

func TestEqualRing(t *testing.T) {
	if Equal(Ring{}, LineString{}) {
		t.Errorf("should return false since different types")
	}

	if Equal(Ring{}, Polygon{}) {
		t.Errorf("should return false since different types")
	}

	if Equal(Polygon{}, Ring{}) {
		t.Errorf("should return false since different types")
	}

	if Equal(Polygon{}, Bound{}) {
		t.Errorf("should return false since different types")
	}

	if Equal(Bound{}, Polygon{}) {
		t.Errorf("should return false since different types")
	}
}