diff --git a/src/core/RedBlackTree/RedBlackTree.tpp b/src/core/RedBlackTree/RedBlackTree.tpp index d65bfc3..a9d0fbc 100644 --- a/src/core/RedBlackTree/RedBlackTree.tpp +++ b/src/core/RedBlackTree/RedBlackTree.tpp @@ -9,12 +9,11 @@ const std::string RedBlackTree::EMPTY_TREE_MESSAGE = "Empty Tree"; template RedBlackTree::RedBlackTree() noexcept + : NIL(new Node(T(), NodeColor::Black, nullptr, nullptr, nullptr)), + root(NIL), + size(0) { - NIL = new Node(T(), NodeColor::Black, nullptr, nullptr, nullptr); NIL->left = NIL->right = NIL->parent = NIL; - - root = NIL; - size = 0; } template @@ -29,10 +28,12 @@ RedBlackTree::~RedBlackTree() noexcept template RedBlackTree::RedBlackTree(const RedBlackTree &other) + : NIL(new Node(T(), NodeColor::Black, nullptr, nullptr, nullptr)), + root(nullptr), + size(other.size) { - NIL = new Node(T(), NodeColor::Black, nullptr, nullptr, nullptr); + NIL->left = NIL->right = NIL->parent = NIL; root = copySubtree(other.root, nullptr); - size = other.size; } template diff --git a/tests/UnitTests/BSTUnitTest.cpp b/tests/UnitTests/BSTUnitTest.cpp index df9e56f..85bb1b7 100644 --- a/tests/UnitTests/BSTUnitTest.cpp +++ b/tests/UnitTests/BSTUnitTest.cpp @@ -6,9 +6,6 @@ /** * @brief Tests for BinarySearchTree class. * - * @todo - * 1. Refactor this test to implement C++ 23; - * * @test * */ diff --git a/tests/UnitTests/RBTUnitTest.cpp b/tests/UnitTests/RBTUnitTest.cpp index cb07b12..9a9e517 100644 --- a/tests/UnitTests/RBTUnitTest.cpp +++ b/tests/UnitTests/RBTUnitTest.cpp @@ -5,10 +5,6 @@ /** * @brief Tests for RedBlackTree class. * - * @todo - * 1. Create tests for checking the internal structure of the tree; - * 2. Refactor this test to implement C++ 23; - * * @test */ class RBTUnitTest : public testing::Test