-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added some unit tests for Driveboard
- Loading branch information
Showing
3 changed files
with
200 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/****************************************************************************** | ||
* @brief Implements the IdentitySoftware class. | ||
* Handler for incrementing and tracking software version/build numbers. | ||
* | ||
* @file IdentitySoftware.cpp | ||
* @author Eli Byrd (edbgkk@mst.edu), ClayJay3 (claytonraycowen@gmail.com) | ||
* @date 2023-06-20 | ||
* | ||
* @copyright Copyright Mars Rover Design Team 2023 - All Rights Reserved | ||
******************************************************************************/ | ||
|
||
#include "IdentitySoftware.h" | ||
|
||
/****************************************************************************** | ||
* @brief Construct a new IdentitySoftware::IdentitySoftware object. | ||
* | ||
* | ||
* @author Eli Byrd (edbgkk@mst.edu), ClayJay3 (claytonraycowen@gmail.com) | ||
* @date 2023-06-20 | ||
******************************************************************************/ | ||
IdentitySoftware::IdentitySoftware() | ||
{ | ||
// Force extra characters to the version numbers for '0' padding | ||
m_szMajorVersion = "000"; | ||
m_szMinorVersion = "000"; | ||
m_szPatchVersion = "000"; | ||
m_szBuildVersion = "000"; | ||
|
||
// Append the versions after the forced extra characters | ||
m_szMajorVersion += std::to_string(AUTONOMY_MAJOR_VERSION); | ||
m_szMinorVersion += std::to_string(AUTONOMY_MINOR_VERSION); | ||
m_szPatchVersion += std::to_string(AUTONOMY_PATCH_VERSION); | ||
m_szBuildVersion += std::to_string(AUTONOMY_BUILD_VERSION); | ||
|
||
// Shorten the strings down to the appropriate lengths | ||
if (m_szMajorVersion.length() > 2) | ||
{ | ||
m_szMajorVersion.erase(0, m_szMajorVersion.length() - 2); | ||
} | ||
|
||
if (m_szMinorVersion.length() > 2) | ||
{ | ||
m_szMinorVersion.erase(0, m_szMinorVersion.length() - 2); | ||
} | ||
|
||
if (m_szPatchVersion.length() > 2) | ||
{ | ||
m_szPatchVersion.erase(0, m_szPatchVersion.length() - 2); | ||
} | ||
|
||
if (m_szBuildVersion.length() > 3) | ||
{ | ||
m_szBuildVersion.erase(0, m_szBuildVersion.length() - 3); | ||
} | ||
} | ||
|
||
/****************************************************************************** | ||
* @brief Gets the version number of project. | ||
* | ||
* @return std::string - The version number. | ||
* | ||
* @author Eli Byrd (edbgkk@mst.edu), ClayJay3 (claytonraycowen@gmail.com) | ||
* @date 2023-06-20 | ||
******************************************************************************/ | ||
std::string IdentitySoftware::GetVersionNumber() | ||
{ | ||
return "v" + m_szMajorVersion + "." + m_szMinorVersion + "." + m_szPatchVersion; | ||
} | ||
|
||
/****************************************************************************** | ||
* @brief Gets the build number of project. | ||
* | ||
* @return std::string - The build number. | ||
* | ||
* @author Eli Byrd (edbgkk@mst.edu), ClayJay3 (claytonraycowen@gmail.com) | ||
* @date 2023-06-20 | ||
******************************************************************************/ | ||
std::string IdentitySoftware::GetBuildNumber() | ||
{ | ||
return "Build " + m_szBuildVersion; | ||
} | ||
|
||
/****************************************************************************** | ||
* @brief Gets the combo number container version and build info. | ||
* | ||
* @return std::string - The combo number. | ||
* | ||
* @author Eli Byrd (edbgkk@mst.edu), ClayJay3 (claytonraycowen@gmail.com) | ||
* @date 2023-06-20 | ||
******************************************************************************/ | ||
std::string IdentitySoftware::GetVersionBuildComboNumber() | ||
{ | ||
return "v" + m_szMajorVersion + "." + m_szMinorVersion + "." + m_szPatchVersion + " Build " + m_szBuildVersion; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/****************************************************************************** | ||
* @brief Defines the IdentitySoftware class. | ||
* | ||
* @file IdentitySoftware.h | ||
* @author Eli Byrd (edbgkk@mst.edu), ClayJay3 (claytonraycowen@gmail.com) | ||
* @date 2023-06-20 | ||
* | ||
* @copyright Copyright Mars Rover Design Team 2023 - All Rights Reserved | ||
******************************************************************************/ | ||
|
||
#ifndef IDENTITY_SOFTWARE_H | ||
#define IDENTITY_SOFTWARE_H | ||
|
||
/// \cond | ||
#include <string> | ||
/// \endcond | ||
|
||
#define AUTONOMY_MAJOR_VERSION 24 | ||
#define AUTONOMY_MINOR_VERSION 0 | ||
#define AUTONOMY_PATCH_VERSION 0 | ||
#define AUTONOMY_BUILD_VERSION 0 | ||
|
||
class IdentitySoftware | ||
{ | ||
private: | ||
std::string m_szMajorVersion; | ||
std::string m_szMinorVersion; | ||
std::string m_szPatchVersion; | ||
std::string m_szBuildVersion; | ||
|
||
public: | ||
IdentitySoftware(); | ||
|
||
std::string GetVersionNumber(); | ||
std::string GetBuildNumber(); | ||
std::string GetVersionBuildComboNumber(); | ||
}; | ||
|
||
#endif // IDENTITY_SOFTWARE_H |
Oops, something went wrong.