Skip to content

Commit 10044ea

Browse files
committed
#139 Add a regression test
1 parent 743a35c commit 10044ea

File tree

4 files changed

+93
-0
lines changed

4 files changed

+93
-0
lines changed

CDT/tests/cdt.test.cpp

+31
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <chrono>
1212
#include <fstream>
1313
#include <iostream>
14+
#include <map>
15+
#include <numeric>
1416
#include <sstream>
1517

1618
using namespace CDT;
@@ -782,3 +784,32 @@ TEST_CASE("Don't flip constraint edge when resolving intersection", "")
782784
REQUIRE(topologyString(cdt) == topologyString(outFile));
783785
}
784786
}
787+
788+
TEST_CASE(
789+
"Regression: resolving edges intersection with a hanging edge in a "
790+
"pseudo-polygon",
791+
"")
792+
{
793+
const auto inputFile = std::string("HangingIntersection.txt");
794+
const auto order = VertexInsertionOrder::Auto;
795+
const auto intersectingEdgesStrategy = IntersectingConstraintEdges::Resolve;
796+
const auto minDistToConstraintEdge = 1e-6;
797+
const auto outFile = "expected/" +
798+
inputFile.substr(0, inputFile.size() - 4) + "__f64_" +
799+
to_string(order) + "_" +
800+
to_string(intersectingEdgesStrategy) + "_all.txt";
801+
802+
const auto [vv, ee] = readInputFromFile<double>("inputs/" + inputFile);
803+
auto cdt = Triangulation<double>(
804+
order, intersectingEdgesStrategy, minDistToConstraintEdge);
805+
cdt.insertVertices(vv);
806+
cdt.insertEdges(ee);
807+
REQUIRE(CDT::verifyTopology(cdt));
808+
809+
if(updateFiles)
810+
topologyToFile(outFile, cdt);
811+
else
812+
{
813+
REQUIRE(topologyString(cdt) == topologyString(outFile));
814+
}
815+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
17
2+
0 1 6 4294967295 5 3
3+
0 3 2 2 7 4294967295
4+
0 4 3 3 9 1
5+
0 6 4 0 12 2
6+
1 2 8 4294967295 8 6
7+
1 7 6 6 14 0
8+
1 8 7 4 15 5
9+
2 3 9 1 10 8
10+
2 9 8 7 16 4
11+
3 4 10 2 12 11
12+
3 5 9 11 13 7
13+
3 10 5 9 13 10
14+
4 6 10 3 14 9
15+
5 10 9 11 16 10
16+
6 7 10 5 15 12
17+
7 8 10 6 16 14
18+
8 9 10 8 13 15
19+
20+
4
21+
3 10
22+
6 10
23+
7 10
24+
8 10
25+
26+
2
27+
6 10 0
28+
8 10 0
29+
30+
4
31+
3 10
32+
1
33+
3 7
34+
6 10
35+
1
36+
6 8
37+
7 10
38+
1
39+
3 7
40+
8 10
41+
1
42+
6 8
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
7 2
2+
725.0 415.0
3+
855.0 390.0
4+
945.0 455.0
5+
1100.0 373.0
6+
1215.0 410.0
7+
1250.0 510.0
8+
943.0 540.0
9+
3 5
10+
0 4
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
7 2
2+
725.0 415.0
3+
855.0 390.0
4+
945.0 455.0
5+
1100.0 373.0
6+
1215.0 410.0
7+
1250.0 510.0
8+
943.0 540.0
9+
3 5
10+
0 4

0 commit comments

Comments
 (0)