diff --git a/include/mapbox/geojsonvt/tile.hpp b/include/mapbox/geojsonvt/tile.hpp index 4dd98cf..aa0d500 100644 --- a/include/mapbox/geojsonvt/tile.hpp +++ b/include/mapbox/geojsonvt/tile.hpp @@ -1,7 +1,7 @@ #pragma once -#include #include +#include namespace mapbox { namespace geojsonvt { diff --git a/test/test.cpp b/test/test.cpp index 40b1827..a98ee5b 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -1,12 +1,12 @@ #include "util.hpp" #include -#include #include #include #include #include #include #include +#include #include #include @@ -187,7 +187,7 @@ TEST(GetTile, USStates) { ASSERT_EQ(square == index.getTile(9, 148, 192).features, true); // clipped square ASSERT_EQ(square == index.getTile(11, 592, 768).features, true); // clipped square - 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 ASSERT_EQ(&empty_tile == &index.getTile(11, 800, 400), true); // non-existing tile // This test does not make sense in C++, since the parameters are cast to integers anyway. @@ -210,14 +210,14 @@ genTiles(const std::string& data, uint8_t maxZoom = 0, uint32_t maxPoints = 1000 } else if (geojson.is()) { features.emplace_back(geojson.get()); } else if (geojson.is()) { - const auto &geom = geojson.get(); + const auto& geom = geojson.get(); if (geom.is()) { for (const auto& item : geom.get()) { - mapbox::geometry::feature feat { item }; + mapbox::geometry::feature feat{ item }; features.emplace_back(feat); } } else { - mapbox::geometry::feature feat { geom }; + mapbox::geometry::feature feat{ geom }; features.emplace_back(feat); } } @@ -297,6 +297,4 @@ INSTANTIATE_TEST_CASE_P( { "test/fixtures/dateline.json", "test/fixtures/dateline-tiles.json", 7, 200 }, { "test/fixtures/feature.json", "test/fixtures/feature-tiles.json" }, { "test/fixtures/collection.json", "test/fixtures/collection-tiles.json" }, - { "test/fixtures/single-geom.json", "test/fixtures/single-geom-tiles.json" } - })); - + { "test/fixtures/single-geom.json", "test/fixtures/single-geom-tiles.json" } })); diff --git a/test/util.cpp b/test/util.cpp index c680feb..6bf57c9 100644 --- a/test/util.cpp +++ b/test/util.cpp @@ -18,8 +18,8 @@ #pragma GCC diagnostic pop #include -#include #include +#include namespace mapbox { namespace geojsonvt { @@ -35,14 +35,16 @@ std::string loadFile(const std::string& filename) { throw std::runtime_error("Error opening file"); } -bool operator==(const mapbox::geometry::feature& a, const mapbox::geometry::feature& b) { +bool operator==(const mapbox::geometry::feature& a, + const mapbox::geometry::feature& b) { // EXPECT_EQ(a.geometry, b.geometry); EXPECT_EQ(typeid(a.geometry), typeid(b.geometry)); EXPECT_EQ(a.properties, b.properties); return true; } -bool operator==(const mapbox::geometry::feature_collection& a, const mapbox::geometry::feature_collection& b) { +bool operator==(const mapbox::geometry::feature_collection& a, + const mapbox::geometry::feature_collection& b) { EXPECT_EQ(a.size(), b.size()); if (a.size() == b.size()) { unsigned i = 0; @@ -53,9 +55,11 @@ bool operator==(const mapbox::geometry::feature_collection& a, const mapb return true; } -bool operator==(const std::map>& a, const std::map>& b) { +bool operator==(const std::map>& a, + const std::map>& b) { EXPECT_EQ(a.size(), b.size()); - typedef std::map>::const_iterator it_type; + typedef std::map>::const_iterator + it_type; for (it_type it = a.begin(); it != a.end(); it++) { if (b.find(it->first) != b.end()) { EXPECT_TRUE(it->second == b.find(it->first)->second); @@ -87,7 +91,7 @@ parseJSONTile(const rapidjson::GenericValue, rapidjson::CrtAll for (rapidjson::SizeType k = 0; k < tile.Size(); ++k) { const auto& feature = tile[k]; - mapbox::geometry::feature feat { mapbox::geometry::point() }; + mapbox::geometry::feature feat{ mapbox::geometry::point() }; if (feature.HasMember("tags") && feature["tags"].IsObject()) { const auto& tags = feature["tags"]; @@ -104,7 +108,8 @@ parseJSONTile(const rapidjson::GenericValue, rapidjson::CrtAll feat.properties.emplace(tagKey, true); break; case rapidjson::kStringType: - feat.properties.emplace(tagKey, std::string{ jt->value.GetString(), jt->value.GetStringLength() }); + feat.properties.emplace( + tagKey, std::string{ jt->value.GetString(), jt->value.GetStringLength() }); break; case rapidjson::kNumberType: if (jt->value.IsUint64()) { @@ -136,11 +141,9 @@ parseJSONTile(const rapidjson::GenericValue, rapidjson::CrtAll EXPECT_TRUE(pt[0].IsNumber()); EXPECT_TRUE(pt[1].IsNumber()); feat.geometry = mapbox::geometry::point( - static_cast(pt[0].GetInt()), - static_cast(pt[1].GetInt()) - ); + static_cast(pt[0].GetInt()), static_cast(pt[1].GetInt())); } - // polygon geometry + // polygon geometry } else if (geomType == 3) { mapbox::geometry::polygon poly; for (rapidjson::SizeType j = 0; j < geometry.Size(); ++j) { @@ -153,10 +156,8 @@ parseJSONTile(const rapidjson::GenericValue, rapidjson::CrtAll EXPECT_TRUE(pt.Size() >= 2); EXPECT_TRUE(pt[0].IsNumber()); EXPECT_TRUE(pt[1].IsNumber()); - linear_ring.emplace_back( - static_cast(pt[0].GetInt()), - static_cast(pt[1].GetInt()) - ); + linear_ring.emplace_back(static_cast(pt[0].GetInt()), + static_cast(pt[1].GetInt())); } poly.emplace_back(linear_ring); } @@ -183,7 +184,8 @@ mapbox::geometry::feature_collection parseJSONTile(const std::string& d return parseJSONTile(d); } -std::map> parseJSONTiles(const std::string& data) { +std::map> +parseJSONTiles(const std::string& data) { std::map> result; rapidjson::GenericDocument, rapidjson::CrtAllocator> d; d.Parse<0>(data.c_str()); diff --git a/test/util.hpp b/test/util.hpp index 51c89d7..cfc6308 100644 --- a/test/util.hpp +++ b/test/util.hpp @@ -1,20 +1,24 @@ #pragma once -#include +#include #include #include +#include #include -#include namespace mapbox { namespace geojsonvt { std::string loadFile(const std::string& filename); mapbox::geometry::feature_collection parseJSONTile(const std::string& data); -std::map> parseJSONTiles(const std::string& data); -bool operator==(const mapbox::geometry::feature& a, const mapbox::geometry::feature& b); -bool operator==(const mapbox::geometry::feature_collection& a, const mapbox::geometry::feature_collection& b); -bool operator==(const std::map>& a, const std::map>& b); +std::map> +parseJSONTiles(const std::string& data); +bool operator==(const mapbox::geometry::feature& a, + const mapbox::geometry::feature& b); +bool operator==(const mapbox::geometry::feature_collection& a, + const mapbox::geometry::feature_collection& b); +bool operator==(const std::map>& a, + const std::map>& b); bool operator==(const mapbox::geojsonvt::Tile& a, const mapbox::geojsonvt::Tile& b); namespace detail {