Skip to content

Commit

Permalink
GeoJSON unit tests- ensure descriptors are ordered by name (ref #3494)
Browse files Browse the repository at this point in the history
  • Loading branch information
artemp committed Aug 16, 2016
1 parent 3788b27 commit 1a29b35
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test/data
Submodule data updated 1 files
+17 −0 json/properties.json
20 changes: 20 additions & 0 deletions test/unit/datasource/geojson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,26 @@ TEST_CASE("geojson") {
}
}

SECTION("GeoJSON attribute descriptors are alphabetically ordered")
{
for (auto cache_features : {true, false})
{
mapnik::parameters params;
params["type"] = "geojson";
params["file"] = "./test/data/json/properties.json";
params["cache_features"] = cache_features;
auto ds = mapnik::datasource_cache::instance().create(params);
CHECK(ds != nullptr);
std::vector<std::string> expected_names = {"a", "b", "c", "d", "e"};
auto fields = ds->get_descriptor().get_descriptors();
std::size_t index = 0;
for (auto const& field : fields)
{
REQUIRE(field.get_name() == expected_names[index++]);
}
}
}

SECTION("GeoJSON invalid Point")
{
for (auto cache_features : {true, false})
Expand Down

0 comments on commit 1a29b35

Please sign in to comment.