mirror of https://github.com/CGAL/cgal
Add tests for move constructors
This commit is contained in:
parent
f218fb8d3a
commit
ba9f226891
|
|
@ -421,7 +421,20 @@ _test_cls_delaunay_3(const Triangulation &)
|
||||||
assert(T1.number_of_vertices() == 0);
|
assert(T1.number_of_vertices() == 0);
|
||||||
assert(T1.is_valid());
|
assert(T1.is_valid());
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
{
|
||||||
|
Cls T_copy(T0);
|
||||||
|
assert(T_copy.dimension() == 3);
|
||||||
|
assert(T_copy.number_of_vertices() == 4);
|
||||||
|
assert(T_copy.is_valid());
|
||||||
|
Cls T_move_constructed(std::move(T_copy));
|
||||||
|
assert(T_move_constructed.dimension() == 3);
|
||||||
|
assert(T_move_constructed.number_of_vertices() == 4);
|
||||||
|
assert(T_move_constructed.is_valid());
|
||||||
|
assert(T_copy.dimension() == -2);
|
||||||
|
assert(T_copy.number_of_vertices() == -1);
|
||||||
|
assert(T_copy.is_valid());
|
||||||
|
}
|
||||||
|
|
||||||
// Affectation :
|
// Affectation :
|
||||||
T1=T0;
|
T1=T0;
|
||||||
|
|
|
||||||
|
|
@ -205,6 +205,16 @@ _test_cls_regular_3(const Triangulation &)
|
||||||
<< T.number_of_vertices() << std::endl;
|
<< T.number_of_vertices() << std::endl;
|
||||||
assert(T.is_valid());
|
assert(T.is_valid());
|
||||||
assert(T.dimension()==3);
|
assert(T.dimension()==3);
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
{
|
||||||
|
Triangulation T_copy(T);
|
||||||
|
assert(T_copy == T);
|
||||||
|
assert(T_copy == T);
|
||||||
|
Triangulation T_move_constructed(std::move(T_copy));
|
||||||
|
assert(T_move_constructed == T);
|
||||||
|
assert(T_copy.dimension() == -2);
|
||||||
|
assert(T_copy.number_of_vertices() == -1);
|
||||||
|
assert(T_copy.is_valid());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -286,7 +286,20 @@ _test_cls_triangulation_3(const Triangulation &)
|
||||||
assert(T1.number_of_vertices() == 0);
|
assert(T1.number_of_vertices() == 0);
|
||||||
assert(T1.is_valid());
|
assert(T1.is_valid());
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
{
|
||||||
|
Cls T_copy(T0);
|
||||||
|
assert(T_copy.dimension() == 3);
|
||||||
|
assert(T_copy.number_of_vertices() == 4);
|
||||||
|
assert(T_copy.is_valid());
|
||||||
|
Cls T_move_constructed(std::move(T_copy));
|
||||||
|
assert(T_move_constructed.dimension() == 3);
|
||||||
|
assert(T_move_constructed.number_of_vertices() == 4);
|
||||||
|
assert(T_move_constructed.is_valid());
|
||||||
|
assert(T_copy.dimension() == -2);
|
||||||
|
assert(T_copy.number_of_vertices() == -1);
|
||||||
|
assert(T_copy.is_valid());
|
||||||
|
}
|
||||||
|
|
||||||
// Assignment
|
// Assignment
|
||||||
T1=T0;
|
T1=T0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue