mirror of
https://github.com/boostorg/geometry.git
synced 2026-02-19 02:22:08 +00:00
[test] add testcase for #10661, still failing w.r.t. validity in second stage.
To enable scenarios like this, let unit test return WKT
This commit is contained in:
@@ -461,6 +461,16 @@ static std::string ticket_9081[2] =
|
||||
"MULTIPOLYGON(((0.2099392122251989 0.492066865490789,0.1124301889095737 0.5124668111209448,0.3306914939102383 0.6126684490171914,0.2099392122251989 0.492066865490789)),((0.5885369465145437 0.6478961722242873,0.5342320718598281 0.6686303269145104,0.5619623880692838 0.7033299168703926,0.5945761233023867 0.6823532655194001,0.5885369465145437 0.6478961722242873)),((0.5570738195183501 0.6001870087680015,0.5429714753344335 0.6231021858940831,0.5880357506342242 0.6450365518134291,0.5838690879677763 0.6212632646137447,0.568218114394707 0.5970364466647042,0.5570738195183501 0.6001870087680015)),((0.5498478321815098 0.5029279381860542,0.608691671498764 0.5163121433149205,0.5636607291345047 0.5894838094559455,0.8595233008819849 0.8301950132755517,0.8285440738598029 0.8412277162756114,0.9591357158116398 0.9011810663167211,0.8572649311807611 0.3566393017365032,0.5965816668471951 0.4111770689940296,0.5498478321815098 0.5029279381860542)),((0.3984249865018206 0.4526335964808558,0.3621206996557855 0.4602288471829723,0.4183516736935784 0.4730187483833363,0.4099611282054451 0.4644351568071601,0.3984249865018206 0.4526335964808558)))"
|
||||
};
|
||||
|
||||
// Integer, ccw, open
|
||||
static std::string ticket_10661[3] =
|
||||
{
|
||||
/* A */ "MULTIPOLYGON(((1701 985,3501 985,3501 2785,1701 2785,1701 985)))",
|
||||
/* B */ "MULTIPOLYGON(((1698 1860,1698 1122,2598 1392,3492 1842,3492 32706,2598 2340,1698 1860)))",
|
||||
/* C=A-B, */
|
||||
/* D */ "MULTIPOLYGON(((1698 2772,1698 1860,2598 2340,3492 2412,3492 32743,1698 2772)))"
|
||||
// Reported problem was: validity of difference C-D
|
||||
};
|
||||
|
||||
// Integer, ccw, open
|
||||
static std::string ticket_10803[2] =
|
||||
{
|
||||
|
||||
@@ -206,6 +206,29 @@ void test_specific()
|
||||
2, -1, -1,
|
||||
settings);
|
||||
}
|
||||
|
||||
{
|
||||
ut_settings settings;
|
||||
settings.test_validity = true;
|
||||
|
||||
std::string a_min_b =
|
||||
test_one<polygon, multi_polygon, multi_polygon>("ticket_10661_1",
|
||||
ticket_10661[0], ticket_10661[1],
|
||||
2, 11, 1441632.5,
|
||||
2, 7, 13167454,
|
||||
settings);
|
||||
|
||||
settings.test_validity = false;
|
||||
#ifdef BOOST_GEOMETRY_TEST_INCLUDE_FAILING_TESTS
|
||||
settings.test_validity = true;
|
||||
#endif
|
||||
test_one<polygon, multi_polygon, multi_polygon>("ticket_10661_2",
|
||||
a_min_b, ticket_10661[2],
|
||||
1, 8, 825192.0,
|
||||
1, 10, 27226370.5,
|
||||
1, -1, 825192.0 + 27226370.5,
|
||||
settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ void difference_output(std::string const& caseid, G1 const& g1, G2 const& g2, Ou
|
||||
}
|
||||
|
||||
template <typename OutputType, typename G1, typename G2>
|
||||
void test_difference(std::string const& caseid, G1 const& g1, G2 const& g2,
|
||||
std::string test_difference(std::string const& caseid, G1 const& g1, G2 const& g2,
|
||||
int expected_count, int expected_point_count,
|
||||
double expected_area,
|
||||
bool sym,
|
||||
@@ -141,6 +141,9 @@ void test_difference(std::string const& caseid, G1 const& g1, G2 const& g2,
|
||||
bg::remove_spikes(result);
|
||||
}
|
||||
|
||||
std::ostringstream return_string;
|
||||
return_string << bg::wkt(result);
|
||||
|
||||
typename bg::default_area_result<G1>::type const area = bg::area(result);
|
||||
std::size_t const n = expected_point_count >= 0
|
||||
? bg::num_points(result) : 0;
|
||||
@@ -215,6 +218,7 @@ void test_difference(std::string const& caseid, G1 const& g1, G2 const& g2,
|
||||
#endif
|
||||
|
||||
|
||||
return return_string.str();
|
||||
}
|
||||
|
||||
|
||||
@@ -224,7 +228,7 @@ static int counter = 0;
|
||||
|
||||
|
||||
template <typename OutputType, typename G1, typename G2>
|
||||
void test_one(std::string const& caseid,
|
||||
std::string test_one(std::string const& caseid,
|
||||
std::string const& wkt1, std::string const& wkt2,
|
||||
int expected_count1,
|
||||
int expected_point_count1,
|
||||
@@ -246,12 +250,12 @@ void test_one(std::string const& caseid,
|
||||
bg::correct(g1);
|
||||
bg::correct(g2);
|
||||
|
||||
test_difference<OutputType>(caseid + "_a", g1, g2,
|
||||
std::string result = test_difference<OutputType>(caseid + "_a", g1, g2,
|
||||
expected_count1, expected_point_count1,
|
||||
expected_area1, false, settings);
|
||||
|
||||
#ifdef BOOST_GEOMETRY_DEBUG_ASSEMBLE
|
||||
return;
|
||||
return result;
|
||||
#endif
|
||||
|
||||
test_difference<OutputType>(caseid + "_b", g2, g1,
|
||||
@@ -266,10 +270,11 @@ void test_one(std::string const& caseid,
|
||||
expected_area_s,
|
||||
true, settings);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename OutputType, typename G1, typename G2>
|
||||
void test_one(std::string const& caseid,
|
||||
std::string test_one(std::string const& caseid,
|
||||
std::string const& wkt1, std::string const& wkt2,
|
||||
int expected_count1,
|
||||
int expected_point_count1,
|
||||
@@ -279,7 +284,7 @@ void test_one(std::string const& caseid,
|
||||
double expected_area2,
|
||||
ut_settings const& settings = ut_settings())
|
||||
{
|
||||
test_one<OutputType, G1, G2>(caseid, wkt1, wkt2,
|
||||
return test_one<OutputType, G1, G2>(caseid, wkt1, wkt2,
|
||||
expected_count1, expected_point_count1, expected_area1,
|
||||
expected_count2, expected_point_count2, expected_area2,
|
||||
expected_count1 + expected_count2,
|
||||
|
||||
Reference in New Issue
Block a user