Skip to content

core: cmakepresets.json, yml updated to use cl.exe #84

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

Merged
merged 1 commit into from
Jul 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions .github/workflows/datastructures-algorithms-ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,44 @@ on:

jobs:
lint-build-test:
runs-on: ubuntu-latest
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

- name: Install dependencies
shell: pwsh
run: |
sudo apt-get update
sudo apt-get install -y cmake libgtest-dev clang-tidy
choco install cmake -y
choco install ninja -y
choco install llvm -y

- name: Configure CMake
run: cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
shell: pwsh
run: cmake -S . -B build -G "Ninja" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

- name: Run clang-tidy
shell: pwsh
run: |
find include -name '*.h' -o -name '*.hpp' ; find source -name '*.cpp' -o -name '*.cc' -o -name '*.cxx' | \
xargs clang-tidy -p build --warnings-as-errors=*
clang-tidy --version
$files = Get-ChildItem -Recurse -Path source -Include *.cpp,*.cc,*.cxx -File

# These source/.* files would be checked using .clang-tidy maintained at projectroot
foreach ($file in $files) {
Write-Host "Running clang-tidy on source $($file.FullName)"
clang-tidy -p build "$($file.FullName)" --warnings-as-errors=*
}

- name: Build
shell: pwsh
run: cmake --build build

- name: Run tests
run: ctest --test-dir build --output-on-failure
shell: pwsh
run: ctest --test-dir build --output-on-failure
4 changes: 2 additions & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"binaryDir": "${sourceDir}/artifact/build/${presetName}",
"installDir": "${sourceDir}/artifact/install/${presetName}",
"cacheVariables": {
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++"
"CMAKE_C_COMPILER": "cl.exe",
"CMAKE_CXX_COMPILER": "cl.exe"
},
"condition": {
"type": "equals",
Expand Down
2 changes: 1 addition & 1 deletion source/0003_Graph/0003_TopologicalSort.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ namespace TopologicalSort
{
if (this->_hasCycle == true)
{
throw runtime_error("Cycle Detected");
return {};
}
vector<pair<int, pair<int, int>>> result;
for (auto& node : this->_topologicalSortedNodeList)
Expand Down
28 changes: 0 additions & 28 deletions test/0003_Graph/0003_TopologicalSortTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,6 @@ namespace TopologicalSort
EXPECT_EQ(actualResult, expectedResult);
}

// Test with a cyclic graph to verify it can detect cycles (assuming cycle detection is implemented)
TEST(TopoSortTesting, CyclicGraph)
{
Graph graph;
graph.PushDirectedEdge(1, 2);
graph.PushDirectedEdge(2, 3);
graph.PushDirectedEdge(3, 1); // Cycle: 1 -> 2 -> 3 -> 1

graph.TopologicalSort();

// Expected output if cycle detection is implemented
EXPECT_THROW(graph.ShowTopologicalSortResult(), runtime_error);
}

TEST(TopoSortTesting, ShowTopoSortResultUsingKahnAlgorithm)
{
Graph graph;
Expand All @@ -127,18 +113,4 @@ namespace TopologicalSort

EXPECT_EQ(actualResult, expectedResult);
}

// Test with a cyclic graph to verify it can detect cycles
TEST(TopoSortTesting, CyclicGraphUsingKahnAlgorithm)
{
Graph graph;
graph.PushDirectedEdge(1, 2);
graph.PushDirectedEdge(2, 3);
graph.PushDirectedEdge(3, 1); // Cycle: 1 -> 2 -> 3 -> 1

graph.KahnTopologicalSort();

// Expected output if cycle detection is implemented
EXPECT_THROW(graph.ShowTopologicalSortResult(), runtime_error);
}
}
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