mapnik/test/unit/geometry/geometry_is_valid.cpp

32 lines
724 B
C++
Raw Normal View History

2015-04-22 13:44:21 +00:00
#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
2015-04-22 13:44:21 +00:00
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
2015-04-22 13:44:21 +00:00
}