Skip to content
This repository was archived by the owner on Jun 4, 2026. It is now read-only.

[geometry-rewrite] update tests - #47

Merged
mourner merged 1 commit into
geometry-rewritefrom
geometry-rewrite-tests
Jun 26, 2016
Merged

mourner merged 1 commit into
geometry-rewritefrom
geometry-rewrite-tests

Conversation

@yhahn

@yhahn yhahn commented Jun 23, 2016 •

Copy link
Copy Markdown
Contributor

Not passing yet and some problematic parts. Will note in inline comments below.

cc @springmeyer

Comment thread test/test.cpp

ASSERT_EQ(empty_tile == index.getTile(11, 800, 400), true); // non-existing tile
ASSERT_EQ(&empty_tile == &index.getTile(11, 800, 400), true); // non-existing tile

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ideally all of these would be

ASSERT_EQ(feature, expected);

Rather than

ASSERT_EQ(feature == expected, true);

But I've not been able to get the == operators to cooperate with ASSERT_EQ or vice versa yet.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

replicated the error: https://gist.github.com/springmeyer/445c1d2d143e59c5d340b2d053f67008. Something is weird with the comparison operator, but I'm not able to see it yet. Wondering if @jfirebaugh might be able to spot it...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

feature didn't have an == operator defined. I added this in mapbox/geometry.hpp@9b59d16; will need to go through another release + update cycle to bring it into geojson.hpp and here.

@yhahn
yhahn force-pushed the geometry-rewrite-tests branch from d68da4a to b63ff12 Compare June 24, 2016 00:30
Comment thread test/util.cpp Outdated
//
// if (jt->value.IsUint64()) {
// feat.properties.emplace(tagKey, std::uint64_t(jt->value.GetUint64()));
// }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

😓 the New Jersey feature that's going through

mapbox::geojson::parse(loadFile("test/fixtures/us-states.json"))

has a density value that is int64_t because geojson-cpp is currently based on [email protected] -- which preferred int64_t to uint64_t:

https://github.com/mapbox/geometry.hpp/blob/d7a28b485b1e3ac25810e404cf41dac7b364cad1/include/mapbox/geometry/feature.hpp#L16

Comment thread test/util.cpp Outdated

bool operator==(const std::map<std::string, mapbox::geometry::feature_collection<short>>& a, const std::map<std::string, mapbox::geometry::feature_collection<short>>& b) {
EXPECT_EQ(a.size(), b.size());
// @TODO iterate through all tiles in a & confirm in b && vice versa

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll add this comparison in but at first glance it looks like the tiles generated are quite different in count + possibly tile coordinate from master. @mourner may ping you for guidance on whether this is an expected update to the algorithm in geojson-vt-cpp (and maybe also whether there's a JS test fixture reference/parity expected).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, there's a difference in the algorithm — previously it would not save empty tiles at the bottom of the tree, and now it does, so that getTile doesn't need to reclip geometries if there's an empty parent.

@yhahn
yhahn force-pushed the geometry-rewrite-tests branch from ac9b30c to 21385a0 Compare June 26, 2016 22:32
@yhahn

yhahn commented Jun 26, 2016

Copy link
Copy Markdown
Contributor Author

@mourner this should be ready for your review and merge into #45.

The main remaining item on my mind is to update to the next release of geometry.hpp once @jfirebaugh rolls a release (looks like that's waiting on a few more PRs) to make for cleaner assertions in the tests, but definitely not a blocker for merge.

@yhahn yhahn changed the title [geometry-rewrite] update get_tile test [geometry-rewrite] update tests Jun 26, 2016
@mourner
mourner merged commit 6be7c4b into geometry-rewrite Jun 26, 2016
@mourner
mourner deleted the geometry-rewrite-tests branch June 26, 2016 23:28
@mourner

mourner commented Jun 26, 2016

Copy link
Copy Markdown
Member

@yhahn this looks great, thanks for doing the dirty work! I'll merge the geometry PR to master tomorrow after a clean-up rebase.

mourner pushed a commit that referenced this pull request Jun 28, 2016
mourner pushed a commit that referenced this pull request Jun 28, 2016
mourner pushed a commit that referenced this pull request Jun 28, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants