Merge pull request #4612 from MaelRL/CGAL-Fix_initializing_variable_in_assertions-GF

Fix some tests intializing or changing data in assertions
This commit is contained in:
Sebastien Loriot 2020-04-06 15:32:48 +02:00 committed by GitHub
commit 625c1e249a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 17 deletions

View File

@ -156,7 +156,8 @@ std::vector<LCC> lcc_data()
template <typename Graph>
struct Surface_fixture_1 {
Surface_fixture_1() {
assert(read_a_mesh(m, "data/fixture1.off"));
const bool is_reading_successful = read_a_mesh(m, "data/fixture1.off");
assert(is_reading_successful);
assert(CGAL::is_valid_polygon_mesh(m));
typename boost::property_map<Graph, CGAL::vertex_point_t>::const_type
pm = get(CGAL::vertex_point, const_cast<const Graph&>(m));
@ -205,7 +206,8 @@ struct Surface_fixture_1 {
template <typename Graph>
struct Surface_fixture_2 {
Surface_fixture_2() {
assert(read_a_mesh(m, "data/fixture2.off"));
const bool is_reading_successful = read_a_mesh(m, "data/fixture2.off");
assert(is_reading_successful);
assert(CGAL::is_valid_polygon_mesh(m));
typename boost::property_map<Graph, CGAL::vertex_point_t>::const_type
@ -266,7 +268,8 @@ struct Surface_fixture_2 {
template <typename Graph>
struct Surface_fixture_3 {
Surface_fixture_3() {
assert(read_a_mesh(m, "data/fixture3.off"));
const bool is_reading_successful = read_a_mesh(m, "data/fixture3.off");
assert(is_reading_successful);
assert(CGAL::is_valid_polygon_mesh(m));
typename boost::property_map<Graph, CGAL::vertex_point_t>::const_type
@ -312,7 +315,8 @@ struct Surface_fixture_3 {
template <typename Graph>
struct Surface_fixture_4 {
Surface_fixture_4() {
assert(read_a_mesh(m, "data/fixture4.off"));
const bool is_reading_successful = read_a_mesh(m, "data/fixture4.off");
assert(is_reading_successful);
assert(CGAL::is_valid_polygon_mesh(m));
typename boost::property_map<Graph, CGAL::vertex_point_t>::const_type
@ -347,7 +351,8 @@ struct Surface_fixture_4 {
template <typename Graph>
struct Surface_fixture_5 {
Surface_fixture_5() {
assert(read_a_mesh(m, "data/add_face_to_border.off"));
const bool is_reading_successful = read_a_mesh(m, "data/add_face_to_border.off");
assert(is_reading_successful);
assert(CGAL::is_valid_polygon_mesh(m));
typename boost::property_map<Graph, CGAL::vertex_point_t>::const_type
@ -377,7 +382,8 @@ struct Surface_fixture_5 {
template <typename Graph>
struct Surface_fixture_6 {
Surface_fixture_6() {
assert(read_a_mesh(m, "data/quad.off"));
const bool is_reading_successful = read_a_mesh(m, "data/quad.off");
assert(is_reading_successful);
assert(CGAL::is_valid_polygon_mesh(m));
typename boost::graph_traits<Graph>::halfedge_descriptor h;
@ -396,7 +402,8 @@ struct Surface_fixture_6 {
template <typename Graph>
struct Surface_fixture_7 {
Surface_fixture_7() {
assert(read_a_mesh(m, "data/cube.off"));
const bool is_reading_successful = read_a_mesh(m, "data/cube.off");
assert(is_reading_successful);
assert(CGAL::is_valid_polygon_mesh(m));
h = *(halfedges(m).first);
@ -409,7 +416,8 @@ struct Surface_fixture_7 {
template <typename Graph>
struct Surface_fixture_8 {
Surface_fixture_8() {
assert(read_a_mesh(m, "data/fixture5.off"));
const bool is_reading_successful = read_a_mesh(m, "data/fixture5.off");
assert(is_reading_successful);
assert(CGAL::is_valid_polygon_mesh(m));
typename boost::property_map<Graph, CGAL::vertex_point_t>::const_type

View File

@ -217,7 +217,8 @@ _test_cls_constrained_triangulation(const Triang &)
vha = fh->vertex(li);
fh = T1_2.locate(Point(3,2),lt,li); assert( lt == Triang::VERTEX );
vhb = fh->vertex(li);
assert(T1_2.is_edge(vha,vhb, fh, ih));
bool check = T1_2.is_edge(vha,vhb, fh, ih);
assert(check);
assert(fh->is_constrained(ih));
T1_2.remove_constrained_edge(fh,ih);
assert(T1_2.is_valid());
@ -250,7 +251,7 @@ _test_cls_constrained_triangulation(const Triang &)
vha = fh->vertex(li);
fh = T2_2.locate(lpt[m+1],lt,li); assert( lt == Triang::VERTEX );
vhb = fh->vertex(li);
bool check = T2_2.is_edge(vha,vhb, fh, ih);
check = T2_2.is_edge(vha,vhb, fh, ih);
assert(check);
assert(fh->is_constrained(ih));
T2_2.remove_constrained_edge(fh,ih);

View File

@ -293,7 +293,8 @@ _test_cls_delaunay_triangulation_2( const Del & )
assert(TM_0.tds().is_valid());
assert(TM_0.is_valid());
assert(TM_0.dimension() == 2);
assert(TM_0.move_if_no_collision(tmv1, Point(3, 0)) != tmv1);
Vertex_handle mtmv1 = TM_0.move_if_no_collision(tmv1, Point(3, 0));
assert(mtmv1 != tmv1);
TM_0.move_if_no_collision(tmv1, Point(0, 1));
assert(TM_0.tds().is_valid());
@ -340,7 +341,8 @@ _test_cls_delaunay_triangulation_2( const Del & )
// A simple test to see if move return the good vertex
// when there is a collision
assert(TM_1.move(TM_1.finite_vertices_begin(), vTM_1->point()) == vTM_1);
Vertex_handle mvTM_1 = TM_1.move(TM_1.finite_vertices_begin(), vTM_1->point());
assert(mvTM_1 == vTM_1);
}

View File

@ -270,11 +270,13 @@ _test_cls_triangulation_2( const Triangul & )
assert( T2_3.is_valid() );
// make sure inserting on a previous point does not insert it again
assert( T2_3.insert(p10) == v2_3_10 );
Vertex_handle vp10 = T2_3.insert(p10);
assert( vp10 == v2_3_10 );
assert( T2_3.number_of_vertices() == 11 );
// make sure push_back exists and does the same thing as insert
assert( T2_3.push_back(p10) == v2_3_10 );
vp10 = T2_3.push_back(p10);
assert( vp10 == v2_3_10 );
assert( T2_3.number_of_vertices() == 11 );
// test generic iterator insert
@ -288,14 +290,16 @@ _test_cls_triangulation_2( const Triangul & )
// test list iterator insert
Triangul T2_5;
assert( T2_5.insert(l.begin(), l.end()) == 10 );
std::ptrdiff_t T2_5_nv = T2_5.insert(l.begin(), l.end());
assert( T2_5_nv == 10 );
assert( T2_5.dimension() == 2 );
assert( T2_5.number_of_vertices() == 10 );
assert( T2_5.is_valid() );
// test list iterator insert
Triangul T2_6;
assert( T2_6.insert(v.begin(), v.end()) == 10 );
std::ptrdiff_t T2_6_nv = T2_6.insert(v.begin(), v.end());
assert( T2_6_nv == 10 );
assert( T2_6.dimension() == 2 );
assert( T2_6.number_of_vertices() == 10 );
assert( T2_6.is_valid() );
@ -451,7 +455,8 @@ _test_cls_triangulation_2( const Triangul & )
// A simple test to see if move returns the good vertex
// when there is a collision
assert(TM_1.move(TM_1.finite_vertices_begin(), vTM_1->point()) == vTM_1);
Vertex_handle mvTM_1 = TM_1.move(TM_1.finite_vertices_begin(), vTM_1->point());
assert(mvTM_1 == vTM_1);
/****************************/
/***** CONSTRUCTORS (2) *****/