Refactors constants out of Ranks.h.
This commit is contained in:
@@ -11,6 +11,22 @@ using std::string;
|
|||||||
using std::vector;
|
using std::vector;
|
||||||
} // End namespace
|
} // End namespace
|
||||||
|
|
||||||
|
const std::string kRankPrimaryLabel = "Primary";
|
||||||
|
const std::string kRankSecondaryLabel = "Secondary";
|
||||||
|
const std::string kRankTertiaryLabel = "Tertiary";
|
||||||
|
const int kRanksCount = 3;
|
||||||
|
const RankType kRankPrimary = {kRankPrimaryId, kRankPrimaryLabel};
|
||||||
|
const RankType kRankSecondary = {kRankSecondaryId, kRankSecondaryLabel};
|
||||||
|
const RankType kRankTertiary = {kRankTertiaryId, kRankTertiaryLabel};
|
||||||
|
const RankType kRankUnknown = {0, ""};
|
||||||
|
|
||||||
|
const RankType kRanks[]{
|
||||||
|
kRankUnknown,
|
||||||
|
kRankPrimary,
|
||||||
|
kRankSecondary,
|
||||||
|
kRankTertiary,
|
||||||
|
};
|
||||||
|
|
||||||
ostream& operator<<(ostream& os, const RankType& rank) {
|
ostream& operator<<(ostream& os, const RankType& rank) {
|
||||||
os << "Rank: {id: " << rank.id << ", label: \"" << rank.label << "\"}";
|
os << "Rank: {id: " << rank.id << ", label: \"" << rank.label << "\"}";
|
||||||
return os;
|
return os;
|
||||||
|
|||||||
@@ -16,30 +16,14 @@
|
|||||||
*/
|
*/
|
||||||
namespace SBF {
|
namespace SBF {
|
||||||
const int kRankPrimaryId = 1;
|
const int kRankPrimaryId = 1;
|
||||||
const std::string kRankPrimaryLabel = "Primary";
|
|
||||||
const int kRankSecondaryId = 2;
|
const int kRankSecondaryId = 2;
|
||||||
const std::string kRankSecondaryLabel = "Secondary";
|
|
||||||
const int kRankTertiaryId = 3;
|
const int kRankTertiaryId = 3;
|
||||||
const std::string kRankTertiaryLabel = "Tertiary";
|
|
||||||
const int kRanksCount = 3;
|
|
||||||
|
|
||||||
struct RankType {
|
struct RankType {
|
||||||
int id;
|
int id;
|
||||||
std::string label;
|
std::string label;
|
||||||
};
|
};
|
||||||
|
|
||||||
const RankType kRankPrimary = {kRankPrimaryId, kRankPrimaryLabel};
|
|
||||||
const RankType kRankSecondary = {kRankSecondaryId, kRankSecondaryLabel};
|
|
||||||
const RankType kRankTertiary = {kRankTertiaryId, kRankTertiaryLabel};
|
|
||||||
const RankType kRankUnknown = {0, ""};
|
|
||||||
|
|
||||||
const RankType kRanks[]{
|
|
||||||
kRankUnknown,
|
|
||||||
kRankPrimary,
|
|
||||||
kRankSecondary,
|
|
||||||
kRankTertiary,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// @brief Writes a rank to an ostream.
|
/// @brief Writes a rank to an ostream.
|
||||||
/// @param os The ostream to write to.
|
/// @param os The ostream to write to.
|
||||||
/// @param rank The rank to write.
|
/// @param rank The rank to write.
|
||||||
|
|||||||
@@ -14,6 +14,21 @@ using namespace Test;
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
} // End namespace
|
} // End namespace
|
||||||
|
|
||||||
|
const std::string kRankPrimaryLabel = "Primary";
|
||||||
|
const std::string kRankSecondaryLabel = "Secondary";
|
||||||
|
const std::string kRankTertiaryLabel = "Tertiary";
|
||||||
|
const RankType kRankPrimary = {kRankPrimaryId, kRankPrimaryLabel};
|
||||||
|
const RankType kRankSecondary = {kRankSecondaryId, kRankSecondaryLabel};
|
||||||
|
const RankType kRankTertiary = {kRankTertiaryId, kRankTertiaryLabel};
|
||||||
|
const RankType kRankUnknown = {0, ""};
|
||||||
|
|
||||||
|
const RankType kRanks[]{
|
||||||
|
kRankUnknown,
|
||||||
|
kRankPrimary,
|
||||||
|
kRankSecondary,
|
||||||
|
kRankTertiary,
|
||||||
|
};
|
||||||
|
|
||||||
TestResults test_GetRank() {
|
TestResults test_GetRank() {
|
||||||
return execute_suite<RankType, int>(make_test_suite(
|
return execute_suite<RankType, int>(make_test_suite(
|
||||||
"SBF::GetRank",
|
"SBF::GetRank",
|
||||||
|
|||||||
Reference in New Issue
Block a user