1
0
forked from MTSR/mapserver
mapserver/coords/convert_test.go

37 lines
640 B
Go
Raw Normal View History

2019-01-09 12:52:51 +03:00
package coords
import (
2019-01-13 18:37:03 +03:00
"testing"
2019-01-20 22:10:48 +03:00
"github.com/sirupsen/logrus"
2019-01-09 12:52:51 +03:00
)
var log *logrus.Entry
2019-01-13 18:37:03 +03:00
func init() {
2019-01-09 12:52:51 +03:00
log = logrus.WithFields(logrus.Fields{"prefix": "coords/convert_test"})
}
2019-01-13 18:37:03 +03:00
func testCoordConvert(t *testing.T, mb MapBlockCoords) {
log.WithFields(logrus.Fields{"coords": mb}).Info("MapblockCoords")
2019-01-09 12:52:51 +03:00
2019-01-13 18:37:03 +03:00
p := CoordToPlain(mb)
log.WithFields(logrus.Fields{"plain": p}).Info("MapblockCoords")
2019-01-09 12:52:51 +03:00
2019-01-13 18:37:03 +03:00
mb2 := PlainToCoord(p)
log.WithFields(logrus.Fields{"coords2": mb2}).Info("MapblockCoords")
2019-01-09 12:52:51 +03:00
2019-01-13 18:37:03 +03:00
if mb.X != mb2.X {
t.Fatal("X mismatch")
}
2019-01-09 12:52:51 +03:00
2019-01-13 18:37:03 +03:00
if mb.Y != mb2.Y {
t.Fatal("Y mismatch")
}
2019-01-09 12:52:51 +03:00
2019-01-13 18:37:03 +03:00
if mb.Z != mb2.Z {
t.Fatal("Z mismatch")
}
2019-01-09 12:52:51 +03:00
}