From d7ea0de1af8d41d518928140eb3c34b3d2fd033b Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 18 Mar 2020 11:49:21 +0100 Subject: [PATCH] Add tests for split and split_plane. --- .../Polygon_mesh_processing/test_pmp_clip.cpp | 88 +++++++++++++++++-- 1 file changed, 79 insertions(+), 9 deletions(-) diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp index 0fb9319c9f3..aa63899f127 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp @@ -470,50 +470,120 @@ void test_split_plane() { // test with a clipper mesh Mesh tm1; - std::ifstream input("data-coref/elephant.off"); input >> tm1; + + if(!input) + { + std::cerr<<"File not found. Aborting."< meshes; - PMP::split_connected_components(tm1, - meshes, - params::all_default()); - //CGAL_assertion(meshes.size() == 3); - CGAL::clear(tm1); + std::vector meshes; + PMP::split_connected_components(tm1, meshes, params::all_default()); + CGAL_assertion(meshes.size() == 3); + //if the order is not deterministc, put the num_vertices in a list and check + //if the list does contain all those numbers. + CGAL_assertion(num_vertices(meshes[2]) == 48); + CGAL_assertion(num_vertices(meshes[0]) == 1527); + CGAL_assertion(num_vertices(meshes[1]) == 1674); + + CGAL::clear(tm1); } template void test_split() { - // test with a clipper mesh TriangleMesh tm1, tm2; - //closed intersection curves std::ifstream input("data-coref/elephant.off"); input >> tm1; + + if(!input) + { + std::cerr<<"File not found. Aborting."<> tm2; + + if(!input) + { + std::cerr<<"File not found. Aborting."< meshes; + PMP::split(tm1, tm2); + PMP::split_connected_components(tm1, + meshes, + params::all_default()); + + CGAL_assertion(meshes.size() == 5); + //if the order is not deterministc, put the num_vertices in a list and check + //if the list does contain all those numbers. + CGAL_assertion(num_vertices(meshes[0]) == 2641); + CGAL_assertion(num_vertices(meshes[1]) == 159); + CGAL_assertion(num_vertices(meshes[2]) == 142); + CGAL_assertion(num_vertices(meshes[3]) == 83); + CGAL_assertion(num_vertices(meshes[4]) == 104); + CGAL::clear(tm1); CGAL::clear(tm2); + meshes.clear(); // open intersection curve input.open("data-clip/split_A.off"); input >> tm1; + + if(!input) + { + std::cerr<<"File not found. Aborting."<> tm2; + + if(!input) + { + std::cerr<<"File not found. Aborting."<