mapnik/tests/cxx/geometry_is_valid.cpp
Matt Amos 79f29f3894 Disable missing geometry functions in older Boost versions.
The functions `is_valid` and `is_simple` and their associated
headers are only present in versions of Boost >= 1.56, and will
cause compilation errors with previous versions of Boost. This
masks them with preprocessor macros to allow the compilation to
complete, at the cost of some (currently not widely used)
functionality.
2015-04-23 03:52:46 +01:00

31 lines
724 B
C++

#include "catch.hpp"
#include <mapnik/geometry.hpp>
#include <mapnik/geometry_adapters.hpp>
#include <mapnik/geometry_is_valid.hpp>
TEST_CASE("geometry is_valid") {
// only Boost >= 1.56 has the is_valid function
#if BOOST_VERSION >= 105600
SECTION("point") {
mapnik::geometry::point<double> pt(0,0);
REQUIRE( mapnik::geometry::is_valid(pt) );
// uninitialized: should likely not be considered valid
mapnik::geometry::point<double> pt2;
REQUIRE( mapnik::geometry::is_valid(pt2) );
}
SECTION("line_string") {
mapnik::geometry::line_string<double> line;
line.add_coord(0,0);
line.add_coord(1,1);
REQUIRE( mapnik::geometry::is_valid(line) );
}
#endif // BOOST_VERSION >= 1.56
}