Refactors constants out of Genders.h.
This commit is contained in:
@@ -7,6 +7,21 @@ namespace SBF {
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
const int kGendersCount = 5;
|
||||
const std::string kGenderMaleLabel = "Male";
|
||||
const std::string kGenderFemaleLabel = "Female";
|
||||
const std::string kGenderTransMaleLabel = "Trans-Male";
|
||||
const std::string kGenderTransFemaleLabel = "Trans-Female";
|
||||
const std::string kGenderNonBinaryLabel = "Non-Binary";
|
||||
const std::string kGenderLabels[] = {
|
||||
"",
|
||||
kGenderMaleLabel,
|
||||
kGenderFemaleLabel,
|
||||
kGenderTransMaleLabel,
|
||||
kGenderTransFemaleLabel,
|
||||
kGenderNonBinaryLabel,
|
||||
};
|
||||
|
||||
string GetGenderLabel(int genderId) {
|
||||
if (genderId > 0 && genderId <= kGendersCount) {
|
||||
return kGenderLabels[genderId];
|
||||
|
||||
@@ -16,24 +16,10 @@
|
||||
*/
|
||||
namespace SBF {
|
||||
const int kGenderMaleId = 1;
|
||||
const std::string kGenderMaleLabel = "Male";
|
||||
const int kGenderFemaleId = 2;
|
||||
const std::string kGenderFemaleLabel = "Female";
|
||||
const int kGenderTransMaleId = 3;
|
||||
const std::string kGenderTransMaleLabel = "Trans-Male";
|
||||
const int kGenderTransFemaleId = 4;
|
||||
const std::string kGenderTransFemaleLabel = "Trans-Female";
|
||||
const int kGenderNonBinaryId = 5;
|
||||
const std::string kGenderNonBinaryLabel = "Non-Binary";
|
||||
const int kGendersCount = 5;
|
||||
const std::string kGenderLabels[] = {
|
||||
"",
|
||||
kGenderMaleLabel,
|
||||
kGenderFemaleLabel,
|
||||
kGenderTransMaleLabel,
|
||||
kGenderTransFemaleLabel,
|
||||
kGenderNonBinaryLabel,
|
||||
};
|
||||
|
||||
/// @brief Gets a gender label with a specific id.
|
||||
/// @param gender_id The id of the gender to return the label for.
|
||||
|
||||
@@ -14,6 +14,12 @@ using namespace Test;
|
||||
using namespace std;
|
||||
} // End namespace
|
||||
|
||||
const std::string kGenderMaleLabel = "Male";
|
||||
const std::string kGenderFemaleLabel = "Female";
|
||||
const std::string kGenderTransMaleLabel = "Trans-Male";
|
||||
const std::string kGenderTransFemaleLabel = "Trans-Female";
|
||||
const std::string kGenderNonBinaryLabel = "Non-Binary";
|
||||
|
||||
TestResults test_GetGenderLabel() {
|
||||
return execute_suite<string, int>(make_test_suite(
|
||||
"SBF::GetGenderLabel",
|
||||
|
||||
Reference in New Issue
Block a user