-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* improve code coverage of tests * code coverage; small bugfix * code coverage * trivial coverage work * improved test coverage
- Loading branch information
Showing
15 changed files
with
192 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package core_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/go-spatial/proj/core" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestCoordinate(t *testing.T) { | ||
assert := assert.New(t) | ||
|
||
{ | ||
any := &core.CoordAny{V: [4]float64{1.0, 2.0, 3.0, 4.0}} | ||
lp := any.ToLP() | ||
assert.Equal(1.0, lp.Lam) | ||
assert.Equal(2.0, lp.Phi) | ||
lp.Lam = 10.0 | ||
lp.Phi = 20.0 | ||
any.FromLP(lp) | ||
assert.Equal(10.0, any.V[0]) | ||
assert.Equal(20.0, any.V[1]) | ||
assert.Equal(3.0, any.V[2]) | ||
assert.Equal(4.0, any.V[3]) | ||
} | ||
{ | ||
any := &core.CoordAny{V: [4]float64{1.0, 2.0, 3.0, 4.0}} | ||
xy := any.ToXY() | ||
assert.Equal(1.0, xy.X) | ||
assert.Equal(2.0, xy.Y) | ||
xy.X = 10.0 | ||
xy.Y = 20.0 | ||
any.FromXY(xy) | ||
assert.Equal(10.0, any.V[0]) | ||
assert.Equal(20.0, any.V[1]) | ||
assert.Equal(3.0, any.V[2]) | ||
assert.Equal(4.0, any.V[3]) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,27 @@ | ||
package core_test | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/go-spatial/proj/core" | ||
"github.com/go-spatial/proj/support" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestEllipsoid(t *testing.T) { | ||
assert := assert.New(t) | ||
assert.True(true) | ||
|
||
ps, err := support.NewProjString("+proj=utm +zone=32 +ellps=GRS80") | ||
assert.NoError(err) | ||
sys, _, err := core.NewSystem(ps) | ||
assert.NoError(err) | ||
|
||
e := sys.Ellipsoid | ||
|
||
assert.Equal("GRS80", e.ID) | ||
|
||
s := fmt.Sprintf("%s", e) | ||
assert.True(len(s) > 1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package core_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/go-spatial/proj/core" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestOperationDescription(t *testing.T) { | ||
assert := assert.New(t) | ||
|
||
opDesc := core.OperationDescriptionTable["utm"] | ||
assert.NotNil(opDesc) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package core_test | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/go-spatial/proj/core" | ||
"github.com/go-spatial/proj/support" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestOperation(t *testing.T) { | ||
assert := assert.New(t) | ||
|
||
ps, err := support.NewProjString("+proj=utm +zone=32 +ellps=GRS80") | ||
assert.NoError(err) | ||
_, opx, err := core.NewSystem(ps) | ||
assert.NoError(err) | ||
|
||
s := fmt.Sprintf("%s", opx) | ||
assert.True(len(s) > 1) | ||
|
||
id := opx.GetDescription().ID | ||
assert.Equal("utm", id) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package gie_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/go-spatial/proj/gie" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestGie(t *testing.T) { | ||
assert := assert.New(t) | ||
|
||
g, err := gie.NewGie(".") | ||
assert.NoError(err) | ||
assert.NotNil(g) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package support_test | ||
|
||
import ( | ||
"math" | ||
"testing" | ||
|
||
"github.com/go-spatial/proj/support" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestAasincos(t *testing.T) { | ||
assert := assert.New(t) | ||
|
||
assert.InDelta(math.Asin(0.5), support.Aasin(0.5), 1.0e-8) | ||
assert.InDelta(math.Asin(0.5), support.Aasin(0.5), 1.0e-8) | ||
assert.InDelta(math.Sqrt(0.5), support.Asqrt(0.5), 1.0e-8) | ||
assert.InDelta(math.Atan2(0.5, 0.5), support.Aatan2(0.5, 0.5), 1.0e-8) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package support_test | ||
|
||
import ( | ||
"math" | ||
"testing" | ||
|
||
"github.com/go-spatial/proj/support" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestAdjlon(t *testing.T) { | ||
assert := assert.New(t) | ||
|
||
assert.InDelta(math.Pi*0.5, support.Adjlon(math.Pi*2.5), 1.0e-8) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package support_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/go-spatial/proj/support" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestParseDate(t *testing.T) { | ||
assert := assert.New(t) | ||
|
||
assert.InDelta(0.0, support.ParseDate("yow"), 1.0e-8) | ||
assert.InDelta(1999.5, support.ParseDate("1999.50"), 1.0e-8) | ||
assert.InDelta(2000.0, support.ParseDate("1999.99999999"), 1.0e-8) | ||
assert.InDelta(1999.0+(12.0*31.0-1.0)/(12.0*31.0), support.ParseDate("1999-12-31"), 1.0e-8) | ||
assert.InDelta(1999.0+(6.0*31.0)/(12.0*31.0), support.ParseDate("1999-07-01"), 1.0e-8) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters