Skip to content

Conversation

BerryDaniel
Copy link
Contributor

Consolidated X and Y tests for FromNative and ToNative. I also added a check for the SRID (L25-27) from the grid to allow for increased coverage. Adjusted the test areas from directional (north, east, south, west) to quadrants [1-4].

rebased to address merge conflict

@ear7h ear7h changed the base branch from tile-grid to master January 20, 2020 22:16
@ear7h ear7h changed the base branch from master to mvt-decode January 20, 2020 22:17
@ear7h ear7h changed the base branch from mvt-decode to tile-grid January 20, 2020 22:17
…a check for the SRID (L25-27) from the grid to allow for increased coverage. Adjusted the test areas from directional (north, east, south, west) to quadrants [1-4].
@coveralls
Copy link

coveralls commented Jan 20, 2020

Pull Request Test Coverage Report for Build 484

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 54.96%

Totals Coverage Status
Change from base Build 479: 0.03%
Covered Lines: 6128
Relevant Lines: 11150

💛 - Coveralls

Copy link
Contributor

@ear7h ear7h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just some minor changes. Thanks for finishing this up!

srid uint
zoom uint
expected uint
expected [2]uint
Copy link
Contributor

@ear7h ear7h Jan 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change this (and the test cases) to geom.Point

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, these are tile coordinates. Here, the zoom and expected can be joined into a single field with type *Tile (NewTile returns a pointer).

Note: structs can be compared like *tc.expected == *tile

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't you need the grid first before creating the tile?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

srid uint
zoom uint
expected float64
expected [2]float64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change this (and the test cases) to geom.Point

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

"3857_south": {
lat: -85.0511,
"3857_z0_random": {
point: geom.Point{0, 0 + rand.Float64() * 85.0511},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go's math/rand generator is deterministic, so this will always be the same number. The same behavior is good for tests, but the use of the package is misleading. Use a literal instead like 12.345.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

x uint
y uint
srid uint
zoom uint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The zoom, x, and y here should also be contained into a tile

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@BerryDaniel BerryDaniel requested a review from ear7h January 21, 2020 02:25

if !cmp.Float(pt.X(), tc.expected) {
t.Errorf("got %v expected %v", pt.X(), tc.expected)
if pt != tc.expected {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use cmp.PointEqual(pt, tc.expected) (from github.com/go-spatial/geom/cmp). This is the package we use for floating point comparisons since, plain == is unstable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test cases can be left as is btw

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modified as requested

@ear7h
Copy link
Contributor

ear7h commented Jan 22, 2020

@BerryDaniel LGTM thank you!

@ear7h ear7h merged commit 06d3149 into go-spatial:tile-grid Jan 22, 2020
@ear7h ear7h mentioned this pull request Jan 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants