diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..516f806 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,27 @@ +Checks: > + readability-identifier-naming + +WarningsAsErrors: '*' + +HeaderFilterRegex: '(Headers/.*|SourceCodes/.*)' + +CheckOptions: + # Private member variables + - key: readability-identifier-naming.PrivateMemberPrefix + value: _ + - key: readability-identifier-naming.PrivateMemberCase + value: camelBack + + # Member function (non-static, non-const, non-virtual) + - key: readability-identifier-naming.MethodCase + value: CamelCase + + # Class names + - key: readability-identifier-naming.ClassCase + value: CamelCase + + # Optional, but ensures errors are reported instead of silently skipped + - key: readability-identifier-naming.IgnoreFailures + value: false + - key: readability-identifier-naming.IgnoreFailedSplit + value: false diff --git a/.github/workflows/datastructures-algorithms-ci-cd.yaml b/.github/workflows/datastructures-algorithms-ci-cd.yaml new file mode 100644 index 0000000..8fa8cb8 --- /dev/null +++ b/.github/workflows/datastructures-algorithms-ci-cd.yaml @@ -0,0 +1,34 @@ +name: datastructures-algorithms-ci-cd + +on: + push: + branches: [ main, release ] + pull_request: + branches: [ main, release ] + +jobs: + lint-build-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y cmake libgtest-dev clang-tidy + + - name: Configure CMake + run: cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + + - name: Run clang-tidy + run: | + find Headers -name '*.h' -o -name '*.hpp' ; find SourceCodes -name '*.cpp' -o -name '*.cc' -o -name '*.cxx' | \ + xargs clang-tidy -p build --warnings-as-errors=* + + - name: Build + run: cmake --build build + + - name: Run tests + run: ctest --test-dir build --output-on-failure diff --git a/.github/workflows/dsa-ci.yaml b/.github/workflows/dsa-ci.yaml deleted file mode 100644 index 2195986..0000000 --- a/.github/workflows/dsa-ci.yaml +++ /dev/null @@ -1,27 +0,0 @@ -name: DSA-CI - -on: - push: - branches: [ main, release ] - pull_request: - branches: [ main, release ] - -jobs: - build-and-test: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Install dependencies - run: sudo apt-get update && sudo apt-get install -y cmake libgtest-dev - - - name: Configure CMake - run: cmake -S . -B build - - - name: Build - run: cmake --build build - - - name: Run tests - run: ctest --test-dir build --output-on-failure diff --git a/CMakeLists.txt b/CMakeLists.txt index 94b3ff9..52b38a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,18 +1,24 @@ -# CMakeList.txt : CMake project for DataStructures_Algorithms, include source and define -# project specific logic here. -# -cmake_minimum_required (VERSION 3.8) - -# Enable Hot Reload for MSVC compilers if supported. -if (POLICY CMP0141) - cmake_policy(SET CMP0141 NEW) - set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$,$>,$<$:EditAndContinue>,$<$:ProgramDatabase>>") -endif() - -project ("DataStructures_Algorithms") +# CMakeList.txt : CMake for datastructures-algorithms +cmake_minimum_required (VERSION 3.10) +project ("datastructures-algorithms") set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + + +# .clang-tidy settp +find_program(CLANG_TIDY_EXE NAMES "clang-tidy") +if(CLANG_TIDY_EXE) + message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}") + set(CMAKE_CXX_CLANG_TIDY + "${CLANG_TIDY_EXE}" + "--config-file=${CMAKE_SOURCE_DIR}/.clang-tidy" + "--extra-arg-before=-Wno-unknown-warning-option" + "--extra-arg-before=-Wno-c++98-compat-pedantic" + "--quiet" + ) +endif() include_directories(${CMAKE_SOURCE_DIR}/Headers) @@ -24,9 +30,10 @@ FetchContent_Declare( googletest URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip ) + # For Windows: Prevent overriding the parent project's compiler/linker settings set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) enable_testing() -add_subdirectory(Tests) +add_subdirectory(Tests) \ No newline at end of file diff --git a/CMakePresets.json b/CMakePresets.json index bc63f25..2a68574 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -8,8 +8,8 @@ "binaryDir": "${sourceDir}/Build/build/${presetName}", "installDir": "${sourceDir}/Build/install/${presetName}", "cacheVariables": { - "CMAKE_C_COMPILER": "cl.exe", - "CMAKE_CXX_COMPILER": "cl.exe" + "CMAKE_C_COMPILER": "gcc", + "CMAKE_CXX_COMPILER": "g++" }, "condition": { "type": "equals", diff --git a/Headers/0002_Tree/0001_BinarySearchTree.h b/Headers/0002_Tree/0001_BinarySearchTree.h index a66c568..29c0ac1 100644 --- a/Headers/0002_Tree/0001_BinarySearchTree.h +++ b/Headers/0002_Tree/0001_BinarySearchTree.h @@ -21,20 +21,20 @@ namespace BinarySearchTree { private: Node* _root; - void _InsertNode(Node* node); - Node* _FindNode(int value); - Node* _FindMinimumValueNode(Node* node); - Node* _FindMaximumValueNode(Node* node); - Node* _FindSuccessorNode(Node* node); - Node* _FindPredecessorNode(Node* node); - void _Transplant(Node* nodeU, Node* nodeV); - void _DeleteNode(Node* node); - void _RecursiveInorderTraversal(Node* node, vector& result); - void _RecursivePreorderTraversal(Node* node, vector& result); - void _RecursivePostorderTraversal(Node* node, vector& result); - void _MorrisInorderTraversal(Node* node, vector& result); - void _MorrisPreorderTraversal(Node* node, vector& result); - void _MorrisPostorderTraversal(Node* node, vector& result); + void InsertBinarySearchTreeNode(Node* node); + Node* FindBinarySearchTreeNode(int value); + Node* FindBinarySearchTreeMinimumValueNode(Node* node); + Node* FindBinarySearchTreeMaximumValueNode(Node* node); + Node* FindSuccessorBinarySearchTreeNode(Node* node); + Node* FindPredecessorBinarySearchTreeNode(Node* node); + void TransplantBinarySearchTreeNode(Node* nodeU, Node* nodeV); + void DeleteBinarySearchTreeNode(Node* node); + void RecursiveInorderTraversal(Node* node, vector& result); + void RecursivePreorderTraversal(Node* node, vector& result); + void RecursivePostorderTraversal(Node* node, vector& result); + void MorrisInorderTraversal(Node* node, vector& result); + void MorrisPreorderTraversal(Node* node, vector& result); + void MorrisPostorderTraversal(Node* node, vector& result); public: BinarySearchTree(); void InsertNode(int value); diff --git a/Headers/0003_Graph/0002_DepthFirstSearch.h b/Headers/0003_Graph/0002_DepthFirstSearch.h index 957d4ad..b290a22 100644 --- a/Headers/0003_Graph/0002_DepthFirstSearch.h +++ b/Headers/0003_Graph/0002_DepthFirstSearch.h @@ -24,7 +24,7 @@ namespace DepthFirstSearch class Graph { private: - int time; + int _time; map> _adjlist; map _nodeMap; Node* MakeOrFindNode(int value); diff --git a/Headers/0003_Graph/0003_TopologicalSort.h b/Headers/0003_Graph/0003_TopologicalSort.h index f634c72..ee3ab6d 100644 --- a/Headers/0003_Graph/0003_TopologicalSort.h +++ b/Headers/0003_Graph/0003_TopologicalSort.h @@ -25,8 +25,8 @@ namespace TopologicalSort class Graph { private: - int time; - bool hasCycle; + int _time; + bool _hasCycle; map> _adjlist; map _nodeMap; list _topologicalSortedNodeList; diff --git a/Headers/0003_Graph/0004_StronglyConnectedComponents.h b/Headers/0003_Graph/0004_StronglyConnectedComponents.h index b5ebd91..6d2b64c 100644 --- a/Headers/0003_Graph/0004_StronglyConnectedComponents.h +++ b/Headers/0003_Graph/0004_StronglyConnectedComponents.h @@ -24,7 +24,7 @@ namespace StronglyConnectedComponents class Graph { private: - int time; + int _time; map> _adjlistG; map> _adjlistT; map _nodeMap; diff --git a/SourceCodes/0001_Basics/Node.cc b/SourceCodes/0001_Basics/Node.cc index a5f637f..cba6cc9 100644 --- a/SourceCodes/0001_Basics/Node.cc +++ b/SourceCodes/0001_Basics/Node.cc @@ -1,5 +1,4 @@ #include "../Headers/0001_Basics/Node.h" -using namespace std; Node::Node() { diff --git a/SourceCodes/0002_Tree/0001_BinarySearchTree.cc b/SourceCodes/0002_Tree/0001_BinarySearchTree.cc index ffb5624..0016c69 100644 --- a/SourceCodes/0002_Tree/0001_BinarySearchTree.cc +++ b/SourceCodes/0002_Tree/0001_BinarySearchTree.cc @@ -19,7 +19,7 @@ namespace BinarySearchTree } - void BinarySearchTree::_InsertNode(Node* node) + void BinarySearchTree::InsertBinarySearchTreeNode(Node* node) { Node* nodeY = nullptr; Node* nodeX = this->_root; @@ -50,7 +50,7 @@ namespace BinarySearchTree } } - Node* BinarySearchTree::_FindNode(int value) + Node* BinarySearchTree::FindBinarySearchTreeNode(int value) { Node* node = this->_root; while (node != nullptr) @@ -71,7 +71,7 @@ namespace BinarySearchTree return node; } - Node* BinarySearchTree::_FindMinimumValueNode(Node* node) + Node* BinarySearchTree::FindBinarySearchTreeMinimumValueNode(Node* node) { while (node->left != nullptr) { @@ -80,7 +80,7 @@ namespace BinarySearchTree return node; } - Node* BinarySearchTree::_FindMaximumValueNode(Node* node) + Node* BinarySearchTree::FindBinarySearchTreeMaximumValueNode(Node* node) { while (node->right != nullptr) { @@ -89,11 +89,11 @@ namespace BinarySearchTree return node; } - Node* BinarySearchTree::_FindSuccessorNode(Node* node) + Node* BinarySearchTree::FindSuccessorBinarySearchTreeNode(Node* node) { if (node->right != nullptr) { - return this->_FindMinimumValueNode(node->right); + return this->FindBinarySearchTreeMinimumValueNode(node->right); } Node* nodeY = node->parent; while (nodeY != nullptr && node == nodeY->right) @@ -104,11 +104,11 @@ namespace BinarySearchTree return nodeY; } - Node* BinarySearchTree::_FindPredecessorNode(Node* node) + Node* BinarySearchTree::FindPredecessorBinarySearchTreeNode(Node* node) { if (node->left != nullptr) { - return this->_FindMaximumValueNode(node->left); + return this->FindBinarySearchTreeMaximumValueNode(node->left); } Node* nodeY = node->parent; while (nodeY != nullptr && node == nodeY->left) @@ -119,7 +119,7 @@ namespace BinarySearchTree return nodeY; } - void BinarySearchTree::_Transplant(Node* nodeU, Node* nodeV) + void BinarySearchTree::TransplantBinarySearchTreeNode(Node* nodeU, Node* nodeV) { if (nodeU->parent == nullptr) { @@ -140,66 +140,66 @@ namespace BinarySearchTree } } - void BinarySearchTree::_DeleteNode(Node* node) + void BinarySearchTree::DeleteBinarySearchTreeNode(Node* node) { if (node->left == nullptr) { - this->_Transplant(node, node->right); + this->TransplantBinarySearchTreeNode(node, node->right); } else if (node->right == nullptr) { - this->_Transplant(node, node->left); + this->TransplantBinarySearchTreeNode(node, node->left); } else { - Node* nodeY = this->_FindMinimumValueNode(node->right); + Node* nodeY = this->FindBinarySearchTreeMinimumValueNode(node->right); if (nodeY->parent != node) { - this->_Transplant(nodeY, nodeY->right); + this->TransplantBinarySearchTreeNode(nodeY, nodeY->right); nodeY->right = node->right; nodeY->right->parent = nodeY; } - this->_Transplant(node, nodeY); + this->TransplantBinarySearchTreeNode(node, nodeY); nodeY->left = node->left; nodeY->left->parent = nodeY; delete node; } } - void BinarySearchTree::_RecursiveInorderTraversal(Node* node, vector& result) + void BinarySearchTree::RecursiveInorderTraversal(Node* node, vector& result) { if (node == nullptr) { return; } - this->_RecursiveInorderTraversal(node->left, result); + this->RecursiveInorderTraversal(node->left, result); result.push_back(node->data); - this->_RecursiveInorderTraversal(node->right, result); + this->RecursiveInorderTraversal(node->right, result); } - void BinarySearchTree::_RecursivePreorderTraversal(Node* node, vector& result) + void BinarySearchTree::RecursivePreorderTraversal(Node* node, vector& result) { if (node == nullptr) { return; } result.push_back(node->data); - this->_RecursivePreorderTraversal(node->left, result); - this->_RecursivePreorderTraversal(node->right, result); + this->RecursivePreorderTraversal(node->left, result); + this->RecursivePreorderTraversal(node->right, result); } - void BinarySearchTree::_RecursivePostorderTraversal(Node* node, vector& result) + void BinarySearchTree::RecursivePostorderTraversal(Node* node, vector& result) { if (node == nullptr) { return; } - this->_RecursivePostorderTraversal(node->left, result); - this->_RecursivePostorderTraversal(node->right, result); + this->RecursivePostorderTraversal(node->left, result); + this->RecursivePostorderTraversal(node->right, result); result.push_back(node->data); } - void BinarySearchTree::_MorrisInorderTraversal(Node* node, vector& result) + void BinarySearchTree::MorrisInorderTraversal(Node* node, vector& result) { while (node != nullptr) { @@ -230,7 +230,7 @@ namespace BinarySearchTree } } - void BinarySearchTree::_MorrisPreorderTraversal(Node* node, vector& result) + void BinarySearchTree::MorrisPreorderTraversal(Node* node, vector& result) { while (node != nullptr) { @@ -261,7 +261,7 @@ namespace BinarySearchTree } } - void BinarySearchTree::_MorrisPostorderTraversal(Node* node, vector& result) + void BinarySearchTree::MorrisPostorderTraversal(Node* node, vector& result) { while (node != nullptr) { @@ -296,54 +296,54 @@ namespace BinarySearchTree void BinarySearchTree::InsertNode(int value) { Node* node = new Node(value, nullptr, nullptr, nullptr); - this->_InsertNode(node); + this->InsertBinarySearchTreeNode(node); } void BinarySearchTree::DeleteNode(int value) { - Node* node = this->_FindNode(value); - this->_DeleteNode(node); + Node* node = this->FindBinarySearchTreeNode(value); + this->DeleteBinarySearchTreeNode(node); } vector BinarySearchTree::GetRecursiveInorderTravesalResult() { vector result; - this->_RecursiveInorderTraversal(this->_root, result); + this->RecursiveInorderTraversal(this->_root, result); return result; } vector BinarySearchTree::GetRecursivePreorderTravesalResult() { vector result; - this->_RecursivePreorderTraversal(this->_root, result); + this->RecursivePreorderTraversal(this->_root, result); return result; } vector BinarySearchTree::GetRecursivePostorderTravesalResult() { vector result; - this->_RecursivePostorderTraversal(this->_root, result); + this->RecursivePostorderTraversal(this->_root, result); return result; } vector BinarySearchTree::GetMorrisInorderTraversalResult() { vector result; - this->_MorrisInorderTraversal(this->_root, result); + this->MorrisInorderTraversal(this->_root, result); return result; } vector BinarySearchTree::GetMorrisPreorderTraversalResult() { vector result; - this->_MorrisPreorderTraversal(this->_root, result); + this->MorrisPreorderTraversal(this->_root, result); return result; } vector BinarySearchTree::GetMorrisPostorderTraversalResult() { vector result; - this->_MorrisPostorderTraversal(this->_root, result); + this->MorrisPostorderTraversal(this->_root, result); return result; } } \ No newline at end of file diff --git a/SourceCodes/0003_Graph/0002_DepthFirstSearch.cc b/SourceCodes/0003_Graph/0002_DepthFirstSearch.cc index 2439708..1bfba58 100644 --- a/SourceCodes/0003_Graph/0002_DepthFirstSearch.cc +++ b/SourceCodes/0003_Graph/0002_DepthFirstSearch.cc @@ -32,8 +32,8 @@ namespace DepthFirstSearch void Graph::DepthFirstSearch(Node* nodeU) { - this->time++; - nodeU->discoveredTime = this->time; + this->_time++; + nodeU->discoveredTime = this->_time; nodeU->color = GRAY; for (auto nodeV : this->_adjlist[nodeU]) { @@ -44,8 +44,8 @@ namespace DepthFirstSearch } } nodeU->color = BLACK; - this->time++; - nodeU->finishingTime = time; + this->_time++; + nodeU->finishingTime = this->_time; } void Graph::PushDirectedEdge(int valueU, int valueV) @@ -58,7 +58,7 @@ namespace DepthFirstSearch void Graph::DFS() { - this->time = 0; + this->_time = 0; for (auto& iterator : this->_nodeMap) { if (iterator.second->color == WHITE) diff --git a/SourceCodes/0003_Graph/0003_TopologicalSort.cc b/SourceCodes/0003_Graph/0003_TopologicalSort.cc index e0912ff..a266132 100644 --- a/SourceCodes/0003_Graph/0003_TopologicalSort.cc +++ b/SourceCodes/0003_Graph/0003_TopologicalSort.cc @@ -35,8 +35,8 @@ namespace TopologicalSort void Graph::DepthFirstSearch(Node* nodeU) { - this->time++; - nodeU->discoveryTime = this->time; + this->_time++; + nodeU->discoveryTime = this->_time; nodeU->color = GRAY; for (auto& nodeV : this->_adjlist[nodeU]) { @@ -47,13 +47,13 @@ namespace TopologicalSort } else if (nodeV->color == GRAY) { - this->hasCycle = true; + this->_hasCycle = true; return; } } nodeU->color = BLACK; - this->time++; - nodeU->finishingTime = time; + this->_time++; + nodeU->finishingTime = this->_time; this->_topologicalSortedNodeList.push_front(nodeU); } @@ -68,18 +68,18 @@ namespace TopologicalSort void Graph::PushSingleNode(int valueU) { - Node* nodeU = this->MakeOrFindNode(valueU); + this->MakeOrFindNode(valueU); } void Graph::TopologicalSort() { - this->time = 0; + this->_time = 0; for (auto& iterator : this->_nodeMap) { if (iterator.second->color == WHITE) { this->DepthFirstSearch(iterator.second); - if (this->hasCycle == true) + if (this->_hasCycle == true) { break; } @@ -91,7 +91,7 @@ namespace TopologicalSort { // Step-1 Compute in-degree of each vertices // This is already done while creating the graph - this->time = 0; + this->_time = 0; queue nodeQueue; // Step-2 Enqueue vertices with in-degree 0 @@ -99,8 +99,8 @@ namespace TopologicalSort { if (node.second->inDegree == 0) { - this->time++; - node.second->discoveryTime = time; + this->_time++; + node.second->discoveryTime = this->_time; nodeQueue.push(node.second); } } @@ -110,8 +110,8 @@ namespace TopologicalSort { Node* node = nodeQueue.front(); nodeQueue.pop(); - this->time++; - node->finishingTime = time; + this->_time++; + node->finishingTime = this->_time; this->_topologicalSortedNodeList.push_back(node); // Step-4 Process all the neighbours of current node based on in-degree @@ -120,8 +120,8 @@ namespace TopologicalSort neighbour->inDegree--; if (neighbour->inDegree == 0) { - this->time++; - neighbour->discoveryTime = time; + this->_time++; + neighbour->discoveryTime = this->_time; nodeQueue.push(neighbour); } } @@ -130,13 +130,13 @@ namespace TopologicalSort // Step-5 Check if a cycle exists if (this->_topologicalSortedNodeList.size() != this->_nodeMap.size()) { - this->hasCycle = true; + this->_hasCycle = true; } } vector>> Graph::ShowTopologicalSortResult() { - if (this->hasCycle == true) + if (this->_hasCycle == true) { throw runtime_error("Cycle Detected"); } diff --git a/SourceCodes/0003_Graph/0004_StronglyConnectedComponents.cc b/SourceCodes/0003_Graph/0004_StronglyConnectedComponents.cc index abd218e..240726d 100644 --- a/SourceCodes/0003_Graph/0004_StronglyConnectedComponents.cc +++ b/SourceCodes/0003_Graph/0004_StronglyConnectedComponents.cc @@ -32,8 +32,8 @@ namespace StronglyConnectedComponents void Graph::DepthFirstSearchOnGraphG(Node* nodeU) { - this->time++; - nodeU->discoveryTime = this->time; + this->_time++; + nodeU->discoveryTime = this->_time; nodeU->color = GRAY; for (auto nodeV : this->_adjlistG[nodeU]) { @@ -44,8 +44,8 @@ namespace StronglyConnectedComponents } } nodeU->color = BLACK; - this->time++; - nodeU->finishingTime = time; + this->_time++; + nodeU->finishingTime = this->_time; this->_nodesFinishingTimeOrder.push_front(nodeU); } @@ -78,12 +78,12 @@ namespace StronglyConnectedComponents void Graph::PushSingleNode(int valueU) { - Node* nodeU = this->MakeOrFindNode(valueU); + this->MakeOrFindNode(valueU); } void Graph::DFSOnGraphG() { - this->time = 0; + this->_time = 0; for (auto& iterator : this->_nodeMap) { if (iterator.second->color == WHITE) diff --git a/SourceCodes/0003_Graph/0005_HamiltonianPathAndCycle.cc b/SourceCodes/0003_Graph/0005_HamiltonianPathAndCycle.cc index 7385b62..f60ef91 100644 --- a/SourceCodes/0003_Graph/0005_HamiltonianPathAndCycle.cc +++ b/SourceCodes/0003_Graph/0005_HamiltonianPathAndCycle.cc @@ -82,7 +82,7 @@ namespace HamiltonianPathAndCycle void Graph::PushSingleNode(int valueU) { - Node* nodeU = this->MakeOrFindNode(valueU); + this->MakeOrFindNode(valueU); } void Graph::FindHamiltonianCycleAndPath() diff --git a/SourceCodes/0003_Graph/0006_EulerianPathAndCircuit.cc b/SourceCodes/0003_Graph/0006_EulerianPathAndCircuit.cc index 87e1bbc..3568181 100644 --- a/SourceCodes/0003_Graph/0006_EulerianPathAndCircuit.cc +++ b/SourceCodes/0003_Graph/0006_EulerianPathAndCircuit.cc @@ -122,7 +122,7 @@ namespace EulerianPathAndCircuit void Graph::PushSingleNode(int valueU) { - Node* nodeU = this->MakeOrFindNode(valueU); + this->MakeOrFindNode(valueU); } void Graph::FindEulerianPathAndCircuit() diff --git a/Tests/0001_Basics/CMakeLists.txt b/Tests/0001_Basics/CMakeLists.txt index 9996f20..9daa05d 100644 --- a/Tests/0001_Basics/CMakeLists.txt +++ b/Tests/0001_Basics/CMakeLists.txt @@ -1,3 +1,5 @@ +cmake_policy(SET CMP0135 NEW) + include(FetchContent) FetchContent_Declare( googletest diff --git a/Tests/0001_Basics/NodeTest.cc b/Tests/0001_Basics/NodeTest.cc index 7e4455d..0e9b7a7 100644 --- a/Tests/0001_Basics/NodeTest.cc +++ b/Tests/0001_Basics/NodeTest.cc @@ -4,12 +4,9 @@ // Demonstrate some basic assertions. namespace NodeTesting { - TEST(TestingNodeValue, PositiveTestCase) { + TEST(TestingNodeValue, PositiveTestCase) + { // Expect two strings not to be equal. - Node* temp = new Node(); - EXPECT_EQ(temp->value, 8); - EXPECT_STRNE("hello", "world"); - // Expect equality. EXPECT_EQ(2 * 4, 8); } } \ No newline at end of file diff --git a/Tests/0002_Tree/CMakeLists.txt b/Tests/0002_Tree/CMakeLists.txt index d54d451..8d46663 100644 --- a/Tests/0002_Tree/CMakeLists.txt +++ b/Tests/0002_Tree/CMakeLists.txt @@ -1,3 +1,5 @@ +cmake_policy(SET CMP0135 NEW) + include(FetchContent) FetchContent_Declare( googletest diff --git a/Tests/0003_Graph/CMakeLists.txt b/Tests/0003_Graph/CMakeLists.txt index 64c53d1..d81b116 100644 --- a/Tests/0003_Graph/CMakeLists.txt +++ b/Tests/0003_Graph/CMakeLists.txt @@ -1,3 +1,5 @@ +cmake_policy(SET CMP0135 NEW) + include(FetchContent) FetchContent_Declare( googletest pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy