mirror of
https://github.com/jhasse/poly2tri.git
synced 2024-11-30 01:03:30 +01:00
Add unittest to check stack overflow crash
Signed-off-by: AndriyAndreyev <andriy.a.andreyev@gmail.com>
This commit is contained in:
parent
afee3269fa
commit
563239da07
@ -188,6 +188,41 @@ BOOST_AUTO_TEST_CASE(PolygonTest03)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(PolygonTest04)
|
||||||
|
{
|
||||||
|
std::vector<p2t::Point*> polyline {
|
||||||
|
new p2t::Point(450, 2250),
|
||||||
|
new p2t::Point(450, 1750),
|
||||||
|
new p2t::Point(400, 1700),
|
||||||
|
new p2t::Point(350, 1650),
|
||||||
|
new p2t::Point(350, 500),
|
||||||
|
new p2t::Point(1050, 1700)
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<p2t::Point*> hole {
|
||||||
|
new p2t::Point(980, 1636),
|
||||||
|
new p2t::Point(950, 1600),
|
||||||
|
new p2t::Point(650, 1230),
|
||||||
|
new p2t::Point(625, 1247),
|
||||||
|
new p2t::Point(600, 1250),
|
||||||
|
new p2t::Point(591, 1350),
|
||||||
|
new p2t::Point(550, 2050)
|
||||||
|
};
|
||||||
|
|
||||||
|
p2t::CDT cdt{ polyline };
|
||||||
|
cdt.AddHole(hole);
|
||||||
|
|
||||||
|
BOOST_CHECK_NO_THROW(cdt.Triangulate());
|
||||||
|
const auto result = cdt.GetTriangles();
|
||||||
|
BOOST_REQUIRE_EQUAL(result.size(), 13);
|
||||||
|
for (const auto p : polyline) {
|
||||||
|
delete p;
|
||||||
|
}
|
||||||
|
for (const auto p : hole) {
|
||||||
|
delete p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(TestbedFilesTest)
|
BOOST_AUTO_TEST_CASE(TestbedFilesTest)
|
||||||
{
|
{
|
||||||
for (const auto& filename : { "custom.dat", "diamond.dat", "star.dat", "test.dat" }) {
|
for (const auto& filename : { "custom.dat", "diamond.dat", "star.dat", "test.dat" }) {
|
||||||
|
Loading…
Reference in New Issue
Block a user