mirror of https://github.com/CGAL/cgal
Saved the expected result (whether the polygon is valid or not) in the input file.
This commit is contained in:
parent
280459105d
commit
a6d9def619
|
|
@ -14,3 +14,4 @@
|
||||||
5 1
|
5 1
|
||||||
3 1
|
3 1
|
||||||
|
|
||||||
|
0
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,4 @@
|
||||||
|
|
||||||
0
|
0
|
||||||
|
|
||||||
|
1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,4 +15,4 @@
|
||||||
6 8
|
6 8
|
||||||
7 6
|
7 6
|
||||||
|
|
||||||
|
0
|
||||||
|
|
|
||||||
|
|
@ -17,3 +17,5 @@
|
||||||
5 5
|
5 5
|
||||||
7 5
|
7 5
|
||||||
7 4
|
7 4
|
||||||
|
|
||||||
|
0
|
||||||
|
|
|
||||||
|
|
@ -16,3 +16,5 @@
|
||||||
2 6
|
2 6
|
||||||
6 6
|
6 6
|
||||||
6 2
|
6 2
|
||||||
|
|
||||||
|
0
|
||||||
|
|
|
||||||
|
|
@ -16,3 +16,5 @@
|
||||||
2 6
|
2 6
|
||||||
6 6
|
6 6
|
||||||
6 2
|
6 2
|
||||||
|
|
||||||
|
0
|
||||||
|
|
|
||||||
|
|
@ -13,3 +13,5 @@
|
||||||
2 6
|
2 6
|
||||||
4 6
|
4 6
|
||||||
4 0
|
4 0
|
||||||
|
|
||||||
|
0
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,4 @@
|
||||||
|
|
||||||
0
|
0
|
||||||
|
|
||||||
|
0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,4 @@
|
||||||
|
|
||||||
0
|
0
|
||||||
|
|
||||||
|
1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,3 +17,5 @@
|
||||||
4 4
|
4 4
|
||||||
2 6
|
2 6
|
||||||
6 6
|
6 6
|
||||||
|
|
||||||
|
1
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ typedef Traits_2::Polygon_with_holes_2 Polygon_with_holes_2;
|
||||||
* is displayed if the validation result does't equal is_valid.
|
* is displayed if the validation result does't equal is_valid.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool test(const std::string& filename, std::ofstream& outfile, bool is_valid)
|
bool test(const std::string& filename, std::ofstream& outfile)
|
||||||
{
|
{
|
||||||
std::ifstream input_file(filename.c_str());
|
std::ifstream input_file(filename.c_str());
|
||||||
|
|
||||||
|
|
@ -60,12 +60,14 @@ bool test(const std::string& filename, std::ofstream& outfile, bool is_valid)
|
||||||
// Read a polygon with holes from a file.
|
// Read a polygon with holes from a file.
|
||||||
Polygon_2 outer_pgn;
|
Polygon_2 outer_pgn;
|
||||||
size_t num_holes;
|
size_t num_holes;
|
||||||
|
bool is_valid;
|
||||||
|
|
||||||
input_file >> outer_pgn;
|
input_file >> outer_pgn;
|
||||||
input_file >> num_holes;
|
input_file >> num_holes;
|
||||||
|
|
||||||
std::vector<Polygon_2> holes(num_holes);
|
std::vector<Polygon_2> holes(num_holes);
|
||||||
for (size_t k = 0; k < num_holes; ++k) input_file >> holes[k];
|
for (size_t k = 0; k < num_holes; ++k) input_file >> holes[k];
|
||||||
|
input_file >> is_valid;
|
||||||
|
|
||||||
Polygon_with_holes_2 P(outer_pgn, holes.begin(), holes.end());
|
Polygon_with_holes_2 P(outer_pgn, holes.begin(), holes.end());
|
||||||
Traits_2 tr;
|
Traits_2 tr;
|
||||||
bool test_valid = CGAL::is_valid_polygon_with_holes(P, tr);
|
bool test_valid = CGAL::is_valid_polygon_with_holes(P, tr);
|
||||||
|
|
@ -114,9 +116,7 @@ int main()
|
||||||
strs << i;
|
strs << i;
|
||||||
strs >> si;
|
strs >> si;
|
||||||
std::string filename = testfile_prefix + si + testfile_suffix;
|
std::string filename = testfile_prefix + si + testfile_suffix;
|
||||||
bool is_valid_pgn = false;
|
bool res = test(filename, output_file);
|
||||||
if (i > 7) is_valid_pgn = true;
|
|
||||||
bool res = test(filename, output_file, is_valid_pgn);
|
|
||||||
if (!res) {
|
if (!res) {
|
||||||
std::cout << "test " << i << " failed" << std::endl;
|
std::cout << "test " << i << " failed" << std::endl;
|
||||||
result = 1;
|
result = 1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue