From f44a605125019360c5698c1c5d5277bc1104b31b Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Wed, 13 Nov 2024 14:02:56 -0500 Subject: [PATCH 1/2] Rename GetDrvrReturnStatus to GetDrvrReturnStatusMsg --- app/include/ReturnCodes.h | 2 +- app/src/Driver.cpp | 2 +- app/src/ReturnCodes.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/include/ReturnCodes.h b/app/include/ReturnCodes.h index 3a6eac7..5866bba 100644 --- a/app/include/ReturnCodes.h +++ b/app/include/ReturnCodes.h @@ -29,4 +29,4 @@ enum DrvrReturnCode { }; // clang-format on -std::string GetDrvrReturnStatus(int code); +std::string GetDrvrReturnStatusMsg(int code); diff --git a/app/src/Driver.cpp b/app/src/Driver.cpp index 62e1bf4..45ea55c 100644 --- a/app/src/Driver.cpp +++ b/app/src/Driver.cpp @@ -179,7 +179,7 @@ DrvrReturnCode ValidateInputs(const DrvrParams ¶ms) { rtn = DRVRERR__VALIDATION_OUT_FILE; if (rtn != DRVR__SUCCESS) - std::cerr << GetDrvrReturnStatus(rtn) << std::endl; + std::cerr << GetDrvrReturnStatusMsg(rtn) << std::endl; return rtn; } diff --git a/app/src/ReturnCodes.cpp b/app/src/ReturnCodes.cpp index 22a3b3c..6f715d8 100644 --- a/app/src/ReturnCodes.cpp +++ b/app/src/ReturnCodes.cpp @@ -13,7 +13,7 @@ * @param[in] code Driver return code. * @return A status message corresponding to the input code. ******************************************************************************/ -std::string GetDrvrReturnStatus(int code) { +std::string GetDrvrReturnStatusMsg(int code) { static const std::unordered_map messages = { {DRVR__SUCCESS, "Successful execution"}, {DRVR__RETURN_SUCCESS, "Internal driver success"}, From 19b2e9d6223006934cdffa3d44b1e89dca5e6a39 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Wed, 13 Nov 2024 14:10:04 -0500 Subject: [PATCH 2/2] unique variable name in class methods --- app/tests/TestDriver.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/app/tests/TestDriver.h b/app/tests/TestDriver.h index ecfd2ac..c4fe08d 100644 --- a/app/tests/TestDriver.h +++ b/app/tests/TestDriver.h @@ -63,23 +63,23 @@ class DriverTest: public ::testing::Test { * struct. Optionally, the command can be written such that stdout and * are suppressed. * - * @param[in] params The driver parameters - * @param[in] suppressOutputs Whether to suppress outputs (default: true) - * @return The constructed command string + * @param[in] dParams The driver parameters + * @param[in] suppressOutputs Whether to suppress outputs (default: true) + * @return The constructed command string **********************************************************************/ std::string BuildCommand( - const DrvrParams ¶ms, const bool suppressOutputs = true + const DrvrParams &dParams, const bool suppressOutputs = true ) { // TODO-TEMPLATE: Modify this function to correctly // unpack the DrvrParams struct and build the command // Construct command from parameters std::string command = executable; - command += " -i " + params.in_file; - if (params.DBG) { + command += " -i " + dParams.in_file; + if (dParams.DBG) { command += " -DBG"; } - command += " -o " + params.out_file; + command += " -o " + dParams.out_file; // Suppress text output of the driver, to avoid cluttering // test outputs. @@ -112,11 +112,11 @@ class DriverTest: public ::testing::Test { /*********************************************************************** * Runs the driver executable. * - * @param[in] params Parameters to parse as command line arguments - * @return Return code from the driver execution + * @param[in] dParams Parameters to parse as command line arguments + * @return Return code from the driver execution **********************************************************************/ - int RunDriver(const DrvrParams ¶ms) { - std::string cmd = BuildCommand(params); + int RunDriver(const DrvrParams &dParams) { + std::string cmd = BuildCommand(dParams); return RunCommand(cmd); } @@ -131,13 +131,13 @@ class DriverTest: public ::testing::Test { * driver, it is deleted before this method returns. * * @param[in] inFileContents The contents to write to the input file - * @param[in] params A populated driver parameters struct (see above) + * @param[in] dParams A populated driver parameters struct (see above) * @return Return code from the driver execution **********************************************************************/ int RunDriverWithInputFile( - const std::string &inFileContents, const DrvrParams ¶ms + const std::string &inFileContents, const DrvrParams &dParams ) { - DrvrParams updated_params = params; + DrvrParams updated_params = dParams; TempTextFile tempFile(inFileContents); updated_params.in_file = tempFile.getFileName(); int rtn = RunDriver(updated_params);