Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added copy constructor, move constructor and copy assignment operator. #826

Merged
merged 16 commits into from
Jan 17, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 1 addition & 33 deletions src/mlpack/tests/det_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,11 +509,7 @@ BOOST_AUTO_TEST_CASE(CopyConstructorAndOperatorTest)
// Constructing copy of DTree using copy constructor and copy operator
DTree<arma::mat> tree2(*tree);
DTree<arma::mat> tree3 = *tree;

// Pointers to children of original tree
DTree<arma::mat>* leftChild = tree->Left();
DTree<arma::mat>* rightChild = tree->Right();


//Deleting original DTree
delete tree;

Expand All @@ -533,13 +529,6 @@ BOOST_AUTO_TEST_CASE(CopyConstructorAndOperatorTest)
BOOST_REQUIRE_EQUAL(tree3.maxVals[2], 8);
BOOST_REQUIRE_EQUAL(tree3.minVals[2], 1);

//Checking children were safely copied
BOOST_REQUIRE(tree2.Left()==leftChild);
BOOST_REQUIRE(tree2.Right()==rightChild);
BOOST_REQUIRE(tree3.Left()==leftChild);
BOOST_REQUIRE(tree3.Right()==rightChild);


}

// Test the move constructor.
Expand All @@ -554,13 +543,6 @@ BOOST_AUTO_TEST_CASE(MoveConstructorTest)
// Constructing a DTree
DTree<arma::mat>* tree = new DTree<arma::mat>(testData);

<<<<<<< HEAD
=======
// Pointers to children of original tree
DTree<arma::mat>* leftChild = tree->Left();
DTree<arma::mat>* rightChild = tree->Right();

>>>>>>> 952211b83dcfe89a39f9c66df0971c18c451734f
// Moving DTree using move constructor
DTree<arma::mat> tree2(std::move(*tree));

Expand All @@ -587,14 +569,7 @@ BOOST_AUTO_TEST_CASE(MoveOperatorTest)

// Constructing a DTree
DTree<arma::mat>* tree = new DTree<arma::mat>(testData);

<<<<<<< HEAD
=======
// Pointers to children of original tree
DTree<arma::mat>* leftChild = tree->Left();
DTree<arma::mat>* rightChild = tree->Right();

>>>>>>> 952211b83dcfe89a39f9c66df0971c18c451734f
// Constructing copy of DTree using move operator
DTree<arma::mat> tree2 = std::move(*tree);

Expand All @@ -608,14 +583,7 @@ BOOST_AUTO_TEST_CASE(MoveOperatorTest)
BOOST_REQUIRE_EQUAL(tree2.minVals[1], 0);
BOOST_REQUIRE_EQUAL(tree2.maxVals[2], 8);
BOOST_REQUIRE_EQUAL(tree2.minVals[2], 1);
<<<<<<< HEAD
=======

//Checking children were safely moved
BOOST_REQUIRE(tree2.Left()==leftChild);
BOOST_REQUIRE(tree2.Right()==rightChild);

>>>>>>> 952211b83dcfe89a39f9c66df0971c18c451734f
}

BOOST_AUTO_TEST_SUITE_END();