- autonavi api added.
- other refactor.
This commit is contained in:
37
platformapi/autonavi/autonavi_test.go
Normal file
37
platformapi/autonavi/autonavi_test.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package autonavi
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.rosy.net.cn/baseapi"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
var (
|
||||
autonaviAPI *API
|
||||
sugarLogger *zap.SugaredLogger
|
||||
)
|
||||
|
||||
func init() {
|
||||
logger, _ := zap.NewDevelopment()
|
||||
sugarLogger = logger.Sugar()
|
||||
baseapi.Init(sugarLogger)
|
||||
|
||||
autonaviAPI = New("4427170f870af2110becb8852d36ab08")
|
||||
}
|
||||
|
||||
func TestCoordinateConvert(t *testing.T) {
|
||||
gpsLng := 116.481499
|
||||
gpsLat := 39.990475
|
||||
desiredLng := 116.487585177952
|
||||
desiredLat := 39.991754014757
|
||||
lng, lat, err := autonaviAPI.CoordinateConvert(gpsLng, gpsLat, CoordSysGPS)
|
||||
if err != nil {
|
||||
t.Fatalf("TestCoordinateConvert failed with error:%v", err)
|
||||
} else {
|
||||
if lng != desiredLng || lat != desiredLat {
|
||||
t.Fatal("CoordinateConvert result is wrong")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user