From 649203b7f1d5f8b0aabd4e9a673531fded82895f Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Fri, 8 Nov 2024 16:04:37 -0500 Subject: [PATCH 1/5] fix template code so tests all pass --- app/src/Driver.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/Driver.cpp b/app/src/Driver.cpp index cb7efeb..357f7b8 100644 --- a/app/src/Driver.cpp +++ b/app/src/Driver.cpp @@ -32,6 +32,14 @@ int main(int argc, char **argv) { // TODO-TEMPLATE: Add driver logic, e.g. validating inputs and calling the model + // TODO-TEMPLATE this code block exists for a unit test to pass. Similar logic + // should be added to functions which parse input files. + std::ifstream file(params.in_file); + if (!file) { + std::cerr << "Failed to open file " << params.in_file << std::endl; + return DRVRERR__OPENING_INPUT_FILE; + } + // Return driver error code if one was returned if (rtn > DRVR__RETURN_SUCCESS) return rtn; @@ -68,7 +76,7 @@ int main(int argc, char **argv) { DrvrReturnCode ParseArguments(int argc, char **argv, DrvrParams ¶ms) { // TODO-TEMPLATE: Populate vector with all valid arguments const std::vector validArgs - = {"-i", "-o", "-h", "--help", "-v", "--version"}; + = {"-i", "-o", "-dbg", "-h", "--help", "-v", "--version"}; for (int i = 1; i < argc; i++) { // Parse arg to lowercase string @@ -93,6 +101,7 @@ DrvrReturnCode ParseArguments(int argc, char **argv, DrvrParams ¶ms) { // TODO-TEMPLATE handle any model input flags here } else if (arg == "-dbg") { params.DBG = true; + continue; } // Check if end of arguments reached or next argument is another flag From 9d98550bc9b7206e158ce216199a9803763b9815 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Fri, 8 Nov 2024 16:06:24 -0500 Subject: [PATCH 2/5] Run actions on template --- .github/workflows/ctest.yml | 1 - .github/workflows/doxygen.yml | 1 - .github/workflows/release.yml | 1 - 3 files changed, 3 deletions(-) diff --git a/.github/workflows/ctest.yml b/.github/workflows/ctest.yml index 6987805..c53cfb9 100644 --- a/.github/workflows/ctest.yml +++ b/.github/workflows/ctest.yml @@ -12,7 +12,6 @@ on: # Define the matrix for different operating systems jobs: build-and-test: - if: ${{ github.repository != 'NTIA/proplib-template' }} name: ${{ matrix.os }} / CMake ${{ matrix.cmakeVersion }} runs-on: ${{ matrix.os }} strategy: diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml index 9a2f311..0870eaf 100644 --- a/.github/workflows/doxygen.yml +++ b/.github/workflows/doxygen.yml @@ -18,7 +18,6 @@ concurrency: jobs: build: - if: ${{ github.repository != 'NTIA/proplib-template' }} runs-on: ubuntu-latest steps: - name: Checkout repository diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 815d0d9..f9a25c9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,6 @@ permissions: jobs: create_release_artifacts: - if: github.repository != 'NTIA/proplib-template' name: Create release artifacts runs-on: ${{ matrix.os }} strategy: From 2f55d04b111d414e872f81a9bcd251e7d7062b49 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Fri, 8 Nov 2024 16:07:45 -0500 Subject: [PATCH 3/5] remove template condition --- .github/workflows/doxygen.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml index 0870eaf..e97a974 100644 --- a/.github/workflows/doxygen.yml +++ b/.github/workflows/doxygen.yml @@ -54,7 +54,7 @@ jobs: path: ./docs/html/ deploy: - if: ${{ (github.event_name == 'release') && (github.repository != 'NTIA/proplib-template') }} + if: ${{ github.event_name == 'release' }} needs: build permissions: contents: read From 07484c3348cda2064e538909b493d38c532d14b6 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Fri, 8 Nov 2024 16:08:38 -0500 Subject: [PATCH 4/5] build docs on push to main or dev --- .github/workflows/doxygen.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml index e97a974..a9287dd 100644 --- a/.github/workflows/doxygen.yml +++ b/.github/workflows/doxygen.yml @@ -8,6 +8,8 @@ on: types: ["published"] pull_request: branches: ["main", "dev"] + push: + branches: ["main", "dev"] workflow_dispatch: # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. From d4146b504759d794b1ec7bd688b62cfe754d8458 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Fri, 8 Nov 2024 16:18:55 -0500 Subject: [PATCH 5/5] cleanup includes --- app/include/Driver.h | 1 - app/src/CommaSeparatedIterator.cpp | 7 ++----- app/src/Driver.cpp | 9 +++++++++ app/src/DriverUtils.cpp | 2 +- app/tests/TempTextFile.cpp | 2 +- app/tests/TestDriver.cpp | 2 ++ app/tests/TestDriver.h | 1 - 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/app/include/Driver.h b/app/include/Driver.h index 1d735d7..8c357bf 100644 --- a/app/include/Driver.h +++ b/app/include/Driver.h @@ -10,7 +10,6 @@ // TODO-TEMPLATE: Include your library's main interface header #include "ITS.PropLibTemplate/PropLibTemplate.h" -#include // for std::ofstream #include // for std::left, std::setw #include // for std::cout #include // for std::endl, std::ostream diff --git a/app/src/CommaSeparatedIterator.cpp b/app/src/CommaSeparatedIterator.cpp index 9e665bc..022a952 100644 --- a/app/src/CommaSeparatedIterator.cpp +++ b/app/src/CommaSeparatedIterator.cpp @@ -5,11 +5,8 @@ #include "Driver.h" -#include // for transform -#include // for std::tolower -#include // for std::ptrdiff_t, std::size_t -#include // for std::istream -#include // for std::input_iterator_tag +#include // for std::size_t +#include // for std::istream #include // for std::runtime_error #include // for std::getline, std::string diff --git a/app/src/Driver.cpp b/app/src/Driver.cpp index 357f7b8..62e1bf4 100644 --- a/app/src/Driver.cpp +++ b/app/src/Driver.cpp @@ -3,6 +3,15 @@ */ #include "Driver.h" +#include // for std::find +#include // for std::ifstream, std::ofstream +#include // for std::setw +#include // for std::left +#include // for std::cerr +#include // for std::endl +#include // for std::string +#include // for std::vector + /******************************************************************************* * Main function of the driver executable * diff --git a/app/src/DriverUtils.cpp b/app/src/DriverUtils.cpp index e4c5766..b4c5e56 100644 --- a/app/src/DriverUtils.cpp +++ b/app/src/DriverUtils.cpp @@ -16,9 +16,9 @@ #include // for std::transform #include // for std::tolower #include // for localtime_{s,r}, std::{time, time_t, tm, strftime} -#include // for std::ofstream #include // for std::setfill, std::setw #include // for std::cerr, std::endl +#include // for std::ostream #include // for std::stod, std::stoi, std::string /****************************************************************************** diff --git a/app/tests/TempTextFile.cpp b/app/tests/TempTextFile.cpp index ab572a5..f814e3d 100644 --- a/app/tests/TempTextFile.cpp +++ b/app/tests/TempTextFile.cpp @@ -19,7 +19,7 @@ #include // for std::remove #include // for std::ofstream -#include // for std::cerr, std::cout, std::ios::trunc +#include // for std::cerr, std::ios::trunc #include // for std::endl #include // for std::runtime_error #include // for std::string diff --git a/app/tests/TestDriver.cpp b/app/tests/TestDriver.cpp index 70ab160..abc9083 100644 --- a/app/tests/TestDriver.cpp +++ b/app/tests/TestDriver.cpp @@ -3,6 +3,8 @@ */ #include "TestDriver.h" +#include // for std::string + TEST_F(DriverTest, MissingOptionError1) { // Test case: missing option between two provided flags std::string cmd = executable + " -i -o out.txt"; diff --git a/app/tests/TestDriver.h b/app/tests/TestDriver.h index a1daf12..ecfd2ac 100644 --- a/app/tests/TestDriver.h +++ b/app/tests/TestDriver.h @@ -6,7 +6,6 @@ #include "Driver.h" #include "TempTextFile.h" -#include // for std::replace #include // for std::remove, std::perror #include // for std::system #include // GoogleTest