Merge cartesian covered_by tests in one file

This commit is contained in:
Vissarion Fisikopoulos 2022-07-27 16:04:45 +03:00
parent 6b8c31ee3d
commit 8472f93658
3 changed files with 15 additions and 55 deletions

View File

@ -18,7 +18,6 @@ test-suite boost-geometry-algorithms-covered_by
:
[ run covered_by.cpp : : : : algorithms_covered_by ]
[ run covered_by_gc.cpp : : : : algorithms_covered_by_gc ]
[ run covered_by_multi.cpp : : : : algorithms_covered_by_multi ]
[ run covered_by_sph.cpp : : : : algorithms_covered_by_sph ]
[ run covered_by_sph_geo.cpp : : : : algorithms_covered_by_sph_geo ]
;

View File

@ -85,6 +85,21 @@ void test_all()
test_geometry<P, bg::model::polygon<P> >("POINT(2 2)",
"POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,3 1,3 3,1 3,1 1))", false);
// test multi-with-one-polygon (trivial case)
test_geometry<P, mpoly>("POINT(1 1)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", true);
test_geometry<P, mpoly>("POINT(3 3)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", false);
test_geometry<P, mpoly>("POINT(0 1)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", true);
test_geometry<P, mpoly>("POINT(4 4)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", false);
// test if it is in one of them
std::string multi("MULTIPOLYGON("
"((0 0,0 2,2 2,2 0,0 0))"
"((3 3,3 6,6 6,6 3,3 3))"
")");
test_geometry<P, mpoly>("POINT(4 4)", multi, true);
test_geometry<P, mpoly>("POINT(1 1)", multi, true);
test_geometry<P, mpoly>("POINT(0 1)", multi, true);
// multi_point/A
test_geometry<mpt, ring>("MULTIPOINT(0 0, 1 1)", "POLYGON((0 0,0 2,2 2,2 0,0 0))", true);
@ -190,8 +205,6 @@ int test_main( int , char* [] )
test_all<bg::model::d2::point_xy<int> >();
test_all<bg::model::d2::point_xy<double> >();
//test_spherical<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> > >();
test_mixed();
test_3d();

View File

@ -1,52 +0,0 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <geometry_test_common.hpp>
#include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/algorithms/covered_by.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/core/point_order.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include "test_covered_by.hpp"
template <typename P>
void test_all()
{
typedef bg::model::multi_polygon<bg::model::polygon<P> > mp;
// test multi-with-one-polygon (trivial case)
test_geometry<P, mp>("POINT(1 1)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", true);
test_geometry<P, mp>("POINT(3 3)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", false);
test_geometry<P, mp>("POINT(0 1)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", true);
test_geometry<P, mp>("POINT(4 4)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", false);
// test if it is in one of them
std::string multi("MULTIPOLYGON("
"((0 0,0 2,2 2,2 0,0 0))"
"((3 3,3 6,6 6,6 3,3 3))"
")");
test_geometry<P, mp>("POINT(4 4)", multi, true);
test_geometry<P, mp>("POINT(1 1)", multi, true);
test_geometry<P, mp>("POINT(0 1)", multi, true);
}
int test_main( int , char* [] )
{
//test_all<bg::model::d2::point_xy<int> >();
test_all<bg::model::d2::point_xy<double> >();
return 0;
}