From 23c6f4e26b60374d9df37445598c087ff6b52512 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 21 Aug 2018 12:05:28 +0000 Subject: Add DEBUG_TRACES for the test Add move constructor test git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/simplex_tree_fix_vincent@3818 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 4e9baaedcbcb6fdfc7b5ee0ac42bc75559b67bd1 --- src/Simplex_tree/include/gudhi/Simplex_tree.h | 6 ++++++ .../test/simplex_tree_ctor_and_move_unit_test.cpp | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index ca3575ba..d604f994 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -301,7 +301,9 @@ class Simplex_tree { root_(nullptr, null_vertex_ , simplex_source.root_.members_), filtration_vect_(), dimension_(simplex_source.dimension_) { +#ifdef DEBUG_TRACES std::cout << "copy constructor" << std::endl; +#endif // DEBUG_TRACES auto root_source = simplex_source.root_; rec_copy(&root_, &root_source); } @@ -327,7 +329,9 @@ class Simplex_tree { root_(std::move(old.root_)), filtration_vect_(std::move(old.filtration_vect_)), dimension_(std::move(old.dimension_)) { +#ifdef DEBUG_TRACES std::cout << "move constructor" << std::endl; +#endif // DEBUG_TRACES old.dimension_ = -1; old.root_ = Siblings(nullptr, null_vertex_); } @@ -344,7 +348,9 @@ class Simplex_tree { /** \brief User-defined copy assignment reproduces the whole tree structure. */ Simplex_tree& operator= (const Simplex_tree& simplex_source) { +#ifdef DEBUG_TRACES std::cout << "copy assignment" << std::endl; +#endif // DEBUG_TRACES this->null_vertex_ = simplex_source.null_vertex_; root_ = Siblings(nullptr, null_vertex_ , simplex_source.root_.members_); this->filtration_vect_.clear(); 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 b963d4ee..fb3e595c 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 @@ -62,4 +62,15 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_copy_constructor, Simplex_tree, list_of_te BOOST_CHECK(st3 == st4); BOOST_CHECK(st == st4); BOOST_CHECK(st3 == st); + + std::cout << "********************************************************************" << std::endl; + std::cout << "TEST OF MOVE CONSTRUCTOR" << std::endl; + Simplex_tree st5(std::move(st3)); + Simplex_tree st6(std::move(st4)); + + // Cross check + BOOST_CHECK(st5 == st6); + BOOST_CHECK(st == st6); + BOOST_CHECK(st5 == st); + } -- cgit v1.2.3