[test][within][relate] Add GC tests, some not passing because of a bug in relate

This commit is contained in:
Adam Wulkiewicz 2022-06-08 21:58:40 +02:00
parent ceec0d938b
commit 1ae58c2696
5 changed files with 80 additions and 5 deletions

View File

@ -4,8 +4,8 @@
# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
#
# This file was modified by Oracle on 2014, 2015, 2016.
# Modifications copyright (c) 2014-2016, Oracle and/or its affiliates.
# This file was modified by Oracle on 2014-2022.
# Modifications copyright (c) 2014-2022, Oracle and/or its affiliates.
#
# Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -17,6 +17,7 @@
test-suite boost-geometry-algorithms-equals
:
[ run equals.cpp : : : : algorithms_equals ]
[ run equals_gc.cpp : : : : algorithms_equals_gc ]
[ run equals_multi.cpp : : : : algorithms_equals_multi ]
[ run equals_on_spheroid.cpp : : : : algorithms_equals_on_spheroid ]
[ run equals_sph.cpp : : : : algorithms_equals_sph ]

View File

@ -55,6 +55,16 @@ void test_gc_gc()
test_geometry<gc_t, gc_t>("GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(1 1, 6 6))",
"GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(5 5, 6 6))",
"2FFF1FFF2");
// ERROR IN RELATE
/*test_geometry<gc_t, gc_t>("GEOMETRYCOLLECTION(LINESTRING(4 4, 6 6))",
"GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(1 1, 7 7))",
"10F0FF212");*/
// ERROR IN RELATE
/*test_geometry<gc_t, gc_t>("GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(1 4, 4 1))",
"GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(1 1, 6 6))",
"2FFF1F102");*/
}
void test_g_gc()

View File

@ -4,8 +4,8 @@
# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
#
# This file was modified by Oracle on 2014, 2015, 2016.
# Modifications copyright (c) 2014-2016, Oracle and/or its affiliates.
# This file was modified by Oracle on 2014-2022.
# Modifications copyright (c) 2014-2022, Oracle and/or its affiliates.
#
# Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -18,6 +18,7 @@ test-suite boost-geometry-algorithms-within
:
[ run within.cpp : : : : algorithms_within ]
[ run within_areal_areal.cpp : : : : algorithms_within_areal_areal ]
[ run within_gc.cpp : : : : algorithms_within_gc ]
[ run within_linear_areal.cpp : : : : algorithms_within_linear_areal ]
[ run within_linear_linear.cpp : : : : algorithms_within_linear_linear ]
[ run within_multi.cpp : : : : algorithms_within_multi ]

View File

@ -76,7 +76,7 @@ void test_geometry(std::string const& wkt1,
boost::variant<Geometry1> v1(geometry1);
boost::variant<Geometry2> v2(geometry2);
typedef typename bg::strategy::within::services::default_strategy
typedef typename bg::strategies::relate::services::default_strategy
<
Geometry1, Geometry2
>::type strategy_type;

View File

@ -0,0 +1,63 @@
// Boost.Geometry
// Copyright (c) 2022 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// 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 "test_within.hpp"
#include <boost/geometry/geometries/geometries.hpp>
using pt_t = bg::model::point<double, 2, bg::cs::cartesian>;
using ls_t = bg::model::linestring<pt_t>;
using po_t = bg::model::polygon<pt_t>;
using mpt_t = bg::model::multi_point<pt_t>;
using mls_t = bg::model::multi_linestring<ls_t>;
using mpo_t = bg::model::multi_polygon<po_t>;
using var_t = boost::variant<pt_t, ls_t, po_t, mpt_t, mls_t, mpo_t>;
//using var_t = boost::variant2::variant<pt_t, ls_t, po_t, mpt_t, mls_t, mpo_t>;
using gc_t = bg::model::geometry_collection<var_t>;
void test_gc()
{
test_geometry<gc_t, gc_t>("GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(1 1, 4 4))",
"GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(1 4, 4 1))",
true);
test_geometry<gc_t, gc_t>("GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(1 1, 6 6))",
"GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(1 4, 4 1))",
false);
// ERROR IN RELATE
/*test_geometry<gc_t, gc_t>("GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(1 4, 4 1))",
"GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(1 1, 6 6))",
true);*/
test_geometry<gc_t, gc_t>("GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(1 1, 6 6))",
"GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(5 5, 6 6))",
true);
test_geometry<gc_t, gc_t>("GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(1 1, 6 6), POINT(0 6))",
"GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(5 5, 6 6))",
false);
test_geometry<gc_t, gc_t>("GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(5 5, 6 6))",
"GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(1 1, 6 6), POINT(0 6))",
true);
test_geometry<gc_t, gc_t>("GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(1 1, 6 6), POINT(0 6))",
"GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(5 5, 6 6), POINT(0 6))",
true);
test_geometry<po_t, gc_t>("POLYGON((0 0,0 5,5 5,5 0,0 0))",
"GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(1 1, 4 4))",
true);
test_geometry<gc_t, po_t>("GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(1 1, 6 6))",
"POLYGON((0 0,0 5,5 5,5 0,0 0))",
false);
}
int test_main(int , char* [])
{
test_gc();
return 0;
}