summaryrefslogtreecommitdiff
path: root/src/Simplex_tree/test
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-10-02 16:05:31 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-10-02 16:05:31 +0000
commit5f4229227fe747ce08b1f296596343d9fdf79535 (patch)
treec0519f2ea01639f038f9ebaf7c045463dbf199e5 /src/Simplex_tree/test
parent527d4871c7826d5a07686c5e3f1f6edb18fbdc3d (diff)
Code review : Factorize copy_from and move_from for copy/move assignment/ctor
Make rec_copy private Factorize root members recursive deletion In move, test that (map_el.second.children() != &(complex_source.root_)) instead of (map_el.second.children()->oncles == &(complex_source.root_)) => more efficient Support self copy assignment detection No more use of std::swap in move assignment git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/simplex_tree_fix_vincent@3924 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 3aa3727294e54b4ffbc48c3cdb901facf3cd59d7
Diffstat (limited to 'src/Simplex_tree/test')
-rw-r--r--src/Simplex_tree/test/simplex_tree_ctor_and_move_unit_test.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Simplex_tree/test/simplex_tree_ctor_and_move_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_ctor_and_move_unit_test.cpp
index 6c27a458..e729cf00 100644
--- a/src/Simplex_tree/test/simplex_tree_ctor_and_move_unit_test.cpp
+++ b/src/Simplex_tree/test/simplex_tree_ctor_and_move_unit_test.cpp
@@ -88,6 +88,11 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_copy_constructor, Simplex_tree, list_of_te
BOOST_CHECK(st == st4);
BOOST_CHECK(st3 == st);
+ st = st;
+ print_simplex_filtration(st4, "Third self copy assignment from the default Simplex_tree");
+
+ BOOST_CHECK(st3 == st);
+
std::cout << "********************************************************************" << std::endl;
std::cout << "TEST OF MOVE CONSTRUCTOR" << std::endl;
Simplex_tree st5(std::move(st1));
@@ -124,4 +129,9 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_copy_constructor, Simplex_tree, list_of_te
BOOST_CHECK(st == st8);
BOOST_CHECK(st7 == st);
+ st = std::move(st);
+ print_simplex_filtration(st, "Third self move assignment from the default Simplex_tree");
+
+ BOOST_CHECK(st7 == st);
+
}