From c4e9bb728cf1b7ad6c29799a79a0cf2c88a38aa5 Mon Sep 17 00:00:00 2001 From: Franziska Wegner <57569315+franziska-wegner@users.noreply.github.com> Date: Tue, 2 Jan 2024 05:51:31 -0800 Subject: [PATCH 1/4] Add Code Documentation Workflow (#71) * Add code documentation workflow * Update workflow names --- .github/workflows/cmake-multi-platform.yml | 2 +- .github/workflows/code-documentation.yml | 120 +++++++++++++++++++++ 2 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/code-documentation.yml diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 1b4d4a6d..9b0faa69 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -1,6 +1,6 @@ # This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform. # See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml -name: CMake on multiple platforms +name: CMake on Multiple Platforms on: push: diff --git a/.github/workflows/code-documentation.yml b/.github/workflows/code-documentation.yml new file mode 100644 index 00000000..10d87531 --- /dev/null +++ b/.github/workflows/code-documentation.yml @@ -0,0 +1,120 @@ +name: Code Documentation + +on: + workflow_run: + workflows: [ "CMake on Multiple Platforms" ] + # branches: [ "main" ] + types: [ "completed" ] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. + fail-fast: false + + # Set up a matrix to run the following 3 configurations: + # 1. + # 2. + # 3. + # + # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + build_type: [Release, Debug] + c_compiler: [gcc, clang, cl] + include: + - os: windows-latest + c_compiler: cl + cpp_compiler: cl + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + - os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ + - os: macos-latest + c_compiler: gcc + cpp_compiler: g++ + - os: macos-latest + c_compiler: clang + cpp_compiler: clang++ + exclude: + - os: windows-latest + c_compiler: gcc + - os: windows-latest + c_compiler: clang + - os: ubuntu-latest + c_compiler: cl + - os: macos-latest + c_compiler: cl + + steps: + - uses: actions/checkout@v3 + + # Compared to Window and MacOS best option with stable ~2 min installation time. + - name: Install LaTeX (Linux) + if: startsWith(matrix.os,'ubuntu-') + run: | + sudo apt update --fix-missing + sudo apt upgrade + sudo apt update + sudo apt-get install texlive texlive-latex-recommended texlive-extra-utils texlive-latex-extra texlive-font-utils + shell: bash + + # Takes too long > 13 min + # - name: Install LaTeX (MacOS) + # if: startsWith(matrix.os,'macos-') + # run: | + # brew update + # brew install --cask mactex; + # echo "/Library/TeX/texbin/" >> $GITHUB_PATH + # shell: bash + + # Takes too long >> 25 min + # - name: Install LaTeX (Windows) + # if: startsWith(matrix.os, 'windows-') + # uses: teatimeguest/setup-texlive-action@v3 + # with: + # packages: >- + # scheme-medium + # collection-latexextra + # babel-dutch + # cjk + # bibtex + + # For Doxygen installation use action from https://github.com/marketplace/actions/doxygen-install. + - name: doxygen-install + uses: ssciwr/doxygen-install@v1.2.0 + + - name: Generate documentation + if: startsWith(matrix.os,'ubuntu-') + shell: sudo cmake -P {0} + run: | + execute_process( + COMMAND cmake --build build --target doc + RESULT_VARIABLE result + ) + if (NOT result EQUAL 0) + message(FATAL_ERROR "Building documentation failed") + endif() + + # See https://github.com/marketplace/actions/github-pages-action#%EF%B8%8F-deploy-to-external-repository-external_repository + # for more information on the parameters. + - name: Publish Documentation to Github Pages + uses: peaceiris/actions-gh-pages@v3 + if: ${{ github.event_name == 'push' && startsWith(matrix.os,'ubuntu-') }} + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} + publish_dir: documentation/html + force_orphan: true + commit_message: ${{ github.event.head_commit.message }} + publish_branch: gh-pages + user_name: 'github-actions[bot]' + user_email: 'github-actions[bot]@users.noreply.github.com' From 50a74c8d97c99b4221715166fa66595d530cd291 Mon Sep 17 00:00:00 2001 From: Franziska Wegner <57569315+franziska-wegner@users.noreply.github.com> Date: Tue, 2 Jan 2024 06:19:37 -0800 Subject: [PATCH 2/4] Remove Test Raw String Warnings from C/C++ Linter (#74) This PR removes some warnings by using raw strings that avoids escaping sequences. *Commits:* * Add raw strings to avoid escaping * Add raw strings in dynamic graph test to avoid escaping * Add raw strings in mapping binary heap tests to avoid escaping * Add raw strings in bucket tests to avoid escaping * Add raw strings in binary heap tests to avoid escaping * Add raw strings in dominating theta path tests to avoid escaping * Add raw strings in PyPSA parser tests to avoid escaping --- .../PathFinding/TestDominatingThetaPath.cpp | 4 +- .../Container/TestBinaryHeap.cpp | 28 +++---- tests/DataStructures/Container/TestBucket.cpp | 84 +++++++++---------- .../Container/TestMappingBinaryHeap.cpp | 20 ++--- .../Graphs/TestDynamicGraph.cpp | 4 +- tests/DataStructures/Graphs/TestGraph.cpp | 32 +++---- tests/IO/TestPyPsaParser.cpp | 4 +- 7 files changed, 88 insertions(+), 88 deletions(-) diff --git a/tests/Algorithms/PathFinding/TestDominatingThetaPath.cpp b/tests/Algorithms/PathFinding/TestDominatingThetaPath.cpp index 904e5475..60882713 100644 --- a/tests/Algorithms/PathFinding/TestDominatingThetaPath.cpp +++ b/tests/Algorithms/PathFinding/TestDominatingThetaPath.cpp @@ -47,7 +47,7 @@ TEST_F ( TestDTPEmptyGraph auto assertionString = buildAssertionString ( "DominatingThetaPath.hpp" , "DominatingThetaPath" , "Source" - , "source < labelSets_.size\\(\\)"); + , R"(source < labelSets_.size\(\))"); ASSERT_DEATH ( {dtp_.Source(0);}, assertionString ); } @@ -59,7 +59,7 @@ TEST_F ( TestDTPEmptyGraph auto assertionString = buildAssertionString ( "DominatingThetaPath.hpp" , "DominatingThetaPath" , "Source" - , "source < labelSets_.size\\(\\)"); + , R"(source < labelSets_.size\(\))"); try { dtp_.Source(0); diff --git a/tests/DataStructures/Container/TestBinaryHeap.cpp b/tests/DataStructures/Container/TestBinaryHeap.cpp index f738c7f0..46a505f1 100644 --- a/tests/DataStructures/Container/TestBinaryHeap.cpp +++ b/tests/DataStructures/Container/TestBinaryHeap.cpp @@ -60,7 +60,7 @@ TEST_F( TestBinaryHeap, auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "Top" - , "!Empty\\(\\)"); + , R"(!Empty\(\))"); ASSERT_DEATH( {heapConst_.Top();}, assertionString ); } #else @@ -71,7 +71,7 @@ TEST_F( TestBinaryHeap, auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "Top" - , "!Empty\\(\\)"); + , R"(!Empty\(\))"); try { heapConst_.Top(); } catch ( std::runtime_error const & error ) { @@ -221,7 +221,7 @@ TEST_F( TestBinaryHeap, auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "DecreaseKey" - , "index < Size\\(\\)" ); + , R"(index < Size\(\))" ); TElement p = -1; @@ -235,7 +235,7 @@ TEST_F( TestBinaryHeap, auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "DecreaseKey" - , "index < Size\\(\\)" ); + , R"(index < Size\(\))" ); TElement p = -1; try { @@ -257,7 +257,7 @@ TEST_F( TestBinaryHeap, auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "ChangeKey" - , "index < Size\\(\\)"); + , R"(index < Size\(\))"); TElement p = -1; @@ -271,7 +271,7 @@ TEST_F( TestBinaryHeap, auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "ChangeKey" - , "index < Size\\(\\)"); + , R"(index < Size\(\))"); TElement p = -1; try { @@ -339,7 +339,7 @@ TEST_F( TestBinaryHeap, auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "Pop" - , "Size\\(\\) > 0"); + , R"(Size\(\) > 0)"); ASSERT_DEATH( {heap_.Pop();}, assertionString ); } #else @@ -350,7 +350,7 @@ TEST_F( TestBinaryHeap, auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "Pop" - , "Size\\(\\) > 0"); + , R"(Size\(\) > 0)"); try { heap_.Pop(); } catch ( std::runtime_error const & error ) { @@ -370,7 +370,7 @@ TEST_F( TestBinaryHeap, auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "DeleteTop" - , "Size\\(\\) > 0"); + , R"(Size\(\) > 0)"); ASSERT_DEATH( {heap_.DeleteTop();}, assertionString ); } @@ -382,7 +382,7 @@ TEST_F( TestBinaryHeap, auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "DeleteTop" - , "Size\\(\\) > 0"); + , R"(Size\(\) > 0)"); try { heap_.DeleteTop(); } catch ( std::runtime_error const & error ) { @@ -718,7 +718,7 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "DecreaseKey" - , "index < Size\\(\\)" ); + , R"(index < Size\(\))" ); ASSERT_DEATH( {heap_.DecreaseKey(7, 123);}, assertionString ); } @@ -730,7 +730,7 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "DecreaseKey" - , "index < Size\\(\\)" ); + , R"(index < Size\(\))" ); try { heap_.DecreaseKey(7, 123); } catch ( std::runtime_error const & error ) { @@ -785,7 +785,7 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "ChangeKey" - , "index < Size\\(\\)"); + , R"(index < Size\(\))"); ASSERT_DEATH( {heap_.ChangeKey(7, 123);}, assertionString ); } @@ -797,7 +797,7 @@ TEST_F (TestBinaryHeapWithOneIntegerElement, auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "ChangeKey" - , "index < Size\\(\\)"); + , R"(index < Size\(\))"); try { heap_.ChangeKey(7, 123); } catch ( std::runtime_error const & error ) { diff --git a/tests/DataStructures/Container/TestBucket.cpp b/tests/DataStructures/Container/TestBucket.cpp index 7ba899cc..f71cbd4d 100644 --- a/tests/DataStructures/Container/TestBucket.cpp +++ b/tests/DataStructures/Container/TestBucket.cpp @@ -38,7 +38,7 @@ namespace egoa::test { auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "Top" - , "!EmptyQueue\\(\\)"); + , R"(!EmptyQueue\(\))"); ASSERT_DEATH ( {bucket_.Top();}, ".*" ); } #else @@ -49,7 +49,7 @@ namespace egoa::test { auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "Top" - , "!EmptyQueue\\(\\)"); + , R"(!EmptyQueue\(\))"); try { bucket_.Top(); } catch ( std::runtime_error const & error ) @@ -75,7 +75,7 @@ namespace egoa::test { auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "operator.*<" - , "!EmptyQueue\\(\\)"); + , R"(!EmptyQueue\(\))"); ASSERT_DEATH ( { auto test = bucket_ < bucketToCompare_;}, assertionString ); } #else @@ -87,7 +87,7 @@ namespace egoa::test { auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "operator.*<" - , "!EmptyQueue\\(\\)"); + , R"(!EmptyQueue\(\))"); try { auto test = bucket_ < bucketToCompare_; } catch ( std::runtime_error const & error ) @@ -110,7 +110,7 @@ namespace egoa::test { auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "operator.*<=" - , "!EmptyQueue\\(\\)"); + , R"(!EmptyQueue\(\))"); ASSERT_DEATH ( { auto test = bucket_ <= bucketToCompare_;}, assertionString ); } #else @@ -122,7 +122,7 @@ namespace egoa::test { auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "operator.*<=" - , "!EmptyQueue\\(\\)"); + , R"(!EmptyQueue\(\))"); try { auto test = bucket_ <= bucketToCompare_; } catch ( std::runtime_error const & error ) @@ -145,7 +145,7 @@ namespace egoa::test { auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "operator.*>" - , "!EmptyQueue\\(\\)"); + , R"(!EmptyQueue\(\))"); ASSERT_DEATH ( { auto test = bucket_ > bucketToCompare_;}, assertionString ); } #else @@ -157,7 +157,7 @@ namespace egoa::test { auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "operator.*>" - , "!EmptyQueue\\(\\)"); + , R"(!EmptyQueue\(\))"); try { auto test = bucket_ > bucketToCompare_; } catch ( std::runtime_error const & error ) @@ -180,7 +180,7 @@ namespace egoa::test { auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "operator.*>=" - , "!EmptyQueue\\(\\)"); + , R"(!EmptyQueue\(\))"); ASSERT_DEATH ( { auto test = bucket_ >= bucketToCompare_;}, assertionString ); } #else @@ -192,7 +192,7 @@ namespace egoa::test { auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "operator.*>=" - , "!EmptyQueue\\(\\)"); + , R"(!EmptyQueue\(\))"); try { auto test = bucket_ >= bucketToCompare_; } catch ( std::runtime_error const & error ) @@ -294,7 +294,7 @@ TEST_F ( TestBucketWithZeroElements auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "ElementAt" - , "HasElementAt\\(index\\)"); + , R"(HasElementAt\(index\))"); ASSERT_DEATH ( {bucket_.ElementAt(0);}, assertionString ); ASSERT_DEATH ( {bucket_.ElementAt(1);}, assertionString ); ASSERT_DEATH ( {bucket_.ElementAt(-1);}, assertionString ); @@ -307,7 +307,7 @@ TEST_F ( TestBucketWithZeroElements auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "ElementAt" - , "HasElementAt\\(index\\)"); + , R"(HasElementAt\(index\))"); try { try { bucket_.ElementAt(0); @@ -342,8 +342,8 @@ TEST_F ( TestBucketWithZeroElements { auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" - , "operator.*\\[\\]" - , "HasElementAt\\(index\\)"); + , R"(operator.*\[\])" + , R"(HasElementAt\(index\))"); ASSERT_DEATH ( {bucket_[0];}, assertionString ); ASSERT_DEATH ( {bucket_[1];}, assertionString ); ASSERT_DEATH ( {bucket_[-1];}, assertionString ); @@ -355,8 +355,8 @@ TEST_F ( TestBucketWithZeroElements { auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" - , "operator.*\\[\\]" - , "HasElementAt\\(index\\)"); + , R"(operator.*\[\])" + , R"(HasElementAt\(index\))"); try { try { bucket_[0]; @@ -395,7 +395,7 @@ TEST_F ( TestBucketWithZeroElements auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "Top" - , "!EmptyQueue\\(\\)"); + , R"(!EmptyQueue\(\))"); EXPECT_TRUE ( bucket_.EmptyQueue() ); ASSERT_DEATH ( {bucket_.Top();}, assertionString ); } @@ -407,7 +407,7 @@ TEST_F ( TestBucketWithZeroElements auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "Top" - , "!EmptyQueue\\(\\)"); + , R"(!EmptyQueue\(\))"); EXPECT_TRUE ( bucket_.EmptyQueue() ); try { bucket_.Top(); @@ -439,7 +439,7 @@ TEST_F ( TestBucketWithZeroElements auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "Pop" - , "!EmptyQueue\\(\\)" ); + , R"(!EmptyQueue\(\))" ); ASSERT_DEATH ( {bucket_.Pop();}, assertionString ); } #else @@ -450,7 +450,7 @@ TEST_F ( TestBucketWithZeroElements auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "Pop" - , "!EmptyQueue\\(\\)" ); + , R"(!EmptyQueue\(\))" ); try { bucket_.Pop(); } catch ( std::runtime_error const & error ) @@ -472,7 +472,7 @@ TEST_F ( TestBucketWithZeroElements auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "DeleteTop" - , "!EmptyQueue\\(\\)" ); + , R"(!EmptyQueue\(\))" ); ASSERT_DEATH ( {bucket_.DeleteTop();}, assertionString ); } #else @@ -483,7 +483,7 @@ TEST_F ( TestBucketWithZeroElements auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "DeleteTop" - , "!EmptyQueue\\(\\)" ); + , R"(!EmptyQueue\(\))" ); try { bucket_.DeleteTop(); } catch ( std::runtime_error const & error ) @@ -687,7 +687,7 @@ TEST_F ( TestBucketWithZeroElements auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "operator.*<" - , "!rhs.EmptyQueue\\(\\)" ); + , R"(!rhs.EmptyQueue\(\))" ); ASSERT_DEATH ( { auto test = bucket_ < bucketToCompare_;}, assertionString ); } #else @@ -699,7 +699,7 @@ TEST_F ( TestBucketWithZeroElements auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "operator.*<" - , "!rhs.EmptyQueue\\(\\)" ); + , R"(!rhs.EmptyQueue\(\))" ); try { auto test = bucket_ < bucketToCompare_; } catch ( std::runtime_error const & error ) @@ -726,7 +726,7 @@ TEST_F ( TestBucketWithZeroElements auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "operator.*<=" - , "!rhs.EmptyQueue\\(\\)" ); + , R"(!rhs.EmptyQueue\(\))" ); ASSERT_DEATH ( { auto test = bucket_ <= bucketToCompare_;}, assertionString ); } #else @@ -738,7 +738,7 @@ TEST_F ( TestBucketWithZeroElements auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "operator.*<=" - , "!rhs.EmptyQueue\\(\\)" ); + , R"(!rhs.EmptyQueue\(\))" ); try { auto test = bucket_ <= bucketToCompare_; } catch ( std::runtime_error const & error ) { @@ -763,7 +763,7 @@ TEST_F ( TestBucketWithZeroElements auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "operator.*>" - , "!rhs.EmptyQueue\\(\\)" ); + , R"(!rhs.EmptyQueue\(\))" ); ASSERT_DEATH ( { auto test = bucket_ > bucketToCompare_;} , assertionString ); } @@ -776,7 +776,7 @@ TEST_F ( TestBucketWithZeroElements auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "operator.*>" - , "!rhs.EmptyQueue\\(\\)" ); + , R"(!rhs.EmptyQueue\(\))" ); try { auto test = bucket_ > bucketToCompare_; } catch ( std::runtime_error const & error ) @@ -804,7 +804,7 @@ TEST_F ( TestBucketWithZeroElements auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "operator.*>=" - , "!rhs.EmptyQueue\\(\\)"); + , R"(!rhs.EmptyQueue\(\))"); ASSERT_DEATH ( { auto test = bucket_ >= bucketToCompare_;} , assertionString ); } @@ -817,7 +817,7 @@ TEST_F ( TestBucketWithZeroElements auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "operator.*>=" - , "!rhs.EmptyQueue\\(\\)"); + , R"(!rhs.EmptyQueue\(\))"); try { auto test = bucket_ >= bucketToCompare_; } catch ( std::runtime_error const & error ) @@ -918,7 +918,7 @@ TEST_F ( TestBucketWithMultipleInteger auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "ElementAt" - , "HasElementAt\\(index\\)" ); + , R"(HasElementAt\(index\))" ); ASSERT_DEATH ( {bucket_.ElementAt(0);}, assertionString ); ASSERT_DEATH ( {bucket_.ElementAt(1);}, assertionString ); @@ -934,7 +934,7 @@ TEST_F ( TestBucketWithMultipleInteger auto assertionString2 = buildAssertionString ( "Bucket.hpp" , "Bucket" , "Pop" - , "!EmptyQueue\\(\\)" ); + , R"(!EmptyQueue\(\))" ); ASSERT_DEATH ( {bucket_.Pop();}, assertionString2 ); } #else @@ -945,7 +945,7 @@ TEST_F ( TestBucketWithMultipleInteger auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "ElementAt" - , "HasElementAt\\(index\\)" ); + , R"(HasElementAt\(index\))" ); try { try { bucket_.ElementAt(0); @@ -976,7 +976,7 @@ TEST_F ( TestBucketWithMultipleInteger auto assertionString2 = buildAssertionString ( "Bucket.hpp" , "Bucket" , "Pop" - , "!EmptyQueue\\(\\)" ); + , R"(!EmptyQueue\(\))" ); try { bucket_.Pop(); } catch ( std::runtime_error const & error ) @@ -1002,8 +1002,8 @@ TEST_F ( TestBucketWithMultipleInteger auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" - , "operator.*\\[\\]" - , "HasElementAt\\(index\\)" ); + , R"(operator.*\[\])" + , R"(HasElementAt\(index\))" ); ASSERT_DEATH ( { bucket_[0]; }, assertionString ); ASSERT_DEATH ( { bucket_[1]; }, assertionString ); @@ -1016,8 +1016,8 @@ TEST_F ( TestBucketWithMultipleInteger { auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" - , "operator.*\\[\\]" - , "HasElementAt\\(index\\)" ); + , R"(operator.*\[\])" + , R"(HasElementAt\(index\))" ); try { try { bucket_[0]; @@ -1092,7 +1092,7 @@ TEST_F ( TestBucketWithMultipleInteger auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "Pop" - , "!EmptyQueue\\(\\)" ); + , R"(!EmptyQueue\(\))" ); ASSERT_DEATH ( {bucket_.Pop();}, assertionString ); bucket_.template for_all_processed_elements( @@ -1116,7 +1116,7 @@ TEST_F ( TestBucketWithMultipleInteger auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "Pop" - , "!EmptyQueue\\(\\)" ); + , R"(!EmptyQueue\(\))" ); try { bucket_.Pop(); } catch ( std::runtime_error const & error ) @@ -1157,7 +1157,7 @@ TEST_F ( TestBucketWithMultipleInteger auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "DeleteTop" - , "!EmptyQueue\\(\\)" ); + , R"(!EmptyQueue\(\))" ); ASSERT_DEATH ( {bucket_.DeleteTop();}, assertionString ); bucket_.template for_all_processed_elements( @@ -1183,7 +1183,7 @@ TEST_F ( TestBucketWithMultipleInteger auto assertionString = buildAssertionString ( "Bucket.hpp" , "Bucket" , "DeleteTop" - , "!EmptyQueue\\(\\)" ); + , R"(!EmptyQueue\(\))" ); try { bucket_.DeleteTop(); } catch ( std::runtime_error const & error ) diff --git a/tests/DataStructures/Container/TestMappingBinaryHeap.cpp b/tests/DataStructures/Container/TestMappingBinaryHeap.cpp index 92136874..2f216f9c 100644 --- a/tests/DataStructures/Container/TestMappingBinaryHeap.cpp +++ b/tests/DataStructures/Container/TestMappingBinaryHeap.cpp @@ -71,7 +71,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, Content) { auto assertionString = buildAssertionString ( "MappingBinaryHeap.hpp" , "MappingBinaryHeap" , "Top" - , "!Empty\\(\\)"); + , R"(!Empty\(\))"); ASSERT_DEATH({heapConst_.Top();}, assertionString); } #else @@ -82,7 +82,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, Content) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "Top" - , "!Empty\\(\\)"); + , R"(!Empty\(\))"); try { heapConst_.Top(); } catch ( std::runtime_error const & error ) { @@ -115,7 +115,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, Top) { auto assertionString = buildAssertionString ( "MappingBinaryHeap.hpp" , "MappingBinaryHeap" , "TopElement" - , "!Empty\\(\\)"); + , R"(!Empty\(\))"); ASSERT_DEATH( {heapConst_.TopElement();}, assertionString ); } #else @@ -126,7 +126,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, Top) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "TopElement" - , "!Empty\\(\\)"); + , R"(!Empty\(\))"); try { heapConst_.TopElement(); } catch ( std::runtime_error const & error ) { @@ -155,7 +155,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, TopElement) { auto assertionString = buildAssertionString ( "MappingBinaryHeap.hpp" , "MappingBinaryHeap" , "TopKey" - , "!Empty\\(\\)"); + , R"(!Empty\(\))"); ASSERT_DEATH( {heapConst_.TopKey();}, assertionString ); } #else @@ -166,7 +166,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, TopElement) { auto assertionString = buildAssertionString ( "MappingBinaryHeap.hpp" , "MappingBinaryHeap" , "TopKey" - , "!Empty\\(\\)"); + , R"(!Empty\(\))"); try { heapConst_.TopKey(); } catch ( std::runtime_error const & error ) { @@ -815,7 +815,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, EmplaceEqual) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "DeleteTop" - , "!Empty\\(\\)"); + , R"(!Empty\(\))"); ASSERT_DEATH( {heap_.DeleteTop();}, assertionString ); } #else @@ -826,7 +826,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, EmplaceEqual) { auto assertionString = buildAssertionString ( "BinaryHeap.hpp" , "BinaryHeap" , "DeleteTop" - , "!Empty\\(\\)"); + , R"(!Empty\(\))"); try { heap_.DeleteTop(); } catch ( std::runtime_error const & error ) { @@ -867,7 +867,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, DeleteTop) { auto assertionString = buildAssertionString ( "MappingBinaryHeap.hpp" , "MappingBinaryHeap" , "Pop" - , "!Empty\\(\\)"); + , R"(!Empty\(\))"); ASSERT_DEATH( {heap_.Pop();}, assertionString ); } #else @@ -878,7 +878,7 @@ TEST_F(TestMappingBinaryHeapWithMultipleElements, DeleteTop) { auto assertionString = buildAssertionString ( "MappingBinaryHeap.hpp" , "MappingBinaryHeap" , "Pop" - , "!Empty\\(\\)"); + , R"(!Empty\(\))"); try { heap_.Pop(); } catch ( std::runtime_error const & error ) { diff --git a/tests/DataStructures/Graphs/TestDynamicGraph.cpp b/tests/DataStructures/Graphs/TestDynamicGraph.cpp index 0f9bba66..76b3c01b 100644 --- a/tests/DataStructures/Graphs/TestDynamicGraph.cpp +++ b/tests/DataStructures/Graphs/TestDynamicGraph.cpp @@ -16,7 +16,7 @@ namespace egoa::test { #ifdef EGOA_ENABLE_ASSERTION TEST_F(TestDynamicGraphEmptyDeathTest, DeleteVertex) { auto assertionMessage = - this->assertionString("RemoveVertexAt", "VertexExists\\(id\\)"); + this->assertionString("RemoveVertexAt", R"(VertexExists\(id\))"); Types::vertexId id = 0; EXPECT_DEATH( { this->graph_.RemoveVertexAt(id); }, assertionMessage); } @@ -25,7 +25,7 @@ namespace egoa::test { TEST_F ( TestDynamicGraphEmpty , DeleteVertexExceptionHandling ) { - auto assertionString = this->assertionString("RemoveVertexAt", "VertexExists\\(id\\)"); + auto assertionString = this->assertionString("RemoveVertexAt", R"(VertexExists\(id\))"); Types::vertexId id = 0; try { this->graph_.RemoveVertexAt(id); diff --git a/tests/DataStructures/Graphs/TestGraph.cpp b/tests/DataStructures/Graphs/TestGraph.cpp index a03c86d6..a1eed9a1 100644 --- a/tests/DataStructures/Graphs/TestGraph.cpp +++ b/tests/DataStructures/Graphs/TestGraph.cpp @@ -944,7 +944,7 @@ TYPED_TEST( TestGraphStar, EdgesIterateBackwardsConst) { #pragma mark VertexAt #ifdef EGOA_ENABLE_ASSERTION TYPED_TEST(TestGraphEmptyDeathTest, VertexAt) { - auto assertionString = this->assertionString("VertexAt", "VertexExists\\(id\\)"); + auto assertionString = this->assertionString("VertexAt", R"(VertexExists\(id\))"); Types::vertexId id = 0; EXPECT_DEATH( {this->graph_.VertexAt(id);}, assertionString); EXPECT_DEATH( {this->graphConst_.VertexAt(id);}, assertionString); @@ -956,7 +956,7 @@ TYPED_TEST( TestGraphStar, EdgesIterateBackwardsConst) { , VertexAtExceptionHandling ) { auto assertionString = this->assertionString( "VertexAt" - , "VertexExists\\(id\\)"); + , R"(VertexExists\(id\))"); Types::vertexId id = 0; try { this->graph_.VertexAt(id); @@ -981,7 +981,7 @@ TYPED_TEST( TestGraphStar, EdgesIterateBackwardsConst) { #ifdef EGOA_ENABLE_ASSERTION TYPED_TEST(TestGraphSingleVertexDeathTest, VertexAt) { - auto assertionString = this->assertionString("VertexAt", "VertexExists\\(id\\)"); + auto assertionString = this->assertionString("VertexAt", R"(VertexExists\(id\))"); Types::vertexId id = this->id_ + 1; EXPECT_DEATH( {this->graph_.VertexAt(id);}, assertionString); EXPECT_DEATH( {this->graphConst_.VertexAt(id);}, assertionString); @@ -992,7 +992,7 @@ TYPED_TEST(TestGraphSingleVertexDeathTest, VertexAt) { , VertexAtExceptionHandling ) { auto assertionString = this->assertionString( "VertexAt" - , "VertexExists\\(id\\)"); + , R"(VertexExists\(id\))"); Types::vertexId id = this->id_ + 1; try { this->graph_.VertexAt(id); @@ -1016,7 +1016,7 @@ TYPED_TEST(TestGraphSingleVertexDeathTest, VertexAt) { #ifdef EGOA_ENABLE_ASSERTION TYPED_TEST(TestGraphFourVerticesDeathTest, VertexAt) { - auto assertionString = this->assertionString("VertexAt", "VertexExists\\(id\\)"); + auto assertionString = this->assertionString("VertexAt", R"(VertexExists\(id\))"); Types::vertexId id = Const::NONE; EXPECT_DEATH( {this->graph_.VertexAt(id);}, assertionString); EXPECT_DEATH( {this->graphConst_.VertexAt(id);}, assertionString); @@ -1027,7 +1027,7 @@ TYPED_TEST(TestGraphSingleVertexDeathTest, VertexAt) { , VertexAtExceptionHandling ) { auto assertionString = this->assertionString( "VertexAt" - , "VertexExists\\(id\\)"); + , R"(VertexExists\(id\))"); Types::vertexId id = Const::NONE; try { this->graph_.VertexAt(id); @@ -1068,7 +1068,7 @@ TYPED_TEST(TestGraphStar, VertexAt) { /// @todo death tests for neighbors of non-existent vertices #ifdef EGOA_ENABLE_ASSERTION TYPED_TEST(TestGraphEmptyDeathTest, NeighborsOf) { - auto assertionString = this->assertionString("NeighborsOf", "VertexExists\\(id\\)"); + auto assertionString = this->assertionString("NeighborsOf", R"(VertexExists\(id\))"); Types::vertexId id = 0; EXPECT_DEATH( {this->graph_.NeighborsOf(id);}, assertionString); EXPECT_DEATH( {this->graphConst_.NeighborsOf(id);}, assertionString); @@ -1079,7 +1079,7 @@ TYPED_TEST(TestGraphStar, VertexAt) { , NeighborsOfExceptionHandling ) { auto assertionString = this->assertionString( "NeighborsOf" - , "VertexExists\\(id\\)"); + , R"(VertexExists\(id\))"); Types::vertexId id = 0; try { this->graph_.NeighborsOf(id); @@ -1103,7 +1103,7 @@ TYPED_TEST(TestGraphStar, VertexAt) { #ifdef EGOA_ENABLE_ASSERTION TYPED_TEST(TestGraphSingleVertexDeathTest, NeighborsOf) { - auto assertionString = this->assertionString("NeighborsOf", "VertexExists\\(id\\)"); + auto assertionString = this->assertionString("NeighborsOf", R"(VertexExists\(id\))"); Types::vertexId id = this->id_ + 1; EXPECT_DEATH( {this->graph_.NeighborsOf(id);}, assertionString); EXPECT_DEATH( {this->graphConst_.NeighborsOf(id);}, assertionString); @@ -1114,7 +1114,7 @@ TYPED_TEST(TestGraphStar, VertexAt) { , NeighborsOfExceptionHandling ) { auto assertionString = this->assertionString( "NeighborsOf" - , "VertexExists\\(id\\)"); + , R"(VertexExists\(id\))"); Types::vertexId id = this->id_ + 1; try { this->graph_.NeighborsOf(id); @@ -1138,7 +1138,7 @@ TYPED_TEST(TestGraphStar, VertexAt) { #ifdef EGOA_ENABLE_ASSERTION TYPED_TEST(TestGraphFourVerticesDeathTest, NeighborsOf) { - auto assertionString = this->assertionString("NeighborsOf", "VertexExists\\(id\\)"); + auto assertionString = this->assertionString("NeighborsOf", R"(VertexExists\(id\))"); Types::vertexId id = Const::NONE; EXPECT_DEATH( {this->graph_.NeighborsOf(id);}, assertionString); EXPECT_DEATH( {this->graphConst_.NeighborsOf(id);}, assertionString); @@ -1149,7 +1149,7 @@ TYPED_TEST(TestGraphStar, VertexAt) { , NeighborsOfExceptionHandling ) { auto assertionString = this->assertionString( "NeighborsOf" - , "VertexExists\\(id\\)"); + , R"(VertexExists\(id\))"); Types::vertexId id = Const::NONE; try { this->graph_.NeighborsOf(id); @@ -2149,7 +2149,7 @@ TYPED_TEST(TestGraphStar, ForAllEdgeTuplesConst) { #pragma mark ForAllEdgesAt #ifdef EGOA_ENABLE_ASSERTION TYPED_TEST(TestGraphEmptyDeathTest, ForAllEdgesAt) { - auto assertionString = this->assertionString("for_all_edges_at", "VertexExists\\(vertexId\\)"); + auto assertionString = this->assertionString("for_all_edges_at", R"(VertexExists\(vertexId\))"); Types::vertexId nonexistentId = 3; EXPECT_DEATH( { this->graph_.template for_all_edges_at( @@ -2166,7 +2166,7 @@ TYPED_TEST(TestGraphEmptyDeathTest, ForAllEdgesAt) { , ForAllEdgesAtExceptionHandling ) { auto assertionString = this->assertionString( "for_all_edges_at" - , "VertexExists\\(vertexId\\)"); + , R"(VertexExists\(vertexId\))"); Types::vertexId nonexistentId = 3; try { this->graph_.template for_all_edges_at( @@ -2188,7 +2188,7 @@ TYPED_TEST(TestGraphEmptyDeathTest, ForAllEdgesAt) { #ifdef EGOA_ENABLE_ASSERTION TYPED_TEST(TestGraphEmptyDeathTest, ForAllEdgesAtConst) { - auto assertionString = this->assertionString("for_all_edges_at", "VertexExists\\(vertexId\\)"); + auto assertionString = this->assertionString("for_all_edges_at", R"(VertexExists\(vertexId\))"); Types::vertexId nonexistentId = 3; EXPECT_DEATH( { this->graphConst_.template for_all_edges_at( @@ -2205,7 +2205,7 @@ TYPED_TEST(TestGraphEmptyDeathTest, ForAllEdgesAtConst) { , ForAllEdgesAtConstExceptionHandling ) { auto assertionString = this->assertionString( "for_all_edges_at" - , "VertexExists\\(vertexId\\)"); + , R"(VertexExists\(vertexId\))"); Types::vertexId nonexistentId = 3; try { this->graphConst_.template for_all_edges_at( diff --git a/tests/IO/TestPyPsaParser.cpp b/tests/IO/TestPyPsaParser.cpp index 44fe1287..fb5848b8 100644 --- a/tests/IO/TestPyPsaParser.cpp +++ b/tests/IO/TestPyPsaParser.cpp @@ -292,7 +292,7 @@ TEST_F ( PyPSAExampleInconsistencyGeneratorsDeathTest auto assertionString = buildAssertionString ( "PyPsaParser.hpp" , "PyPsaParser" , "ExtractGeneratorMaximumRealPowerPuHeader" - , "false && \"Generator name does not exist\""); + , R"(false && "Generator name does not exist")"); EXPECT_DEATH({egoa::PowerGridIO::read( network_ , graph_ , TestCaseSmallExample_ @@ -318,7 +318,7 @@ TEST_F ( PyPSAExampleDuplicatedGeneratorsDeathTest auto assertionString = buildAssertionString ( "PyPsaParser.hpp" , "PyPsaParser" , "AddNameToGenerator" - , "false && \"Generator duplicates\""); + , R"(false && "Generator duplicates")"); EXPECT_DEATH({egoa::PowerGridIO::read( network_ , graph_ , TestCaseSmallExample_ From 988e0ac09dc61461392155e8088ffc55ecbd2a41 Mon Sep 17 00:00:00 2001 From: Franziska Wegner <57569315+franziska-wegner@users.noreply.github.com> Date: Tue, 2 Jan 2024 06:40:13 -0800 Subject: [PATCH 3/4] Replace Deprecated `assert.h` Header with `cassert` (#75) This PR removes the following C/C++ linter warning, which highlights a deprecated include header `assert.h` and asks to replace it with `cassert`. --- src/Runnables/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Runnables/main.cpp b/src/Runnables/main.cpp index a17e4491..6bc562e3 100644 --- a/src/Runnables/main.cpp +++ b/src/Runnables/main.cpp @@ -32,10 +32,10 @@ #include #include -#include +#include #include #include -#include +#include #include #include "DataStructures/Networks/PowerGrid.hpp" From cb587f831f1a80063c76b2caf2b69105e83597a2 Mon Sep 17 00:00:00 2001 From: Franziska Wegner <57569315+franziska-wegner@users.noreply.github.com> Date: Tue, 2 Jan 2024 08:31:57 -0800 Subject: [PATCH 4/4] Download Artifacts in Code Documentation Workflow (#76) This PR add the code to download the artifacts from a previous workflow. --- .github/workflows/code-documentation.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/code-documentation.yml b/.github/workflows/code-documentation.yml index 10d87531..4c989883 100644 --- a/.github/workflows/code-documentation.yml +++ b/.github/workflows/code-documentation.yml @@ -57,6 +57,12 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Download Build Directory + uses: actions/download-artifact@main + with: + name: cmake-build-artifact-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.cpp_compiler }} + path: ${{ steps.strings.outputs.build-output-dir }} + # Compared to Window and MacOS best option with stable ~2 min installation time. - name: Install LaTeX (Linux) if: startsWith(matrix.os,'ubuntu-')