ICU-9725 C GenderInfo must handle single item lists correctly by returning the gender of the sole item.
X-SVN-Rev: 32761
This commit is contained in:
parent
d328bb3289
commit
69d9432ee2
@ -173,7 +173,7 @@ UGender GenderInfo::getListGender(const UGender* genders, int32_t length, UError
|
||||
if (U_FAILURE(status)) {
|
||||
return UGENDER_OTHER;
|
||||
}
|
||||
if (length == 0 || _style == NEUTRAL) {
|
||||
if (length == 0) {
|
||||
return UGENDER_OTHER;
|
||||
}
|
||||
if (length == 1) {
|
||||
@ -182,6 +182,8 @@ UGender GenderInfo::getListGender(const UGender* genders, int32_t length, UError
|
||||
UBool has_female = FALSE;
|
||||
UBool has_male = FALSE;
|
||||
switch (_style) {
|
||||
case NEUTRAL:
|
||||
return UGENDER_OTHER;
|
||||
case MIXED_NEUTRAL:
|
||||
for (int32_t i = 0; i < length; ++i) {
|
||||
switch (genders[i]) {
|
||||
|
@ -55,8 +55,8 @@ void GenderInfoTest::runIndexedTest(int32_t index, UBool exec, const char *&name
|
||||
|
||||
void GenderInfoTest::TestGetListGender() {
|
||||
check(UGENDER_OTHER, UGENDER_OTHER, UGENDER_OTHER, NULL, 0);
|
||||
check(UGENDER_OTHER, UGENDER_FEMALE, UGENDER_FEMALE, kSingleFemale, LENGTHOF(kSingleFemale));
|
||||
check(UGENDER_OTHER, UGENDER_MALE, UGENDER_MALE, kSingleMale, LENGTHOF(kSingleMale));
|
||||
check(UGENDER_FEMALE, UGENDER_FEMALE, UGENDER_FEMALE, kSingleFemale, LENGTHOF(kSingleFemale));
|
||||
check(UGENDER_MALE, UGENDER_MALE, UGENDER_MALE, kSingleMale, LENGTHOF(kSingleMale));
|
||||
check(UGENDER_OTHER, UGENDER_OTHER, UGENDER_OTHER, kSingleOther, LENGTHOF(kSingleOther));
|
||||
|
||||
check(UGENDER_OTHER, UGENDER_FEMALE, UGENDER_FEMALE, kAllFemale, LENGTHOF(kAllFemale));
|
||||
|
Loading…
Reference in New Issue
Block a user