ICU-21935 DisplayOptions cleanup

This commit is contained in:
Markus Scherer 2022-05-25 15:04:52 -07:00
parent e17219582e
commit 8d5a97ae0f
10 changed files with 1247 additions and 1239 deletions

View file

@ -5,48 +5,56 @@
#if !UCONFIG_NO_FORMATTING
#include "cstring.h"
#include "unicode/displayoptions.h"
#include "unicode/udisplayoptions.h"
#include "cstring.h"
icu::DisplayOptions::Builder icu::DisplayOptions::builder() { return icu::DisplayOptions::Builder(); }
U_NAMESPACE_BEGIN
icu::DisplayOptions::Builder icu::DisplayOptions::copyToBuilder() const { return Builder(*this); }
DisplayOptions::Builder DisplayOptions::builder() { return DisplayOptions::Builder(); }
icu::DisplayOptions::DisplayOptions(const Builder &builder) {
this->grammaticalCase = builder.grammaticalCase;
this->nounClass = builder.nounClass;
this->pluralCategory = builder.pluralCategory;
this->capitalization = builder.capitalization;
this->nameStyle = builder.nameStyle;
this->displayLength = builder.displayLength;
this->substituteHandling = builder.substituteHandling;
DisplayOptions::Builder DisplayOptions::copyToBuilder() const { return Builder(*this); }
DisplayOptions::DisplayOptions(const Builder &builder) {
grammaticalCase = builder.grammaticalCase;
nounClass = builder.nounClass;
pluralCategory = builder.pluralCategory;
capitalization = builder.capitalization;
nameStyle = builder.nameStyle;
displayLength = builder.displayLength;
substituteHandling = builder.substituteHandling;
}
icu::DisplayOptions::Builder::Builder() {
DisplayOptions::Builder::Builder() {
// Sets default values.
this->grammaticalCase = UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_UNDEFINED;
this->nounClass = UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_UNDEFINED;
this->pluralCategory = UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_UNDEFINED;
this->capitalization = UDisplayOptionsCapitalization::UDISPOPT_CAPITALIZATION_UNDEFINED;
this->nameStyle = UDisplayOptionsNameStyle::UDISPOPT_NAME_STYLE_UNDEFINED;
this->displayLength = UDisplayOptionsDisplayLength::UDISPOPT_DISPLAY_LENGTH_UNDEFINED;
this->substituteHandling = UDisplayOptionsSubstituteHandling::UDISPOPT_SUBSTITUTE_HANDLING_UNDEFINED;
grammaticalCase = UDISPOPT_GRAMMATICAL_CASE_UNDEFINED;
nounClass = UDISPOPT_NOUN_CLASS_UNDEFINED;
pluralCategory = UDISPOPT_PLURAL_CATEGORY_UNDEFINED;
capitalization = UDISPOPT_CAPITALIZATION_UNDEFINED;
nameStyle = UDISPOPT_NAME_STYLE_UNDEFINED;
displayLength = UDISPOPT_DISPLAY_LENGTH_UNDEFINED;
substituteHandling = UDISPOPT_SUBSTITUTE_HANDLING_UNDEFINED;
}
icu::DisplayOptions::Builder::Builder(const DisplayOptions &displayOptions) {
this->grammaticalCase = displayOptions.grammaticalCase;
this->nounClass = displayOptions.nounClass;
this->pluralCategory = displayOptions.pluralCategory;
this->capitalization = displayOptions.capitalization;
this->nameStyle = displayOptions.nameStyle;
this->displayLength = displayOptions.displayLength;
this->substituteHandling = displayOptions.substituteHandling;
DisplayOptions::Builder::Builder(const DisplayOptions &displayOptions) {
grammaticalCase = displayOptions.grammaticalCase;
nounClass = displayOptions.nounClass;
pluralCategory = displayOptions.pluralCategory;
capitalization = displayOptions.capitalization;
nameStyle = displayOptions.nameStyle;
displayLength = displayOptions.displayLength;
substituteHandling = displayOptions.substituteHandling;
}
U_NAMESPACE_END
// C API ------------------------------------------------------------------- ***
U_NAMESPACE_USE
namespace {
const char *grammaticalCasesIds[] = {
const char *grammaticalCaseIds[] = {
"undefined", // 0
"ablative", // 1
"accusative", // 2
@ -64,31 +72,31 @@ const char *grammaticalCasesIds[] = {
"vocative", // 14
};
const int32_t grammaticalCasesCount = 15;
} // namespace
const char *udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase grammaticalCase) {
if (grammaticalCase >= 0 && grammaticalCase < grammaticalCasesCount) {
return grammaticalCasesIds[grammaticalCase];
U_CAPI const char * U_EXPORT2
udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase grammaticalCase) {
if (grammaticalCase >= 0 && grammaticalCase < UPRV_LENGTHOF(grammaticalCaseIds)) {
return grammaticalCaseIds[grammaticalCase];
}
return grammaticalCasesIds[0];
return grammaticalCaseIds[0];
}
UDisplayOptionsGrammaticalCase udispopt_fromGrammaticalCaseIdentifier(const char *identifier) {
for (int32_t i = 0; i < grammaticalCasesCount; i++) {
if (uprv_strcmp(identifier, grammaticalCasesIds[i]) == 0) {
U_CAPI UDisplayOptionsGrammaticalCase U_EXPORT2
udispopt_fromGrammaticalCaseIdentifier(const char *identifier) {
for (int32_t i = 0; i < UPRV_LENGTHOF(grammaticalCaseIds); i++) {
if (uprv_strcmp(identifier, grammaticalCaseIds[i]) == 0) {
return static_cast<UDisplayOptionsGrammaticalCase>(i);
}
}
return UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_UNDEFINED;
return UDISPOPT_GRAMMATICAL_CASE_UNDEFINED;
}
namespace {
const char *pluralCategoriesIds[] = {
const char *pluralCategoryIds[] = {
"undefined", // 0
"zero", // 1
"one", // 2
@ -100,29 +108,29 @@ const char *pluralCategoriesIds[] = {
} // namespace
const int32_t pluralCategoriesCount = 7;
const char *udispopt_getPluralCategoryIdentifier(UDisplayOptionsPluralCategory pluralCategory) {
if (pluralCategory >= 0 && pluralCategory < pluralCategoriesCount) {
return pluralCategoriesIds[pluralCategory];
U_CAPI const char * U_EXPORT2
udispopt_getPluralCategoryIdentifier(UDisplayOptionsPluralCategory pluralCategory) {
if (pluralCategory >= 0 && pluralCategory < UPRV_LENGTHOF(pluralCategoryIds)) {
return pluralCategoryIds[pluralCategory];
}
return pluralCategoriesIds[0];
return pluralCategoryIds[0];
}
UDisplayOptionsPluralCategory udispopt_fromPluralCategoryIdentifier(const char *identifier) {
for (int32_t i = 0; i < pluralCategoriesCount; i++) {
if (uprv_strcmp(identifier, pluralCategoriesIds[i]) == 0) {
U_CAPI UDisplayOptionsPluralCategory U_EXPORT2
udispopt_fromPluralCategoryIdentifier(const char *identifier) {
for (int32_t i = 0; i < UPRV_LENGTHOF(pluralCategoryIds); i++) {
if (uprv_strcmp(identifier, pluralCategoryIds[i]) == 0) {
return static_cast<UDisplayOptionsPluralCategory>(i);
}
}
return UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_UNDEFINED;
return UDISPOPT_PLURAL_CATEGORY_UNDEFINED;
}
namespace {
const char *nounClassesIds[] = {
const char *nounClassIds[] = {
"undefined", // 0
"other", // 1
"neuter", // 2
@ -134,26 +142,26 @@ const char *nounClassesIds[] = {
"common", // 8
};
const int32_t nounClassesCount = 9;
} // namespace
const char *udispopt_getNounClassIdentifier(UDisplayOptionsNounClass nounClass) {
if (nounClass >= 0 && nounClass < nounClassesCount) {
return nounClassesIds[nounClass];
U_CAPI const char * U_EXPORT2
udispopt_getNounClassIdentifier(UDisplayOptionsNounClass nounClass) {
if (nounClass >= 0 && nounClass < UPRV_LENGTHOF(nounClassIds)) {
return nounClassIds[nounClass];
}
return nounClassesIds[0];
return nounClassIds[0];
}
UDisplayOptionsNounClass udispopt_fromNounClassIdentifier(const char *identifier) {
for (int32_t i = 0; i < nounClassesCount; i++) {
if (uprv_strcmp(identifier, nounClassesIds[i]) == 0) {
U_CAPI UDisplayOptionsNounClass U_EXPORT2
udispopt_fromNounClassIdentifier(const char *identifier) {
for (int32_t i = 0; i < UPRV_LENGTHOF(nounClassIds); i++) {
if (uprv_strcmp(identifier, nounClassIds[i]) == 0) {
return static_cast<UDisplayOptionsNounClass>(i);
}
}
return UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_UNDEFINED;
return UDISPOPT_NOUN_CLASS_UNDEFINED;
}
#endif /* #if !UCONFIG_NO_FORMATTING */

View file

@ -40,7 +40,7 @@ MeasureUnit FormattedNumber::getOutputUnit(UErrorCode& status) const {
}
UDisplayOptionsNounClass FormattedNumber::getNounClass(UErrorCode &status) const {
UPRV_FORMATTED_VALUE_METHOD_GUARD(UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_UNDEFINED);
UPRV_FORMATTED_VALUE_METHOD_GUARD(UDISPOPT_NOUN_CLASS_UNDEFINED);
const char *nounClass = fData->gender;
return udispopt_fromNounClassIdentifier(nounClass);
}

View file

@ -4,13 +4,13 @@
#ifndef __DISPLAYOPTIONS_H__
#define __DISPLAYOPTIONS_H__
#include "unicode/udisplayoptions.h"
#include "unicode/utypes.h"
#if U_SHOW_CPLUSPLUS_API
#if !UCONFIG_NO_FORMATTING
#include "unicode/udisplayoptions.h"
#include "unicode/uversion.h"
U_NAMESPACE_BEGIN
@ -22,31 +22,32 @@ U_NAMESPACE_BEGIN
* class, ... etc. It currently supports enums, but may be extended in the future to have other
* types of data. It replaces a DisplayContext[] as a method parameter.
*
* NOTE: this class is Immutable, and uses a Builder interface.
* NOTE: This class is Immutable, and uses a Builder interface.
*
* For example:
* ```
* DisplayOptions x =
* DisplayOptions::builder().
* .setGrammaticalCase(UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_DATIVE)
* .setPluralCategory(UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_FEW)
* .build();
* DisplayOptions::builder().
* .setGrammaticalCase(UDISPOPT_GRAMMATICAL_CASE_DATIVE)
* .setPluralCategory(UDISPOPT_PLURAL_CATEGORY_FEW)
* .build();
*```
*
* @draft ICU 72
*/
class U_I18N_API DisplayOptions {
public:
public:
/**
* Responsible for building `DisplayOptions`.
*
* @draft ICU 72
*/
class U_I18N_API Builder {
public:
public:
/**
* Sets the grammatical case.
*
* @param grammaticalCase The grammatical case.
* @return Builder
* @draft ICU 72
*/
@ -58,6 +59,7 @@ class U_I18N_API DisplayOptions {
/**
* Sets the noun class.
*
* @param nounClass The noun class.
* @return Builder
* @draft ICU 72
*/
@ -69,6 +71,7 @@ class U_I18N_API DisplayOptions {
/**
* Sets the plural category.
*
* @param pluralCategory The plural category.
* @return Builder
* @draft ICU 72
*/
@ -80,6 +83,7 @@ class U_I18N_API DisplayOptions {
/**
* Sets the capitalization.
*
* @param capitalization The capitalization.
* @return Builder
* @draft ICU 72
*/
@ -91,6 +95,7 @@ class U_I18N_API DisplayOptions {
/**
* Sets the dialect handling.
*
* @param nameStyle The name style.
* @return Builder
* @draft ICU 72
*/
@ -102,6 +107,7 @@ class U_I18N_API DisplayOptions {
/**
* Sets the display length.
*
* @param displayLength The display length.
* @return Builder
* @draft ICU 72
*/
@ -113,6 +119,7 @@ class U_I18N_API DisplayOptions {
/**
* Sets the substitute handling.
*
* @param substituteHandling The substitute handling.
* @return Builder
* @draft ICU 72
*/
@ -129,7 +136,7 @@ class U_I18N_API DisplayOptions {
*/
DisplayOptions build() { return DisplayOptions(*this); }
private:
private:
friend DisplayOptions;
Builder();
@ -164,7 +171,7 @@ class U_I18N_API DisplayOptions {
* @return UDisplayOptionsGrammaticalCase
* @draft ICU 72
*/
UDisplayOptionsGrammaticalCase getGrammaticalCase() const { return this->grammaticalCase; }
UDisplayOptionsGrammaticalCase getGrammaticalCase() const { return grammaticalCase; }
/**
* Gets the noun class.
@ -172,7 +179,7 @@ class U_I18N_API DisplayOptions {
* @return UDisplayOptionsNounClass
* @draft ICU 72
*/
UDisplayOptionsNounClass getNounClass() const { return this->nounClass; }
UDisplayOptionsNounClass getNounClass() const { return nounClass; }
/**
* Gets the plural category.
@ -180,7 +187,7 @@ class U_I18N_API DisplayOptions {
* @return UDisplayOptionsPluralCategory
* @draft ICU 72
*/
UDisplayOptionsPluralCategory getPluralCategory() const { return this->pluralCategory; }
UDisplayOptionsPluralCategory getPluralCategory() const { return pluralCategory; }
/**
* Gets the capitalization.
@ -188,7 +195,7 @@ class U_I18N_API DisplayOptions {
* @return UDisplayOptionsCapitalization
* @draft ICU 72
*/
UDisplayOptionsCapitalization getCapitalization() const { return this->capitalization; }
UDisplayOptionsCapitalization getCapitalization() const { return capitalization; }
/**
* Gets the dialect handling.
@ -196,7 +203,7 @@ class U_I18N_API DisplayOptions {
* @return UDisplayOptionsNameStyle
* @draft ICU 72
*/
UDisplayOptionsNameStyle getNameStyle() const { return this->nameStyle; }
UDisplayOptionsNameStyle getNameStyle() const { return nameStyle; }
/**
* Gets the display length.
@ -204,7 +211,7 @@ class U_I18N_API DisplayOptions {
* @return UDisplayOptionsDisplayLength
* @draft ICU 72
*/
UDisplayOptionsDisplayLength getDisplayLength() const { return this->displayLength; }
UDisplayOptionsDisplayLength getDisplayLength() const { return displayLength; }
/**
* Gets the substitute handling.
@ -212,11 +219,12 @@ class U_I18N_API DisplayOptions {
* @return UDisplayOptionsSubstituteHandling
* @draft ICU 72
*/
UDisplayOptionsSubstituteHandling getSubstituteHandling() const { return this->substituteHandling; }
UDisplayOptionsSubstituteHandling getSubstituteHandling() const { return substituteHandling; }
/**
* Copy the DisplayOptions.
* Copies the DisplayOptions.
*
* @param other The options to copy.
* @draft ICU 72
*/
DisplayOptions &operator=(const DisplayOptions &other) = default;
@ -224,18 +232,20 @@ class U_I18N_API DisplayOptions {
/**
* Moves the DisplayOptions.
*
* @param other The options to move from.
* @draft ICU 72
*/
DisplayOptions &operator=(DisplayOptions &&other) noexcept = default;
/**
* Copy the DisplayOptions.
* Copies the DisplayOptions.
*
* @param other The options to copy.
* @draft ICU 72
*/
DisplayOptions(const DisplayOptions &) = default;
DisplayOptions(const DisplayOptions &other) = default;
private:
private:
DisplayOptions(const Builder &builder);
UDisplayOptionsGrammaticalCase grammaticalCase;
UDisplayOptionsNounClass nounClass;
@ -254,4 +264,4 @@ U_NAMESPACE_END
#endif /* U_SHOW_CPLUSPLUS_API */
#endif // __DISPLAYOPTIONS_H__
#endif // __DISPLAYOPTIONS_H__

View file

@ -2774,8 +2774,8 @@ class U_I18N_API FormattedNumber : public UMemory, public FormattedValue {
* Gets the noun class of the formatted output. Returns `UNDEFINED` when the noun class
* is not supported yet.
*
* @return `NounClass`
* @draft ICU 71.
* @return UDisplayOptionsNounClass
* @draft ICU 72
*/
UDisplayOptionsNounClass getNounClass(UErrorCode &status) const;

View file

@ -15,7 +15,6 @@
/**
* Represents all the grammatical cases that are supported by CLDR.
*
*
* @draft ICU 72
*/
typedef enum UDisplayOptionsGrammaticalCase {
@ -56,6 +55,7 @@ typedef enum UDisplayOptionsGrammaticalCase {
} UDisplayOptionsGrammaticalCase;
/**
* @param grammaticalCase The grammatical case.
* @return the lowercase CLDR keyword string for the grammatical case.
*
* @draft ICU 72
@ -64,7 +64,6 @@ U_CAPI const char * U_EXPORT2
udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase grammaticalCase);
/**
*
* @param identifier in lower case such as "dative" or "nominative"
* @return the plural category corresponding to the identifier, or `UDISPOPT_GRAMMATICAL_CASE_UNDEFINED`
*
@ -75,7 +74,7 @@ udispopt_fromGrammaticalCaseIdentifier(const char *identifier);
/**
* Standard CLDR plural form/category constants.
* See http://www.unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules
* See https://www.unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules
*
* @draft ICU 72
*/
@ -103,6 +102,7 @@ typedef enum UDisplayOptionsPluralCategory {
} UDisplayOptionsPluralCategory;
/**
* @param pluralCategory The plural category.
* @return the lowercase CLDR identifier string for the plural category.
*
* @draft ICU 72
@ -122,7 +122,7 @@ udispopt_fromPluralCategoryIdentifier(const char *identifier);
/**
* Represents all the grammatical noun classes that are supported by CLDR.
*
* @draft ICU 71.
* @draft ICU 72.
*/
typedef enum UDisplayOptionsNounClass {
/**
@ -151,6 +151,7 @@ typedef enum UDisplayOptionsNounClass {
} UDisplayOptionsNounClass;
/**
* @param nounClass The noun class.
* @return the lowercase CLDR keyword string for the noun class.
*
* @draft ICU 72
@ -159,7 +160,6 @@ U_CAPI const char * U_EXPORT2
udispopt_getNounClassIdentifier(UDisplayOptionsNounClass nounClass);
/**
*
* @param identifier in lower case such as "feminine" or "masculine"
* @return the plural category corresponding to the identifier, or `UDISPOPT_NOUN_CLASS_UNDEFINED`
*
@ -313,4 +313,4 @@ typedef enum UDisplayOptionsSubstituteHandling {
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif // __UDISPLAYOPTIONS_H__
#endif // __UDISPLAYOPTIONS_H__

View file

@ -35,333 +35,333 @@ void DisplayOptionsTest::runIndexedTest(int32_t index, UBool exec, const char *&
void DisplayOptionsTest::testDisplayOptionsDefault() {
icu::DisplayOptions displayOptions = icu::DisplayOptions::builder().build();
assertEquals(u"Test setting parameters", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_UNDEFINED,
assertEquals(u"Test setting parameters", UDISPOPT_GRAMMATICAL_CASE_UNDEFINED,
displayOptions.getGrammaticalCase());
assertEquals(u"Test default values: ", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_UNDEFINED,
assertEquals(u"Test default values: ", UDISPOPT_NOUN_CLASS_UNDEFINED,
displayOptions.getNounClass());
assertEquals(u"Test default values: ", UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_UNDEFINED,
assertEquals(u"Test default values: ", UDISPOPT_PLURAL_CATEGORY_UNDEFINED,
displayOptions.getPluralCategory());
assertEquals(u"Test default values: ", UDisplayOptionsCapitalization::UDISPOPT_CAPITALIZATION_UNDEFINED,
assertEquals(u"Test default values: ", UDISPOPT_CAPITALIZATION_UNDEFINED,
displayOptions.getCapitalization());
assertEquals(u"Test default values: ", UDisplayOptionsNameStyle::UDISPOPT_NAME_STYLE_UNDEFINED,
assertEquals(u"Test default values: ", UDISPOPT_NAME_STYLE_UNDEFINED,
displayOptions.getNameStyle());
assertEquals(u"Test default values: ", UDisplayOptionsDisplayLength::UDISPOPT_DISPLAY_LENGTH_UNDEFINED,
assertEquals(u"Test default values: ", UDISPOPT_DISPLAY_LENGTH_UNDEFINED,
displayOptions.getDisplayLength());
assertEquals(u"Test default values: ", UDisplayOptionsSubstituteHandling::UDISPOPT_SUBSTITUTE_HANDLING_UNDEFINED,
assertEquals(u"Test default values: ", UDISPOPT_SUBSTITUTE_HANDLING_UNDEFINED,
displayOptions.getSubstituteHandling());
}
void DisplayOptionsTest::testDisplayOptionsEachElement() {
icu::DisplayOptions displayOptions =
icu::DisplayOptions::builder()
.setGrammaticalCase(UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_ABLATIVE)
.setGrammaticalCase(UDISPOPT_GRAMMATICAL_CASE_ABLATIVE)
.build();
assertEquals(u"Test setting parameters: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_ABLATIVE,
assertEquals(u"Test setting parameters: ", UDISPOPT_GRAMMATICAL_CASE_ABLATIVE,
displayOptions.getGrammaticalCase());
displayOptions =
icu::DisplayOptions::builder().setNounClass(UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_PERSONAL).build();
assertEquals(u"Test setting parameters: ", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_PERSONAL,
icu::DisplayOptions::builder().setNounClass(UDISPOPT_NOUN_CLASS_PERSONAL).build();
assertEquals(u"Test setting parameters: ", UDISPOPT_NOUN_CLASS_PERSONAL,
displayOptions.getNounClass());
displayOptions =
icu::DisplayOptions::builder().setPluralCategory(UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_FEW).build();
assertEquals(u"Test setting parameters: ", UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_FEW,
icu::DisplayOptions::builder().setPluralCategory(UDISPOPT_PLURAL_CATEGORY_FEW).build();
assertEquals(u"Test setting parameters: ", UDISPOPT_PLURAL_CATEGORY_FEW,
displayOptions.getPluralCategory());
displayOptions = icu::DisplayOptions::builder()
.setCapitalization(UDisplayOptionsCapitalization::UDISPOPT_CAPITALIZATION_BEGINNING_OF_SENTENCE)
.setCapitalization(UDISPOPT_CAPITALIZATION_BEGINNING_OF_SENTENCE)
.build();
assertEquals(u"Test setting parameters: ", UDisplayOptionsCapitalization::UDISPOPT_CAPITALIZATION_BEGINNING_OF_SENTENCE,
assertEquals(u"Test setting parameters: ", UDISPOPT_CAPITALIZATION_BEGINNING_OF_SENTENCE,
displayOptions.getCapitalization());
displayOptions = icu::DisplayOptions::builder()
.setNameStyle(UDisplayOptionsNameStyle::UDISPOPT_NAME_STYLE_STANDARD_NAMES)
.setNameStyle(UDISPOPT_NAME_STYLE_STANDARD_NAMES)
.build();
assertEquals(u"Test setting parameters: ", UDisplayOptionsNameStyle::UDISPOPT_NAME_STYLE_STANDARD_NAMES,
assertEquals(u"Test setting parameters: ", UDISPOPT_NAME_STYLE_STANDARD_NAMES,
displayOptions.getNameStyle());
displayOptions = icu::DisplayOptions::builder()
.setDisplayLength(UDisplayOptionsDisplayLength::UDISPOPT_DISPLAY_LENGTH_FULL)
.setDisplayLength(UDISPOPT_DISPLAY_LENGTH_FULL)
.build();
assertEquals(u"Test setting parameters: ", UDisplayOptionsDisplayLength::UDISPOPT_DISPLAY_LENGTH_FULL,
assertEquals(u"Test setting parameters: ", UDISPOPT_DISPLAY_LENGTH_FULL,
displayOptions.getDisplayLength());
displayOptions = icu::DisplayOptions::builder()
.setSubstituteHandling(UDisplayOptionsSubstituteHandling::UDISPOPT_SUBSTITUTE_HANDLING_NO_SUBSTITUTE)
.setSubstituteHandling(UDISPOPT_SUBSTITUTE_HANDLING_NO_SUBSTITUTE)
.build();
assertEquals(u"Test setting parameters: ", UDisplayOptionsSubstituteHandling::UDISPOPT_SUBSTITUTE_HANDLING_NO_SUBSTITUTE,
assertEquals(u"Test setting parameters: ", UDISPOPT_SUBSTITUTE_HANDLING_NO_SUBSTITUTE,
displayOptions.getSubstituteHandling());
}
void DisplayOptionsTest::testDisplayOptionsUpdating() {
DisplayOptions displayOptions = DisplayOptions::builder()
.setGrammaticalCase(UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_ABLATIVE)
.setGrammaticalCase(UDISPOPT_GRAMMATICAL_CASE_ABLATIVE)
.build();
assertEquals(u"Test updating parameters: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_ABLATIVE,
assertEquals(u"Test updating parameters: ", UDISPOPT_GRAMMATICAL_CASE_ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals(u"Test updating parameters: ", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_NOUN_CLASS_UNDEFINED,
displayOptions.getNounClass());
assertEquals(u"Test updating parameters: ", UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_PLURAL_CATEGORY_UNDEFINED,
displayOptions.getPluralCategory());
assertEquals(u"Test updating parameters: ", UDisplayOptionsCapitalization::UDISPOPT_CAPITALIZATION_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_CAPITALIZATION_UNDEFINED,
displayOptions.getCapitalization());
assertEquals(u"Test updating parameters: ", UDisplayOptionsNameStyle::UDISPOPT_NAME_STYLE_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_NAME_STYLE_UNDEFINED,
displayOptions.getNameStyle());
assertEquals(u"Test updating parameters: ", UDisplayOptionsDisplayLength::UDISPOPT_DISPLAY_LENGTH_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_DISPLAY_LENGTH_UNDEFINED,
displayOptions.getDisplayLength());
assertEquals(u"Test updating parameters: ", UDisplayOptionsSubstituteHandling::UDISPOPT_SUBSTITUTE_HANDLING_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_SUBSTITUTE_HANDLING_UNDEFINED,
displayOptions.getSubstituteHandling());
displayOptions =
displayOptions.copyToBuilder().setNounClass(UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_PERSONAL).build();
assertEquals(u"Test updating parameters: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_ABLATIVE,
displayOptions.copyToBuilder().setNounClass(UDISPOPT_NOUN_CLASS_PERSONAL).build();
assertEquals(u"Test updating parameters: ", UDISPOPT_GRAMMATICAL_CASE_ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals(u"Test updating parameters: ", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_PERSONAL,
assertEquals(u"Test updating parameters: ", UDISPOPT_NOUN_CLASS_PERSONAL,
displayOptions.getNounClass());
assertEquals(u"Test updating parameters: ", UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_PLURAL_CATEGORY_UNDEFINED,
displayOptions.getPluralCategory());
assertEquals(u"Test updating parameters: ", UDisplayOptionsCapitalization::UDISPOPT_CAPITALIZATION_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_CAPITALIZATION_UNDEFINED,
displayOptions.getCapitalization());
assertEquals(u"Test updating parameters: ", UDisplayOptionsNameStyle::UDISPOPT_NAME_STYLE_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_NAME_STYLE_UNDEFINED,
displayOptions.getNameStyle());
assertEquals(u"Test updating parameters: ", UDisplayOptionsDisplayLength::UDISPOPT_DISPLAY_LENGTH_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_DISPLAY_LENGTH_UNDEFINED,
displayOptions.getDisplayLength());
assertEquals(u"Test updating parameters: ", UDisplayOptionsSubstituteHandling::UDISPOPT_SUBSTITUTE_HANDLING_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_SUBSTITUTE_HANDLING_UNDEFINED,
displayOptions.getSubstituteHandling());
displayOptions =
displayOptions.copyToBuilder().setPluralCategory(UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_FEW).build();
assertEquals(u"Test updating parameters: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_ABLATIVE,
displayOptions.copyToBuilder().setPluralCategory(UDISPOPT_PLURAL_CATEGORY_FEW).build();
assertEquals(u"Test updating parameters: ", UDISPOPT_GRAMMATICAL_CASE_ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals(u"Test updating parameters: ", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_PERSONAL,
assertEquals(u"Test updating parameters: ", UDISPOPT_NOUN_CLASS_PERSONAL,
displayOptions.getNounClass());
assertEquals(u"Test updating parameters: ", UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_FEW,
assertEquals(u"Test updating parameters: ", UDISPOPT_PLURAL_CATEGORY_FEW,
displayOptions.getPluralCategory());
assertEquals(u"Test updating parameters: ", UDisplayOptionsCapitalization::UDISPOPT_CAPITALIZATION_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_CAPITALIZATION_UNDEFINED,
displayOptions.getCapitalization());
assertEquals(u"Test updating parameters: ", UDisplayOptionsNameStyle::UDISPOPT_NAME_STYLE_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_NAME_STYLE_UNDEFINED,
displayOptions.getNameStyle());
assertEquals(u"Test updating parameters: ", UDisplayOptionsDisplayLength::UDISPOPT_DISPLAY_LENGTH_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_DISPLAY_LENGTH_UNDEFINED,
displayOptions.getDisplayLength());
assertEquals(u"Test updating parameters: ", UDisplayOptionsSubstituteHandling::UDISPOPT_SUBSTITUTE_HANDLING_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_SUBSTITUTE_HANDLING_UNDEFINED,
displayOptions.getSubstituteHandling());
displayOptions = displayOptions.copyToBuilder()
.setCapitalization(UDisplayOptionsCapitalization::UDISPOPT_CAPITALIZATION_BEGINNING_OF_SENTENCE)
.setCapitalization(UDISPOPT_CAPITALIZATION_BEGINNING_OF_SENTENCE)
.build();
assertEquals(u"Test updating parameters: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_ABLATIVE,
assertEquals(u"Test updating parameters: ", UDISPOPT_GRAMMATICAL_CASE_ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals(u"Test updating parameters: ", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_PERSONAL,
assertEquals(u"Test updating parameters: ", UDISPOPT_NOUN_CLASS_PERSONAL,
displayOptions.getNounClass());
assertEquals(u"Test updating parameters: ", UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_FEW,
assertEquals(u"Test updating parameters: ", UDISPOPT_PLURAL_CATEGORY_FEW,
displayOptions.getPluralCategory());
assertEquals(u"Test updating parameters: ", UDisplayOptionsCapitalization::UDISPOPT_CAPITALIZATION_BEGINNING_OF_SENTENCE,
assertEquals(u"Test updating parameters: ", UDISPOPT_CAPITALIZATION_BEGINNING_OF_SENTENCE,
displayOptions.getCapitalization());
assertEquals(u"Test updating parameters: ", UDisplayOptionsNameStyle::UDISPOPT_NAME_STYLE_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_NAME_STYLE_UNDEFINED,
displayOptions.getNameStyle());
assertEquals(u"Test updating parameters: ", UDisplayOptionsDisplayLength::UDISPOPT_DISPLAY_LENGTH_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_DISPLAY_LENGTH_UNDEFINED,
displayOptions.getDisplayLength());
assertEquals(u"Test updating parameters: ", UDisplayOptionsSubstituteHandling::UDISPOPT_SUBSTITUTE_HANDLING_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_SUBSTITUTE_HANDLING_UNDEFINED,
displayOptions.getSubstituteHandling());
displayOptions = displayOptions.copyToBuilder()
.setNameStyle(UDisplayOptionsNameStyle::UDISPOPT_NAME_STYLE_STANDARD_NAMES)
.setNameStyle(UDISPOPT_NAME_STYLE_STANDARD_NAMES)
.build();
assertEquals(u"Test updating parameters: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_ABLATIVE,
assertEquals(u"Test updating parameters: ", UDISPOPT_GRAMMATICAL_CASE_ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals(u"Test updating parameters: ", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_PERSONAL,
assertEquals(u"Test updating parameters: ", UDISPOPT_NOUN_CLASS_PERSONAL,
displayOptions.getNounClass());
assertEquals(u"Test updating parameters: ", UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_FEW,
assertEquals(u"Test updating parameters: ", UDISPOPT_PLURAL_CATEGORY_FEW,
displayOptions.getPluralCategory());
assertEquals(u"Test updating parameters: ", UDisplayOptionsCapitalization::UDISPOPT_CAPITALIZATION_BEGINNING_OF_SENTENCE,
assertEquals(u"Test updating parameters: ", UDISPOPT_CAPITALIZATION_BEGINNING_OF_SENTENCE,
displayOptions.getCapitalization());
assertEquals(u"Test updating parameters: ", UDisplayOptionsNameStyle::UDISPOPT_NAME_STYLE_STANDARD_NAMES,
assertEquals(u"Test updating parameters: ", UDISPOPT_NAME_STYLE_STANDARD_NAMES,
displayOptions.getNameStyle());
assertEquals(u"Test updating parameters: ", UDisplayOptionsDisplayLength::UDISPOPT_DISPLAY_LENGTH_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_DISPLAY_LENGTH_UNDEFINED,
displayOptions.getDisplayLength());
assertEquals(u"Test updating parameters: ", UDisplayOptionsSubstituteHandling::UDISPOPT_SUBSTITUTE_HANDLING_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_SUBSTITUTE_HANDLING_UNDEFINED,
displayOptions.getSubstituteHandling());
displayOptions = displayOptions.copyToBuilder()
.setDisplayLength(UDisplayOptionsDisplayLength::UDISPOPT_DISPLAY_LENGTH_FULL)
.setDisplayLength(UDISPOPT_DISPLAY_LENGTH_FULL)
.build();
assertEquals(u"Test updating parameters: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_ABLATIVE,
assertEquals(u"Test updating parameters: ", UDISPOPT_GRAMMATICAL_CASE_ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals(u"Test updating parameters: ", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_PERSONAL,
assertEquals(u"Test updating parameters: ", UDISPOPT_NOUN_CLASS_PERSONAL,
displayOptions.getNounClass());
assertEquals(u"Test updating parameters: ", UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_FEW,
assertEquals(u"Test updating parameters: ", UDISPOPT_PLURAL_CATEGORY_FEW,
displayOptions.getPluralCategory());
assertEquals(u"Test updating parameters: ", UDisplayOptionsCapitalization::UDISPOPT_CAPITALIZATION_BEGINNING_OF_SENTENCE,
assertEquals(u"Test updating parameters: ", UDISPOPT_CAPITALIZATION_BEGINNING_OF_SENTENCE,
displayOptions.getCapitalization());
assertEquals(u"Test updating parameters: ", UDisplayOptionsNameStyle::UDISPOPT_NAME_STYLE_STANDARD_NAMES,
assertEquals(u"Test updating parameters: ", UDISPOPT_NAME_STYLE_STANDARD_NAMES,
displayOptions.getNameStyle());
assertEquals(u"Test updating parameters: ", UDisplayOptionsDisplayLength::UDISPOPT_DISPLAY_LENGTH_FULL,
assertEquals(u"Test updating parameters: ", UDISPOPT_DISPLAY_LENGTH_FULL,
displayOptions.getDisplayLength());
assertEquals(u"Test updating parameters: ", UDisplayOptionsSubstituteHandling::UDISPOPT_SUBSTITUTE_HANDLING_UNDEFINED,
assertEquals(u"Test updating parameters: ", UDISPOPT_SUBSTITUTE_HANDLING_UNDEFINED,
displayOptions.getSubstituteHandling());
displayOptions = displayOptions.copyToBuilder()
.setSubstituteHandling(UDisplayOptionsSubstituteHandling::UDISPOPT_SUBSTITUTE_HANDLING_NO_SUBSTITUTE)
.setSubstituteHandling(UDISPOPT_SUBSTITUTE_HANDLING_NO_SUBSTITUTE)
.build();
assertEquals(u"Test updating parameters: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_ABLATIVE,
assertEquals(u"Test updating parameters: ", UDISPOPT_GRAMMATICAL_CASE_ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals(u"Test updating parameters: ", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_PERSONAL,
assertEquals(u"Test updating parameters: ", UDISPOPT_NOUN_CLASS_PERSONAL,
displayOptions.getNounClass());
assertEquals(u"Test updating parameters: ", UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_FEW,
assertEquals(u"Test updating parameters: ", UDISPOPT_PLURAL_CATEGORY_FEW,
displayOptions.getPluralCategory());
assertEquals(u"Test updating parameters: ", UDisplayOptionsCapitalization::UDISPOPT_CAPITALIZATION_BEGINNING_OF_SENTENCE,
assertEquals(u"Test updating parameters: ", UDISPOPT_CAPITALIZATION_BEGINNING_OF_SENTENCE,
displayOptions.getCapitalization());
assertEquals(u"Test updating parameters: ", UDisplayOptionsNameStyle::UDISPOPT_NAME_STYLE_STANDARD_NAMES,
assertEquals(u"Test updating parameters: ", UDISPOPT_NAME_STYLE_STANDARD_NAMES,
displayOptions.getNameStyle());
assertEquals(u"Test updating parameters: ", UDisplayOptionsDisplayLength::UDISPOPT_DISPLAY_LENGTH_FULL,
assertEquals(u"Test updating parameters: ", UDISPOPT_DISPLAY_LENGTH_FULL,
displayOptions.getDisplayLength());
assertEquals(u"Test updating parameters: ", UDisplayOptionsSubstituteHandling::UDISPOPT_SUBSTITUTE_HANDLING_NO_SUBSTITUTE,
assertEquals(u"Test updating parameters: ", UDISPOPT_SUBSTITUTE_HANDLING_NO_SUBSTITUTE,
displayOptions.getSubstituteHandling());
}
void DisplayOptionsTest::testDisplayOptionsGetIdentifier() {
assertEquals(u"test get identifier: ", "undefined",
udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_UNDEFINED));
udispopt_getGrammaticalCaseIdentifier(UDISPOPT_GRAMMATICAL_CASE_UNDEFINED));
assertEquals(u"test get identifier: ", "ablative",
udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_ABLATIVE));
udispopt_getGrammaticalCaseIdentifier(UDISPOPT_GRAMMATICAL_CASE_ABLATIVE));
assertEquals(u"test get identifier: ", "accusative",
udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_ACCUSATIVE));
udispopt_getGrammaticalCaseIdentifier(UDISPOPT_GRAMMATICAL_CASE_ACCUSATIVE));
assertEquals(u"test get identifier: ", "comitative",
udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_COMITATIVE));
udispopt_getGrammaticalCaseIdentifier(UDISPOPT_GRAMMATICAL_CASE_COMITATIVE));
assertEquals(u"test get identifier: ", "dative",
udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_DATIVE));
udispopt_getGrammaticalCaseIdentifier(UDISPOPT_GRAMMATICAL_CASE_DATIVE));
assertEquals(u"test get identifier: ", "ergative",
udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_ERGATIVE));
udispopt_getGrammaticalCaseIdentifier(UDISPOPT_GRAMMATICAL_CASE_ERGATIVE));
assertEquals(u"test get identifier: ", "genitive",
udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_GENITIVE));
udispopt_getGrammaticalCaseIdentifier(UDISPOPT_GRAMMATICAL_CASE_GENITIVE));
assertEquals(
u"test get identifier: ", "instrumental",
udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_INSTRUMENTAL));
udispopt_getGrammaticalCaseIdentifier(UDISPOPT_GRAMMATICAL_CASE_INSTRUMENTAL));
assertEquals(u"test get identifier: ", "locative",
udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_LOCATIVE));
udispopt_getGrammaticalCaseIdentifier(UDISPOPT_GRAMMATICAL_CASE_LOCATIVE));
assertEquals(
u"test get identifier: ", "locative_copulative",
udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_LOCATIVE_COPULATIVE));
udispopt_getGrammaticalCaseIdentifier(UDISPOPT_GRAMMATICAL_CASE_LOCATIVE_COPULATIVE));
assertEquals(u"test get identifier: ", "nominative",
udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_NOMINATIVE));
udispopt_getGrammaticalCaseIdentifier(UDISPOPT_GRAMMATICAL_CASE_NOMINATIVE));
assertEquals(u"test get identifier: ", "oblique",
udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_OBLIQUE));
udispopt_getGrammaticalCaseIdentifier(UDISPOPT_GRAMMATICAL_CASE_OBLIQUE));
assertEquals(
u"test get identifier: ", "prepositional",
udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_PREPOSITIONAL));
udispopt_getGrammaticalCaseIdentifier(UDISPOPT_GRAMMATICAL_CASE_PREPOSITIONAL));
assertEquals(u"test get identifier: ", "sociative",
udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_SOCIATIVE));
udispopt_getGrammaticalCaseIdentifier(UDISPOPT_GRAMMATICAL_CASE_SOCIATIVE));
assertEquals(u"test get identifier: ", "vocative",
udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_VOCATIVE));
udispopt_getGrammaticalCaseIdentifier(UDISPOPT_GRAMMATICAL_CASE_VOCATIVE));
assertEquals(u"test get identifier: ", "undefined",
udispopt_getPluralCategoryIdentifier(UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_UNDEFINED));
udispopt_getPluralCategoryIdentifier(UDISPOPT_PLURAL_CATEGORY_UNDEFINED));
assertEquals(u"test get identifier: ", "zero",
udispopt_getPluralCategoryIdentifier(UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_ZERO));
udispopt_getPluralCategoryIdentifier(UDISPOPT_PLURAL_CATEGORY_ZERO));
assertEquals(u"test get identifier: ", "one",
udispopt_getPluralCategoryIdentifier(UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_ONE));
udispopt_getPluralCategoryIdentifier(UDISPOPT_PLURAL_CATEGORY_ONE));
assertEquals(u"test get identifier: ", "two",
udispopt_getPluralCategoryIdentifier(UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_TWO));
udispopt_getPluralCategoryIdentifier(UDISPOPT_PLURAL_CATEGORY_TWO));
assertEquals(u"test get identifier: ", "few",
udispopt_getPluralCategoryIdentifier(UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_FEW));
udispopt_getPluralCategoryIdentifier(UDISPOPT_PLURAL_CATEGORY_FEW));
assertEquals(u"test get identifier: ", "many",
udispopt_getPluralCategoryIdentifier(UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_MANY));
udispopt_getPluralCategoryIdentifier(UDISPOPT_PLURAL_CATEGORY_MANY));
assertEquals(u"test get identifier: ", "other",
udispopt_getPluralCategoryIdentifier(UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_OTHER));
udispopt_getPluralCategoryIdentifier(UDISPOPT_PLURAL_CATEGORY_OTHER));
assertEquals(u"test get identifier: ", "undefined",
udispopt_getNounClassIdentifier(UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_UNDEFINED));
udispopt_getNounClassIdentifier(UDISPOPT_NOUN_CLASS_UNDEFINED));
assertEquals(u"test get identifier: ", "other",
udispopt_getNounClassIdentifier(UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_OTHER));
udispopt_getNounClassIdentifier(UDISPOPT_NOUN_CLASS_OTHER));
assertEquals(u"test get identifier: ", "neuter",
udispopt_getNounClassIdentifier(UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_NEUTER));
udispopt_getNounClassIdentifier(UDISPOPT_NOUN_CLASS_NEUTER));
assertEquals(u"test get identifier: ", "feminine",
udispopt_getNounClassIdentifier(UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_FEMININE));
udispopt_getNounClassIdentifier(UDISPOPT_NOUN_CLASS_FEMININE));
assertEquals(u"test get identifier: ", "masculine",
udispopt_getNounClassIdentifier(UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE));
udispopt_getNounClassIdentifier(UDISPOPT_NOUN_CLASS_MASCULINE));
assertEquals(u"test get identifier: ", "animate",
udispopt_getNounClassIdentifier(UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_ANIMATE));
udispopt_getNounClassIdentifier(UDISPOPT_NOUN_CLASS_ANIMATE));
assertEquals(u"test get identifier: ", "inanimate",
udispopt_getNounClassIdentifier(UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_INANIMATE));
udispopt_getNounClassIdentifier(UDISPOPT_NOUN_CLASS_INANIMATE));
assertEquals(u"test get identifier: ", "personal",
udispopt_getNounClassIdentifier(UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_PERSONAL));
udispopt_getNounClassIdentifier(UDISPOPT_NOUN_CLASS_PERSONAL));
assertEquals(u"test get identifier: ", "common",
udispopt_getNounClassIdentifier(UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_COMMON));
udispopt_getNounClassIdentifier(UDISPOPT_NOUN_CLASS_COMMON));
}
void DisplayOptionsTest::testDisplayOptionsFromIdentifier() {
assertEquals(u"test from identifier: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_UNDEFINED,
assertEquals(u"test from identifier: ", UDISPOPT_GRAMMATICAL_CASE_UNDEFINED,
udispopt_fromGrammaticalCaseIdentifier(""));
assertEquals(u"test from identifier: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_UNDEFINED,
assertEquals(u"test from identifier: ", UDISPOPT_GRAMMATICAL_CASE_UNDEFINED,
udispopt_fromGrammaticalCaseIdentifier("undefined"));
assertEquals(u"test from identifier: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_ABLATIVE,
assertEquals(u"test from identifier: ", UDISPOPT_GRAMMATICAL_CASE_ABLATIVE,
udispopt_fromGrammaticalCaseIdentifier("ablative"));
assertEquals(u"test from identifier: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_ACCUSATIVE,
assertEquals(u"test from identifier: ", UDISPOPT_GRAMMATICAL_CASE_ACCUSATIVE,
udispopt_fromGrammaticalCaseIdentifier("accusative"));
assertEquals(u"test from identifier: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_COMITATIVE,
assertEquals(u"test from identifier: ", UDISPOPT_GRAMMATICAL_CASE_COMITATIVE,
udispopt_fromGrammaticalCaseIdentifier("comitative"));
assertEquals(u"test from identifier: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_DATIVE,
assertEquals(u"test from identifier: ", UDISPOPT_GRAMMATICAL_CASE_DATIVE,
udispopt_fromGrammaticalCaseIdentifier("dative"));
assertEquals(u"test from identifier: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_ERGATIVE,
assertEquals(u"test from identifier: ", UDISPOPT_GRAMMATICAL_CASE_ERGATIVE,
udispopt_fromGrammaticalCaseIdentifier("ergative"));
assertEquals(u"test from identifier: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_GENITIVE,
assertEquals(u"test from identifier: ", UDISPOPT_GRAMMATICAL_CASE_GENITIVE,
udispopt_fromGrammaticalCaseIdentifier("genitive"));
assertEquals(u"test from identifier: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_INSTRUMENTAL,
assertEquals(u"test from identifier: ", UDISPOPT_GRAMMATICAL_CASE_INSTRUMENTAL,
udispopt_fromGrammaticalCaseIdentifier("instrumental"));
assertEquals(u"test from identifier: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_LOCATIVE,
assertEquals(u"test from identifier: ", UDISPOPT_GRAMMATICAL_CASE_LOCATIVE,
udispopt_fromGrammaticalCaseIdentifier("locative"));
assertEquals(u"test from identifier: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_LOCATIVE_COPULATIVE,
assertEquals(u"test from identifier: ", UDISPOPT_GRAMMATICAL_CASE_LOCATIVE_COPULATIVE,
udispopt_fromGrammaticalCaseIdentifier("locative_copulative"));
assertEquals(u"test from identifier: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_NOMINATIVE,
assertEquals(u"test from identifier: ", UDISPOPT_GRAMMATICAL_CASE_NOMINATIVE,
udispopt_fromGrammaticalCaseIdentifier("nominative"));
assertEquals(u"test from identifier: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_OBLIQUE,
assertEquals(u"test from identifier: ", UDISPOPT_GRAMMATICAL_CASE_OBLIQUE,
udispopt_fromGrammaticalCaseIdentifier("oblique"));
assertEquals(u"test from identifier: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_PREPOSITIONAL,
assertEquals(u"test from identifier: ", UDISPOPT_GRAMMATICAL_CASE_PREPOSITIONAL,
udispopt_fromGrammaticalCaseIdentifier("prepositional"));
assertEquals(u"test from identifier: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_SOCIATIVE,
assertEquals(u"test from identifier: ", UDISPOPT_GRAMMATICAL_CASE_SOCIATIVE,
udispopt_fromGrammaticalCaseIdentifier("sociative"));
assertEquals(u"test from identifier: ", UDisplayOptionsGrammaticalCase::UDISPOPT_GRAMMATICAL_CASE_VOCATIVE,
assertEquals(u"test from identifier: ", UDISPOPT_GRAMMATICAL_CASE_VOCATIVE,
udispopt_fromGrammaticalCaseIdentifier("vocative"));
assertEquals(u"test from identifier: ", UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_UNDEFINED,
assertEquals(u"test from identifier: ", UDISPOPT_PLURAL_CATEGORY_UNDEFINED,
udispopt_fromPluralCategoryIdentifier(""));
assertEquals(u"test from identifier: ", UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_UNDEFINED,
assertEquals(u"test from identifier: ", UDISPOPT_PLURAL_CATEGORY_UNDEFINED,
udispopt_fromPluralCategoryIdentifier("undefined"));
assertEquals(u"test from identifier: ", UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_ZERO,
assertEquals(u"test from identifier: ", UDISPOPT_PLURAL_CATEGORY_ZERO,
udispopt_fromPluralCategoryIdentifier("zero"));
assertEquals(u"test from identifier: ", UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_ONE,
assertEquals(u"test from identifier: ", UDISPOPT_PLURAL_CATEGORY_ONE,
udispopt_fromPluralCategoryIdentifier("one"));
assertEquals(u"test from identifier: ", UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_TWO,
assertEquals(u"test from identifier: ", UDISPOPT_PLURAL_CATEGORY_TWO,
udispopt_fromPluralCategoryIdentifier("two"));
assertEquals(u"test from identifier: ", UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_FEW,
assertEquals(u"test from identifier: ", UDISPOPT_PLURAL_CATEGORY_FEW,
udispopt_fromPluralCategoryIdentifier("few"));
assertEquals(u"test from identifier: ", UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_MANY,
assertEquals(u"test from identifier: ", UDISPOPT_PLURAL_CATEGORY_MANY,
udispopt_fromPluralCategoryIdentifier("many"));
assertEquals(u"test from identifier: ", UDisplayOptionsPluralCategory::UDISPOPT_PLURAL_CATEGORY_OTHER,
assertEquals(u"test from identifier: ", UDISPOPT_PLURAL_CATEGORY_OTHER,
udispopt_fromPluralCategoryIdentifier("other"));
assertEquals(u"test from identifier: ", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_UNDEFINED,
assertEquals(u"test from identifier: ", UDISPOPT_NOUN_CLASS_UNDEFINED,
udispopt_fromNounClassIdentifier(""));
assertEquals(u"test from identifier: ", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_UNDEFINED,
assertEquals(u"test from identifier: ", UDISPOPT_NOUN_CLASS_UNDEFINED,
udispopt_fromNounClassIdentifier("undefined"));
assertEquals(u"test from identifier: ", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_OTHER,
assertEquals(u"test from identifier: ", UDISPOPT_NOUN_CLASS_OTHER,
udispopt_fromNounClassIdentifier("other"));
assertEquals(u"test from identifier: ", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_NEUTER,
assertEquals(u"test from identifier: ", UDISPOPT_NOUN_CLASS_NEUTER,
udispopt_fromNounClassIdentifier("neuter"));
assertEquals(u"test from identifier: ", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_FEMININE,
assertEquals(u"test from identifier: ", UDISPOPT_NOUN_CLASS_FEMININE,
udispopt_fromNounClassIdentifier("feminine"));
assertEquals(u"test from identifier: ", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE,
assertEquals(u"test from identifier: ", UDISPOPT_NOUN_CLASS_MASCULINE,
udispopt_fromNounClassIdentifier("masculine"));
assertEquals(u"test from identifier: ", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_ANIMATE,
assertEquals(u"test from identifier: ", UDISPOPT_NOUN_CLASS_ANIMATE,
udispopt_fromNounClassIdentifier("animate"));
assertEquals(u"test from identifier: ", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_INANIMATE,
assertEquals(u"test from identifier: ", UDISPOPT_NOUN_CLASS_INANIMATE,
udispopt_fromNounClassIdentifier("inanimate"));
assertEquals(u"test from identifier: ", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_PERSONAL,
assertEquals(u"test from identifier: ", UDISPOPT_NOUN_CLASS_PERSONAL,
udispopt_fromNounClassIdentifier("personal"));
assertEquals(u"test from identifier: ", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_COMMON,
assertEquals(u"test from identifier: ", UDISPOPT_NOUN_CLASS_COMMON,
udispopt_fromNounClassIdentifier("common"));
}

View file

@ -2447,44 +2447,44 @@ void NumberFormatterApiTest::unitNounClass() {
const char *unitIdentifier;
const UDisplayOptionsNounClass expectedNounClass;
} cases[] = {
{"de", "inch", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE},
{"de", "yard", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_NEUTER},
{"de", "meter", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE},
{"de", "liter", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE},
{"de", "second", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_FEMININE},
{"de", "minute", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_FEMININE},
{"de", "hour", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_FEMININE},
{"de", "day", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE},
{"de", "year", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_NEUTER},
{"de", "gram", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_NEUTER},
{"de", "watt", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_NEUTER},
{"de", "bit", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_NEUTER},
{"de", "byte", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_NEUTER},
{"de", "inch", UDISPOPT_NOUN_CLASS_MASCULINE},
{"de", "yard", UDISPOPT_NOUN_CLASS_NEUTER},
{"de", "meter", UDISPOPT_NOUN_CLASS_MASCULINE},
{"de", "liter", UDISPOPT_NOUN_CLASS_MASCULINE},
{"de", "second", UDISPOPT_NOUN_CLASS_FEMININE},
{"de", "minute", UDISPOPT_NOUN_CLASS_FEMININE},
{"de", "hour", UDISPOPT_NOUN_CLASS_FEMININE},
{"de", "day", UDISPOPT_NOUN_CLASS_MASCULINE},
{"de", "year", UDISPOPT_NOUN_CLASS_NEUTER},
{"de", "gram", UDISPOPT_NOUN_CLASS_NEUTER},
{"de", "watt", UDISPOPT_NOUN_CLASS_NEUTER},
{"de", "bit", UDISPOPT_NOUN_CLASS_NEUTER},
{"de", "byte", UDISPOPT_NOUN_CLASS_NEUTER},
{"fr", "inch", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE},
{"fr", "yard", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE},
{"fr", "meter", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE},
{"fr", "liter", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE},
{"fr", "second", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_FEMININE},
{"fr", "minute", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_FEMININE},
{"fr", "hour", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_FEMININE},
{"fr", "day", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE},
{"fr", "year", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE},
{"fr", "gram", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE},
{"fr", "inch", UDISPOPT_NOUN_CLASS_MASCULINE},
{"fr", "yard", UDISPOPT_NOUN_CLASS_MASCULINE},
{"fr", "meter", UDISPOPT_NOUN_CLASS_MASCULINE},
{"fr", "liter", UDISPOPT_NOUN_CLASS_MASCULINE},
{"fr", "second", UDISPOPT_NOUN_CLASS_FEMININE},
{"fr", "minute", UDISPOPT_NOUN_CLASS_FEMININE},
{"fr", "hour", UDISPOPT_NOUN_CLASS_FEMININE},
{"fr", "day", UDISPOPT_NOUN_CLASS_MASCULINE},
{"fr", "year", UDISPOPT_NOUN_CLASS_MASCULINE},
{"fr", "gram", UDISPOPT_NOUN_CLASS_MASCULINE},
// grammaticalFeatures deriveCompound "per" rule takes the gender of the
// numerator unit:
{"de", "meter-per-hour", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE},
{"fr", "meter-per-hour", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE},
{"de", "meter-per-hour", UDISPOPT_NOUN_CLASS_MASCULINE},
{"fr", "meter-per-hour", UDISPOPT_NOUN_CLASS_MASCULINE},
{"af", "meter-per-hour",
UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_UNDEFINED}, // ungendered language
UDISPOPT_NOUN_CLASS_UNDEFINED}, // ungendered language
// French "times" takes gender from first value, German takes the
// second. Prefix and power does not have impact on gender for these
// languages:
{"de", "square-decimeter-square-second", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_FEMININE},
{"de", "square-decimeter-square-second", UDISPOPT_NOUN_CLASS_FEMININE},
{"fr", "square-decimeter-square-second",
UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE},
UDISPOPT_NOUN_CLASS_MASCULINE},
// TODO(icu-units#149): percent and permille bypasses LongNameHandler
// when unitWidth is not FULL_NAME:
@ -2493,8 +2493,8 @@ void NumberFormatterApiTest::unitNounClass() {
// {"fr", "percent", UNounClass::UNOUN_CLASS_MASCULINE},
// Built-in units whose simple units lack gender in the CLDR data file
{"de", "kilopascal", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_NEUTER},
{"fr", "kilopascal", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE},
{"de", "kilopascal", UDISPOPT_NOUN_CLASS_NEUTER},
{"fr", "kilopascal", UDISPOPT_NOUN_CLASS_MASCULINE},
// {"de", "pascal", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"fr", "pascal", UNounClass::UNOUN_CLASS_UNDEFINED},
@ -2503,8 +2503,8 @@ void NumberFormatterApiTest::unitNounClass() {
// {"de", "radian", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"de", "arc-minute", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"de", "arc-second", UNounClass::UNOUN_CLASS_UNDEFINED},
{"de", "square-yard", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_NEUTER}, // POWER
{"de", "square-inch", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // POWER
{"de", "square-yard", UDISPOPT_NOUN_CLASS_NEUTER}, // POWER
{"de", "square-inch", UDISPOPT_NOUN_CLASS_MASCULINE}, // POWER
// {"de", "dunam", UNounClass::UNOUN_CLASS_ UNDEFINED},
// {"de", "karat", UNounClass::UNOUN_CLASS_ UNDEFINED},
// {"de", "milligram-ofglucose-per-deciliter", UNounClass::UNOUN_CLASS_UNDEFINED}, // COMPOUND,
@ -2516,21 +2516,21 @@ void NumberFormatterApiTest::unitNounClass() {
// {"de", "permyriad", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"de", "mole", UNounClass::UNOUN_CLASS_UNDEFINED},
{"de", "liter-per-kilometer",
UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // COMPOUND
{"de", "petabyte", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_NEUTER}, // PREFIX
{"de", "terabit", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_NEUTER}, // PREFIX
UDISPOPT_NOUN_CLASS_MASCULINE}, // COMPOUND
{"de", "petabyte", UDISPOPT_NOUN_CLASS_NEUTER}, // PREFIX
{"de", "terabit", UDISPOPT_NOUN_CLASS_NEUTER}, // PREFIX
// {"de", "century", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"de", "decade", UNounClass::UNOUN_CLASS_UNDEFINED},
{"de", "millisecond", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_FEMININE}, // PREFIX
{"de", "microsecond", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_FEMININE}, // PREFIX
{"de", "nanosecond", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_FEMININE}, // PREFIX
{"de", "millisecond", UDISPOPT_NOUN_CLASS_FEMININE}, // PREFIX
{"de", "microsecond", UDISPOPT_NOUN_CLASS_FEMININE}, // PREFIX
{"de", "nanosecond", UDISPOPT_NOUN_CLASS_FEMININE}, // PREFIX
// {"de", "ampere", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"de", "milliampere", UNounClass::UNOUN_CLASS_UNDEFINED}, // PREFIX, ampere
// {"de", "ohm", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"de", "calorie", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"de", "kilojoule", UNounClass::UNOUN_CLASS_UNDEFINED}, // PREFIX, joule
// {"de", "joule", UNounClass::UNOUN_CLASS_ UNDEFINED},
{"de", "kilowatt-hour", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_FEMININE}, // COMPOUND
{"de", "kilowatt-hour", UDISPOPT_NOUN_CLASS_FEMININE}, // COMPOUND
// {"de", "electronvolt", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"de", "british-thermal-unit", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"de", "therm-us", UNounClass::UNOUN_CLASS_UNDEFINED},
@ -2549,9 +2549,9 @@ void NumberFormatterApiTest::unitNounClass() {
// {"de", "dot-per-inch", UNounClass::UNOUN_CLASS_UNDEFINED}, // COMPOUND, dot
// {"de", "dot", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"de", "earth-radius", UNounClass::UNOUN_CLASS_UNDEFINED},
{"de", "decimeter", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // PREFIX
{"de", "micrometer", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // PREFIX
{"de", "nanometer", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // PREFIX
{"de", "decimeter", UDISPOPT_NOUN_CLASS_MASCULINE}, // PREFIX
{"de", "micrometer", UDISPOPT_NOUN_CLASS_MASCULINE}, // PREFIX
{"de", "nanometer", UDISPOPT_NOUN_CLASS_MASCULINE}, // PREFIX
// {"de", "light-year", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"de", "astronomical-unit", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"de", "furlong", UNounClass::UNOUN_CLASS_UNDEFINED},
@ -2568,8 +2568,8 @@ void NumberFormatterApiTest::unitNounClass() {
// {"de", "stone", UNounClass::UNOUN_CLASS_ UNDEFINED},
// {"de", "ounce-troy", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"de", "carat", UNounClass::UNOUN_CLASS_ UNDEFINED},
{"de", "gigawatt", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_NEUTER}, // PREFIX
{"de", "milliwatt", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_NEUTER}, // PREFIX
{"de", "gigawatt", UDISPOPT_NOUN_CLASS_NEUTER}, // PREFIX
{"de", "milliwatt", UDISPOPT_NOUN_CLASS_NEUTER}, // PREFIX
// {"de", "horsepower", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"de", "millimeter-ofhg", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"de", "pound-force-per-square-inch", UNounClass::UNOUN_CLASS_UNDEFINED}, // COMPOUND,
@ -2582,16 +2582,16 @@ void NumberFormatterApiTest::unitNounClass() {
// {"de", "hectopascal", UNounClass::UNOUN_CLASS_UNDEFINED}, // PREFIX, pascal, neuter?
// {"de", "megapascal", UNounClass::UNOUN_CLASS_UNDEFINED}, // PREFIX, pascal, neuter?
// {"de", "knot", UNounClass::UNOUN_CLASS_UNDEFINED},
{"de", "pound-force-foot", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // COMPOUND
{"de", "newton-meter", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // COMPOUND
{"de", "cubic-kilometer", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // POWER
{"de", "cubic-yard", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_NEUTER}, // POWER
{"de", "cubic-inch", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // POWER
{"de", "megaliter", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // PREFIX
{"de", "hectoliter", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // PREFIX
{"de", "pound-force-foot", UDISPOPT_NOUN_CLASS_MASCULINE}, // COMPOUND
{"de", "newton-meter", UDISPOPT_NOUN_CLASS_MASCULINE}, // COMPOUND
{"de", "cubic-kilometer", UDISPOPT_NOUN_CLASS_MASCULINE}, // POWER
{"de", "cubic-yard", UDISPOPT_NOUN_CLASS_NEUTER}, // POWER
{"de", "cubic-inch", UDISPOPT_NOUN_CLASS_MASCULINE}, // POWER
{"de", "megaliter", UDISPOPT_NOUN_CLASS_MASCULINE}, // PREFIX
{"de", "hectoliter", UDISPOPT_NOUN_CLASS_MASCULINE}, // PREFIX
// {"de", "pint-metric", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"de", "cup-metric", UNounClass::UNOUN_CLASS_UNDEFINED},
{"de", "acre-foot", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // COMPOUND
{"de", "acre-foot", UDISPOPT_NOUN_CLASS_MASCULINE}, // COMPOUND
// {"de", "bushel", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"de", "barrel", UNounClass::UNOUN_CLASS_UNDEFINED},
// Units missing gender in German also misses gender in French:
@ -2599,12 +2599,12 @@ void NumberFormatterApiTest::unitNounClass() {
// {"fr", "radian", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"fr", "arc-minute", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"fr", "arc-second", UNounClass::UNOUN_CLASS_UNDEFINED},
{"fr", "square-yard", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // POWER
{"fr", "square-inch", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // POWER
{"fr", "square-yard", UDISPOPT_NOUN_CLASS_MASCULINE}, // POWER
{"fr", "square-inch", UDISPOPT_NOUN_CLASS_MASCULINE}, // POWER
// {"fr", "dunam", UNounClass::UNOUN_CLASS_ UNDEFINED},
// {"fr", "karat", UNounClass::UNOUN_CLASS_ UNDEFINED},
{"fr", "milligram-ofglucose-per-deciliter",
UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // COMPOUND
UDISPOPT_NOUN_CLASS_MASCULINE}, // COMPOUND
// {"fr", "millimole-per-liter", UNounClass::UNOUN_CLASS_UNDEFINED}, //
// COMPOUND, mole
// {"fr", "permillion", UNounClass::UNOUN_CLASS_UNDEFINED},
@ -2612,14 +2612,14 @@ void NumberFormatterApiTest::unitNounClass() {
// {"fr", "permyriad", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"fr", "mole", UNounClass::UNOUN_CLASS_UNDEFINED},
{"fr", "liter-per-kilometer",
UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // COMPOUND
UDISPOPT_NOUN_CLASS_MASCULINE}, // COMPOUND
// {"fr", "petabyte", UNounClass::UNOUN_CLASS_UNDEFINED}, // PREFIX
// {"fr", "terabit", UNounClass::UNOUN_CLASS_UNDEFINED}, // PREFIX
// {"fr", "century", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"fr", "decade", UNounClass::UNOUN_CLASS_UNDEFINED},
{"fr", "millisecond", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_FEMININE}, // PREFIX
{"fr", "microsecond", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_FEMININE}, // PREFIX
{"fr", "nanosecond", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_FEMININE}, // PREFIX
{"fr", "millisecond", UDISPOPT_NOUN_CLASS_FEMININE}, // PREFIX
{"fr", "microsecond", UDISPOPT_NOUN_CLASS_FEMININE}, // PREFIX
{"fr", "nanosecond", UDISPOPT_NOUN_CLASS_FEMININE}, // PREFIX
// {"fr", "ampere", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"fr", "milliampere", UNounClass::UNOUN_CLASS_UNDEFINED}, // PREFIX, ampere
// {"fr", "ohm", UNounClass::UNOUN_CLASS_UNDEFINED},
@ -2645,9 +2645,9 @@ void NumberFormatterApiTest::unitNounClass() {
// {"fr", "dot-per-inch", UNounClass::UNOUN_CLASS_UNDEFINED}, // COMPOUND, dot
// {"fr", "dot", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"fr", "earth-radius", UNounClass::UNOUN_CLASS_UNDEFINED},
{"fr", "decimeter", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // PREFIX
{"fr", "micrometer", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // PREFIX
{"fr", "nanometer", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // PREFIX
{"fr", "decimeter", UDISPOPT_NOUN_CLASS_MASCULINE}, // PREFIX
{"fr", "micrometer", UDISPOPT_NOUN_CLASS_MASCULINE}, // PREFIX
{"fr", "nanometer", UDISPOPT_NOUN_CLASS_MASCULINE}, // PREFIX
// {"fr", "light-year", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"fr", "astronomical-unit", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"fr", "furlong", UNounClass::UNOUN_CLASS_UNDEFINED},
@ -2667,10 +2667,10 @@ void NumberFormatterApiTest::unitNounClass() {
// {"fr", "gigawatt", UNounClass::UNOUN_CLASS_UNDEFINED}, // PREFIX
// {"fr", "milliwatt", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"fr", "horsepower", UNounClass::UNOUN_CLASS_UNDEFINED},
{"fr", "millimeter-ofhg", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE},
{"fr", "millimeter-ofhg", UDISPOPT_NOUN_CLASS_MASCULINE},
// {"fr", "pound-force-per-square-inch", UNounClass::UNOUN_CLASS_UNDEFINED}, // COMPOUND,
// pound-force
{"fr", "inch-ofhg", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE},
{"fr", "inch-ofhg", UDISPOPT_NOUN_CLASS_MASCULINE},
// {"fr", "bar", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"fr", "millibar", UNounClass::UNOUN_CLASS_UNDEFINED}, // PREFIX, bar
// {"fr", "atmosphere", UNounClass::UNOUN_CLASS_UNDEFINED},
@ -2680,19 +2680,19 @@ void NumberFormatterApiTest::unitNounClass() {
// {"fr", "knot", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"fr", "pound-force-foot", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"fr", "newton-meter", UNounClass::UNOUN_CLASS_UNDEFINED},
{"fr", "cubic-kilometer", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // POWER
{"fr", "cubic-yard", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // POWER
{"fr", "cubic-inch", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // POWER
{"fr", "megaliter", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // PREFIX
{"fr", "hectoliter", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // PREFIX
{"fr", "cubic-kilometer", UDISPOPT_NOUN_CLASS_MASCULINE}, // POWER
{"fr", "cubic-yard", UDISPOPT_NOUN_CLASS_MASCULINE}, // POWER
{"fr", "cubic-inch", UDISPOPT_NOUN_CLASS_MASCULINE}, // POWER
{"fr", "megaliter", UDISPOPT_NOUN_CLASS_MASCULINE}, // PREFIX
{"fr", "hectoliter", UDISPOPT_NOUN_CLASS_MASCULINE}, // PREFIX
// {"fr", "pint-metric", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"fr", "cup-metric", UNounClass::UNOUN_CLASS_UNDEFINED},
{"fr", "acre-foot", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_FEMININE}, // COMPOUND
{"fr", "acre-foot", UDISPOPT_NOUN_CLASS_FEMININE}, // COMPOUND
// {"fr", "bushel", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"fr", "barrel", UNounClass::UNOUN_CLASS_UNDEFINED},
// Some more French units missing gender:
// {"fr", "degree", UNounClass::UNOUN_CLASS_UNDEFINED},
{"fr", "square-meter", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // POWER
{"fr", "square-meter", UDISPOPT_NOUN_CLASS_MASCULINE}, // POWER
// {"fr", "terabyte", UNounClass::UNOUN_CLASS_UNDEFINED}, // PREFIX, byte
// {"fr", "gigabyte", UNounClass::UNOUN_CLASS_UNDEFINED}, // PREFIX, byte
// {"fr", "gigabit", UNounClass::UNOUN_CLASS_UNDEFINED}, // PREFIX, bit
@ -2704,10 +2704,10 @@ void NumberFormatterApiTest::unitNounClass() {
// {"fr", "bit", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"fr", "volt", UNounClass::UNOUN_CLASS_UNDEFINED},
// {"fr", "watt", UNounClass::UNOUN_CLASS_UNDEFINED},
{"fr", "cubic-meter", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE}, // POWER
{"fr", "cubic-meter", UDISPOPT_NOUN_CLASS_MASCULINE}, // POWER
// gender-lacking builtins within compound units
{"de", "newton-meter-per-second", UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_MASCULINE},
{"de", "newton-meter-per-second", UDISPOPT_NOUN_CLASS_MASCULINE},
// TODO(ICU-21494): determine whether list genders behave as follows,
// and implement proper getListGender support (covering more than just
@ -2747,7 +2747,7 @@ void NumberFormatterApiTest::unitNounClass() {
fn = formatter.formatDouble(1.1, status);
status.assertSuccess();
assertEquals("getNounClasses for a not supported language",
UDisplayOptionsNounClass::UDISPOPT_NOUN_CLASS_UNDEFINED, fn.getNounClass(status));
UDISPOPT_NOUN_CLASS_UNDEFINED, fn.getNounClass(status));
}
void NumberFormatterApiTest::unitGender() {

View file

@ -10,10 +10,10 @@ import com.ibm.icu.impl.FormattedValueStringBuilderImpl;
import com.ibm.icu.impl.Utility;
import com.ibm.icu.impl.number.DecimalQuantity;
import com.ibm.icu.text.ConstrainedFieldPosition;
import com.ibm.icu.text.DisplayOptions;
import com.ibm.icu.text.FormattedValue;
import com.ibm.icu.text.PluralRules.IFixedDecimal;
import com.ibm.icu.util.MeasureUnit;
import com.ibm.icu.text.DisplayOptions.NounClass;
/**
* The result of a number formatting operation. This class allows the result to be exported in several
@ -144,8 +144,8 @@ public class FormattedNumber implements FormattedValue {
* @return NounClass
* @draft ICU 71.
*/
public NounClass getNounClass() {
return NounClass.fromIdentifier(this.gender);
public DisplayOptions.NounClass getNounClass() {
return DisplayOptions.NounClass.fromIdentifier(this.gender);
}
/**

View file

@ -3,7 +3,11 @@
package com.ibm.icu.dev.test.text;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import com.ibm.icu.dev.test.TestFmwk;
import com.ibm.icu.text.DisplayOptions;
import com.ibm.icu.text.DisplayOptions.Capitalization;
import com.ibm.icu.text.DisplayOptions.DisplayLength;
@ -13,308 +17,301 @@ import com.ibm.icu.text.DisplayOptions.NounClass;
import com.ibm.icu.text.DisplayOptions.PluralCategory;
import com.ibm.icu.text.DisplayOptions.SubstituteHandling;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import com.ibm.icu.dev.test.TestFmwk;
/**
* @test
* @summary Test of DisplayOptions Class.
*/
@RunWith(JUnit4.class)
public class DisplayOptionsTest extends TestFmwk {
public class DisplayOptionsTest extends TestFmwk {
@Test
public void TestDisplayOptionsDefault(){
DisplayOptions displayOptions = DisplayOptions.builder().build();
assertEquals("Test setting parameters", GrammaticalCase.UNDEFINED,
displayOptions.getGrammaticalCase());
assertEquals("Test default values: ", NounClass.UNDEFINED, displayOptions.getNounClass());
assertEquals("Test default values: ", PluralCategory.UNDEFINED,
displayOptions.getPluralCategory());
assertEquals("Test default values: ", Capitalization.UNDEFINED,
displayOptions.getCapitalization());
assertEquals("Test default values: ", NameStyle.UNDEFINED, displayOptions.getNameStyle());
assertEquals("Test default values: ", DisplayLength.UNDEFINED,
displayOptions.getDisplayLength());
assertEquals("Test default values: ", SubstituteHandling.UNDEFINED,
displayOptions.getSubstituteHandling());
}
@Test
public void TestDisplayOptionsDefault(){
DisplayOptions displayOptions = DisplayOptions.builder().build();
assertEquals("Test setting parameters", GrammaticalCase.UNDEFINED,
displayOptions.getGrammaticalCase());
assertEquals("Test default values: ", NounClass.UNDEFINED, displayOptions.getNounClass());
assertEquals("Test default values: ", PluralCategory.UNDEFINED,
displayOptions.getPluralCategory());
assertEquals("Test default values: ", Capitalization.UNDEFINED,
displayOptions.getCapitalization());
assertEquals("Test default values: ", NameStyle.UNDEFINED, displayOptions.getNameStyle());
assertEquals("Test default values: ", DisplayLength.UNDEFINED,
displayOptions.getDisplayLength());
assertEquals("Test default values: ", SubstituteHandling.UNDEFINED,
displayOptions.getSubstituteHandling());
}
@Test
public void TestDisplayOptionsEachElement() {
DisplayOptions displayOptions = DisplayOptions.builder()
.setGrammaticalCase(GrammaticalCase.ABLATIVE).build();
assertEquals("Test setting parameters: ", GrammaticalCase.ABLATIVE,
displayOptions.getGrammaticalCase());
@Test
public void TestDisplayOptionsEachElement() {
DisplayOptions displayOptions = DisplayOptions.builder()
.setGrammaticalCase(GrammaticalCase.ABLATIVE).build();
assertEquals("Test setting parameters: ", GrammaticalCase.ABLATIVE,
displayOptions.getGrammaticalCase());
displayOptions = DisplayOptions.builder().setNounClass(NounClass.PERSONAL).build();
assertEquals("Test setting parameters: ", NounClass.PERSONAL,
displayOptions.getNounClass());
displayOptions = DisplayOptions.builder().setNounClass(NounClass.PERSONAL).build();
assertEquals("Test setting parameters: ", NounClass.PERSONAL,
displayOptions.getNounClass());
displayOptions = DisplayOptions.builder().setPluralCategory(PluralCategory.FEW).build();
assertEquals("Test setting parameters: ", PluralCategory.FEW,
displayOptions.getPluralCategory());
displayOptions = DisplayOptions.builder().setPluralCategory(PluralCategory.FEW).build();
assertEquals("Test setting parameters: ", PluralCategory.FEW,
displayOptions.getPluralCategory());
displayOptions = DisplayOptions.builder()
.setCapitalization(Capitalization.BEGINNING_OF_SENTENCE).build();
assertEquals("Test setting parameters: ", Capitalization.BEGINNING_OF_SENTENCE,
displayOptions.getCapitalization());
displayOptions = DisplayOptions.builder()
.setCapitalization(Capitalization.BEGINNING_OF_SENTENCE).build();
assertEquals("Test setting parameters: ", Capitalization.BEGINNING_OF_SENTENCE,
displayOptions.getCapitalization());
displayOptions = DisplayOptions.builder().setNameStyle(NameStyle.STANDARD_NAMES).build();
assertEquals("Test setting parameters: ", NameStyle.STANDARD_NAMES,
displayOptions.getNameStyle());
displayOptions = DisplayOptions.builder().setNameStyle(NameStyle.STANDARD_NAMES).build();
assertEquals("Test setting parameters: ", NameStyle.STANDARD_NAMES,
displayOptions.getNameStyle());
displayOptions = DisplayOptions.builder().setDisplayLength(DisplayLength.LENGTH_FULL)
.build();
assertEquals("Test setting parameters: ", DisplayLength.LENGTH_FULL,
displayOptions.getDisplayLength());
displayOptions = DisplayOptions.builder().setDisplayLength(DisplayLength.LENGTH_FULL)
.build();
assertEquals("Test setting parameters: ", DisplayLength.LENGTH_FULL,
displayOptions.getDisplayLength());
displayOptions = DisplayOptions.builder()
.setSubstituteHandling(SubstituteHandling.NO_SUBSTITUTE).build();
assertEquals("Test setting parameters: ", SubstituteHandling.NO_SUBSTITUTE,
displayOptions.getSubstituteHandling());
}
displayOptions = DisplayOptions.builder()
.setSubstituteHandling(SubstituteHandling.NO_SUBSTITUTE).build();
assertEquals("Test setting parameters: ", SubstituteHandling.NO_SUBSTITUTE,
displayOptions.getSubstituteHandling());
}
@Test
public void TestDisplayOptionsUpdating() {
DisplayOptions displayOptions = DisplayOptions.builder()
.setGrammaticalCase(GrammaticalCase.ABLATIVE).build();
assertEquals("Test updating parameters: ", GrammaticalCase.ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals("Test updating parameters: ", NounClass.UNDEFINED,
displayOptions.getNounClass());
assertEquals("Test updating parameters: ", PluralCategory.UNDEFINED,
displayOptions.getPluralCategory());
assertEquals("Test updating parameters: ", Capitalization.UNDEFINED,
displayOptions.getCapitalization());
assertEquals("Test updating parameters: ", NameStyle.UNDEFINED,
displayOptions.getNameStyle());
assertEquals("Test updating parameters: ", DisplayLength.UNDEFINED,
displayOptions.getDisplayLength());
assertEquals("Test updating parameters: ", SubstituteHandling.UNDEFINED,
displayOptions.getSubstituteHandling());
@Test
public void TestDisplayOptionsUpdating() {
DisplayOptions displayOptions = DisplayOptions.builder()
.setGrammaticalCase(GrammaticalCase.ABLATIVE).build();
assertEquals("Test updating parameters: ", GrammaticalCase.ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals("Test updating parameters: ", NounClass.UNDEFINED,
displayOptions.getNounClass());
assertEquals("Test updating parameters: ", PluralCategory.UNDEFINED,
displayOptions.getPluralCategory());
assertEquals("Test updating parameters: ", Capitalization.UNDEFINED,
displayOptions.getCapitalization());
assertEquals("Test updating parameters: ", NameStyle.UNDEFINED,
displayOptions.getNameStyle());
assertEquals("Test updating parameters: ", DisplayLength.UNDEFINED,
displayOptions.getDisplayLength());
assertEquals("Test updating parameters: ", SubstituteHandling.UNDEFINED,
displayOptions.getSubstituteHandling());
displayOptions = displayOptions.copyToBuilder().setNounClass(NounClass.PERSONAL).build();
assertEquals("Test updating parameters: ", GrammaticalCase.ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals("Test updating parameters: ", NounClass.PERSONAL,
displayOptions.getNounClass());
assertEquals("Test updating parameters: ", PluralCategory.UNDEFINED,
displayOptions.getPluralCategory());
assertEquals("Test updating parameters: ", Capitalization.UNDEFINED,
displayOptions.getCapitalization());
assertEquals("Test updating parameters: ", NameStyle.UNDEFINED,
displayOptions.getNameStyle());
assertEquals("Test updating parameters: ", DisplayLength.UNDEFINED,
displayOptions.getDisplayLength());
assertEquals("Test updating parameters: ", SubstituteHandling.UNDEFINED,
displayOptions.getSubstituteHandling());
displayOptions = displayOptions.copyToBuilder().setNounClass(NounClass.PERSONAL).build();
assertEquals("Test updating parameters: ", GrammaticalCase.ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals("Test updating parameters: ", NounClass.PERSONAL,
displayOptions.getNounClass());
assertEquals("Test updating parameters: ", PluralCategory.UNDEFINED,
displayOptions.getPluralCategory());
assertEquals("Test updating parameters: ", Capitalization.UNDEFINED,
displayOptions.getCapitalization());
assertEquals("Test updating parameters: ", NameStyle.UNDEFINED,
displayOptions.getNameStyle());
assertEquals("Test updating parameters: ", DisplayLength.UNDEFINED,
displayOptions.getDisplayLength());
assertEquals("Test updating parameters: ", SubstituteHandling.UNDEFINED,
displayOptions.getSubstituteHandling());
displayOptions = displayOptions.copyToBuilder().setPluralCategory(PluralCategory.FEW)
.build();
assertEquals("Test updating parameters: ", GrammaticalCase.ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals("Test updating parameters: ", NounClass.PERSONAL,
displayOptions.getNounClass());
assertEquals("Test updating parameters: ", PluralCategory.FEW,
displayOptions.getPluralCategory());
assertEquals("Test updating parameters: ", Capitalization.UNDEFINED,
displayOptions.getCapitalization());
assertEquals("Test updating parameters: ", NameStyle.UNDEFINED,
displayOptions.getNameStyle());
assertEquals("Test updating parameters: ", DisplayLength.UNDEFINED,
displayOptions.getDisplayLength());
assertEquals("Test updating parameters: ", SubstituteHandling.UNDEFINED,
displayOptions.getSubstituteHandling());
displayOptions = displayOptions.copyToBuilder().setPluralCategory(PluralCategory.FEW)
.build();
assertEquals("Test updating parameters: ", GrammaticalCase.ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals("Test updating parameters: ", NounClass.PERSONAL,
displayOptions.getNounClass());
assertEquals("Test updating parameters: ", PluralCategory.FEW,
displayOptions.getPluralCategory());
assertEquals("Test updating parameters: ", Capitalization.UNDEFINED,
displayOptions.getCapitalization());
assertEquals("Test updating parameters: ", NameStyle.UNDEFINED,
displayOptions.getNameStyle());
assertEquals("Test updating parameters: ", DisplayLength.UNDEFINED,
displayOptions.getDisplayLength());
assertEquals("Test updating parameters: ", SubstituteHandling.UNDEFINED,
displayOptions.getSubstituteHandling());
displayOptions = displayOptions.copyToBuilder()
.setCapitalization(Capitalization.BEGINNING_OF_SENTENCE).build();
assertEquals("Test updating parameters: ", GrammaticalCase.ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals("Test updating parameters: ", NounClass.PERSONAL,
displayOptions.getNounClass());
assertEquals("Test updating parameters: ", PluralCategory.FEW,
displayOptions.getPluralCategory());
assertEquals("Test updating parameters: ", Capitalization.BEGINNING_OF_SENTENCE,
displayOptions.getCapitalization());
assertEquals("Test updating parameters: ", NameStyle.UNDEFINED,
displayOptions.getNameStyle());
assertEquals("Test updating parameters: ", DisplayLength.UNDEFINED,
displayOptions.getDisplayLength());
assertEquals("Test updating parameters: ", SubstituteHandling.UNDEFINED,
displayOptions.getSubstituteHandling());
displayOptions = displayOptions.copyToBuilder()
.setCapitalization(Capitalization.BEGINNING_OF_SENTENCE).build();
assertEquals("Test updating parameters: ", GrammaticalCase.ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals("Test updating parameters: ", NounClass.PERSONAL,
displayOptions.getNounClass());
assertEquals("Test updating parameters: ", PluralCategory.FEW,
displayOptions.getPluralCategory());
assertEquals("Test updating parameters: ", Capitalization.BEGINNING_OF_SENTENCE,
displayOptions.getCapitalization());
assertEquals("Test updating parameters: ", NameStyle.UNDEFINED,
displayOptions.getNameStyle());
assertEquals("Test updating parameters: ", DisplayLength.UNDEFINED,
displayOptions.getDisplayLength());
assertEquals("Test updating parameters: ", SubstituteHandling.UNDEFINED,
displayOptions.getSubstituteHandling());
displayOptions = displayOptions.copyToBuilder().setNameStyle(NameStyle.STANDARD_NAMES)
.build();
assertEquals("Test updating parameters: ", GrammaticalCase.ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals("Test updating parameters: ", NounClass.PERSONAL,
displayOptions.getNounClass());
assertEquals("Test updating parameters: ", PluralCategory.FEW,
displayOptions.getPluralCategory());
assertEquals("Test updating parameters: ", Capitalization.BEGINNING_OF_SENTENCE,
displayOptions.getCapitalization());
assertEquals("Test updating parameters: ", NameStyle.STANDARD_NAMES,
displayOptions.getNameStyle());
assertEquals("Test updating parameters: ", DisplayLength.UNDEFINED,
displayOptions.getDisplayLength());
assertEquals("Test updating parameters: ", SubstituteHandling.UNDEFINED,
displayOptions.getSubstituteHandling());
displayOptions = displayOptions.copyToBuilder().setNameStyle(NameStyle.STANDARD_NAMES)
.build();
assertEquals("Test updating parameters: ", GrammaticalCase.ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals("Test updating parameters: ", NounClass.PERSONAL,
displayOptions.getNounClass());
assertEquals("Test updating parameters: ", PluralCategory.FEW,
displayOptions.getPluralCategory());
assertEquals("Test updating parameters: ", Capitalization.BEGINNING_OF_SENTENCE,
displayOptions.getCapitalization());
assertEquals("Test updating parameters: ", NameStyle.STANDARD_NAMES,
displayOptions.getNameStyle());
assertEquals("Test updating parameters: ", DisplayLength.UNDEFINED,
displayOptions.getDisplayLength());
assertEquals("Test updating parameters: ", SubstituteHandling.UNDEFINED,
displayOptions.getSubstituteHandling());
displayOptions = displayOptions.copyToBuilder().setDisplayLength(DisplayLength.LENGTH_FULL)
.build();
assertEquals("Test updating parameters: ", GrammaticalCase.ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals("Test updating parameters: ", NounClass.PERSONAL,
displayOptions.getNounClass());
assertEquals("Test updating parameters: ", PluralCategory.FEW,
displayOptions.getPluralCategory());
assertEquals("Test updating parameters: ", Capitalization.BEGINNING_OF_SENTENCE,
displayOptions.getCapitalization());
assertEquals("Test updating parameters: ", NameStyle.STANDARD_NAMES,
displayOptions.getNameStyle());
assertEquals("Test updating parameters: ", DisplayLength.LENGTH_FULL,
displayOptions.getDisplayLength());
assertEquals("Test updating parameters: ", SubstituteHandling.UNDEFINED,
displayOptions.getSubstituteHandling());
displayOptions = displayOptions.copyToBuilder().setDisplayLength(DisplayLength.LENGTH_FULL)
.build();
assertEquals("Test updating parameters: ", GrammaticalCase.ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals("Test updating parameters: ", NounClass.PERSONAL,
displayOptions.getNounClass());
assertEquals("Test updating parameters: ", PluralCategory.FEW,
displayOptions.getPluralCategory());
assertEquals("Test updating parameters: ", Capitalization.BEGINNING_OF_SENTENCE,
displayOptions.getCapitalization());
assertEquals("Test updating parameters: ", NameStyle.STANDARD_NAMES,
displayOptions.getNameStyle());
assertEquals("Test updating parameters: ", DisplayLength.LENGTH_FULL,
displayOptions.getDisplayLength());
assertEquals("Test updating parameters: ", SubstituteHandling.UNDEFINED,
displayOptions.getSubstituteHandling());
displayOptions = displayOptions.copyToBuilder()
.setSubstituteHandling(SubstituteHandling.NO_SUBSTITUTE).build();
assertEquals("Test updating parameters: ", GrammaticalCase.ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals("Test updating parameters: ", NounClass.PERSONAL,
displayOptions.getNounClass());
assertEquals("Test updating parameters: ", PluralCategory.FEW,
displayOptions.getPluralCategory());
assertEquals("Test updating parameters: ", Capitalization.BEGINNING_OF_SENTENCE,
displayOptions.getCapitalization());
assertEquals("Test updating parameters: ", NameStyle.STANDARD_NAMES,
displayOptions.getNameStyle());
assertEquals("Test updating parameters: ", DisplayLength.LENGTH_FULL,
displayOptions.getDisplayLength());
assertEquals("Test updating parameters: ", SubstituteHandling.NO_SUBSTITUTE,
displayOptions.getSubstituteHandling());
}
displayOptions = displayOptions.copyToBuilder()
.setSubstituteHandling(SubstituteHandling.NO_SUBSTITUTE).build();
assertEquals("Test updating parameters: ", GrammaticalCase.ABLATIVE,
displayOptions.getGrammaticalCase());
assertEquals("Test updating parameters: ", NounClass.PERSONAL,
displayOptions.getNounClass());
assertEquals("Test updating parameters: ", PluralCategory.FEW,
displayOptions.getPluralCategory());
assertEquals("Test updating parameters: ", Capitalization.BEGINNING_OF_SENTENCE,
displayOptions.getCapitalization());
assertEquals("Test updating parameters: ", NameStyle.STANDARD_NAMES,
displayOptions.getNameStyle());
assertEquals("Test updating parameters: ", DisplayLength.LENGTH_FULL,
displayOptions.getDisplayLength());
assertEquals("Test updating parameters: ", SubstituteHandling.NO_SUBSTITUTE,
displayOptions.getSubstituteHandling());
}
@Test
public void TestDisplayOptionsGetIdentifier() {
assertEquals("test get identifier: ", "undefined",
GrammaticalCase.UNDEFINED.getIdentifier());
assertEquals("test get identifier: ", "ablative", GrammaticalCase.ABLATIVE.getIdentifier());
assertEquals("test get identifier: ", "accusative",
GrammaticalCase.ACCUSATIVE.getIdentifier());
assertEquals("test get identifier: ", "comitative",
GrammaticalCase.COMITATIVE.getIdentifier());
assertEquals("test get identifier: ", "dative", GrammaticalCase.DATIVE.getIdentifier());
assertEquals("test get identifier: ", "ergative", GrammaticalCase.ERGATIVE.getIdentifier());
assertEquals("test get identifier: ", "genitive", GrammaticalCase.GENITIVE.getIdentifier());
assertEquals("test get identifier: ", "instrumental",
GrammaticalCase.INSTRUMENTAL.getIdentifier());
assertEquals("test get identifier: ", "locative", GrammaticalCase.LOCATIVE.getIdentifier());
assertEquals("test get identifier: ", "locative_copulative",
GrammaticalCase.LOCATIVE_COPULATIVE.getIdentifier());
assertEquals("test get identifier: ", "nominative",
GrammaticalCase.NOMINATIVE.getIdentifier());
assertEquals("test get identifier: ", "oblique", GrammaticalCase.OBLIQUE.getIdentifier());
assertEquals("test get identifier: ", "prepositional",
GrammaticalCase.PREPOSITIONAL.getIdentifier());
assertEquals("test get identifier: ", "sociative",
GrammaticalCase.SOCIATIVE.getIdentifier());
assertEquals("test get identifier: ", "vocative", GrammaticalCase.VOCATIVE.getIdentifier());
@Test
public void TestDisplayOptionsGetIdentifier() {
assertEquals("test get identifier: ", "undefined",
GrammaticalCase.UNDEFINED.getIdentifier());
assertEquals("test get identifier: ", "ablative", GrammaticalCase.ABLATIVE.getIdentifier());
assertEquals("test get identifier: ", "accusative",
GrammaticalCase.ACCUSATIVE.getIdentifier());
assertEquals("test get identifier: ", "comitative",
GrammaticalCase.COMITATIVE.getIdentifier());
assertEquals("test get identifier: ", "dative", GrammaticalCase.DATIVE.getIdentifier());
assertEquals("test get identifier: ", "ergative", GrammaticalCase.ERGATIVE.getIdentifier());
assertEquals("test get identifier: ", "genitive", GrammaticalCase.GENITIVE.getIdentifier());
assertEquals("test get identifier: ", "instrumental",
GrammaticalCase.INSTRUMENTAL.getIdentifier());
assertEquals("test get identifier: ", "locative", GrammaticalCase.LOCATIVE.getIdentifier());
assertEquals("test get identifier: ", "locative_copulative",
GrammaticalCase.LOCATIVE_COPULATIVE.getIdentifier());
assertEquals("test get identifier: ", "nominative",
GrammaticalCase.NOMINATIVE.getIdentifier());
assertEquals("test get identifier: ", "oblique", GrammaticalCase.OBLIQUE.getIdentifier());
assertEquals("test get identifier: ", "prepositional",
GrammaticalCase.PREPOSITIONAL.getIdentifier());
assertEquals("test get identifier: ", "sociative",
GrammaticalCase.SOCIATIVE.getIdentifier());
assertEquals("test get identifier: ", "vocative", GrammaticalCase.VOCATIVE.getIdentifier());
assertEquals("test get identifier: ", "undefined",
PluralCategory.UNDEFINED.getIdentifier());
assertEquals("test get identifier: ", "zero", PluralCategory.ZERO.getIdentifier());
assertEquals("test get identifier: ", "one", PluralCategory.ONE.getIdentifier());
assertEquals("test get identifier: ", "two", PluralCategory.TWO.getIdentifier());
assertEquals("test get identifier: ", "few", PluralCategory.FEW.getIdentifier());
assertEquals("test get identifier: ", "many", PluralCategory.MANY.getIdentifier());
assertEquals("test get identifier: ", "other", PluralCategory.OTHER.getIdentifier());
assertEquals("test get identifier: ", "undefined",
PluralCategory.UNDEFINED.getIdentifier());
assertEquals("test get identifier: ", "zero", PluralCategory.ZERO.getIdentifier());
assertEquals("test get identifier: ", "one", PluralCategory.ONE.getIdentifier());
assertEquals("test get identifier: ", "two", PluralCategory.TWO.getIdentifier());
assertEquals("test get identifier: ", "few", PluralCategory.FEW.getIdentifier());
assertEquals("test get identifier: ", "many", PluralCategory.MANY.getIdentifier());
assertEquals("test get identifier: ", "other", PluralCategory.OTHER.getIdentifier());
assertEquals("test get identifier: ", "undefined", NounClass.UNDEFINED.getIdentifier());
assertEquals("test get identifier: ", "other", NounClass.OTHER.getIdentifier());
assertEquals("test get identifier: ", "neuter", NounClass.NEUTER.getIdentifier());
assertEquals("test get identifier: ", "feminine", NounClass.FEMININE.getIdentifier());
assertEquals("test get identifier: ", "masculine", NounClass.MASCULINE.getIdentifier());
assertEquals("test get identifier: ", "animate", NounClass.ANIMATE.getIdentifier());
assertEquals("test get identifier: ", "inanimate", NounClass.INANIMATE.getIdentifier());
assertEquals("test get identifier: ", "personal", NounClass.PERSONAL.getIdentifier());
assertEquals("test get identifier: ", "common", NounClass.COMMON.getIdentifier());
}
assertEquals("test get identifier: ", "undefined", NounClass.UNDEFINED.getIdentifier());
assertEquals("test get identifier: ", "other", NounClass.OTHER.getIdentifier());
assertEquals("test get identifier: ", "neuter", NounClass.NEUTER.getIdentifier());
assertEquals("test get identifier: ", "feminine", NounClass.FEMININE.getIdentifier());
assertEquals("test get identifier: ", "masculine", NounClass.MASCULINE.getIdentifier());
assertEquals("test get identifier: ", "animate", NounClass.ANIMATE.getIdentifier());
assertEquals("test get identifier: ", "inanimate", NounClass.INANIMATE.getIdentifier());
assertEquals("test get identifier: ", "personal", NounClass.PERSONAL.getIdentifier());
assertEquals("test get identifier: ", "common", NounClass.COMMON.getIdentifier());
}
@Test
public void TestDisplayOptionsFromIdentifier() {
assertEquals("test from identifier: ", GrammaticalCase.UNDEFINED,
GrammaticalCase.fromIdentifier(""));
assertEquals("test from identifier: ", GrammaticalCase.UNDEFINED,
GrammaticalCase.fromIdentifier("undefined"));
assertEquals("test from identifier: ", GrammaticalCase.ABLATIVE,
GrammaticalCase.fromIdentifier("ablative"));
assertEquals("test from identifier: ", GrammaticalCase.ACCUSATIVE,
GrammaticalCase.fromIdentifier("accusative"));
assertEquals("test from identifier: ", GrammaticalCase.COMITATIVE,
GrammaticalCase.fromIdentifier("comitative"));
assertEquals("test from identifier: ", GrammaticalCase.DATIVE,
GrammaticalCase.fromIdentifier("dative"));
assertEquals("test from identifier: ", GrammaticalCase.ERGATIVE,
GrammaticalCase.fromIdentifier("ergative"));
assertEquals("test from identifier: ", GrammaticalCase.GENITIVE,
GrammaticalCase.fromIdentifier("genitive"));
assertEquals("test from identifier: ", GrammaticalCase.INSTRUMENTAL,
GrammaticalCase.fromIdentifier("instrumental"));
assertEquals("test from identifier: ", GrammaticalCase.LOCATIVE,
GrammaticalCase.fromIdentifier("locative"));
assertEquals("test from identifier: ", GrammaticalCase.LOCATIVE_COPULATIVE,
GrammaticalCase.fromIdentifier("locative_copulative"));
assertEquals("test from identifier: ", GrammaticalCase.NOMINATIVE,
GrammaticalCase.fromIdentifier("nominative"));
assertEquals("test from identifier: ", GrammaticalCase.OBLIQUE,
GrammaticalCase.fromIdentifier("oblique"));
assertEquals("test from identifier: ", GrammaticalCase.PREPOSITIONAL,
GrammaticalCase.fromIdentifier("prepositional"));
assertEquals("test from identifier: ", GrammaticalCase.SOCIATIVE,
GrammaticalCase.fromIdentifier("sociative"));
assertEquals("test from identifier: ", GrammaticalCase.VOCATIVE,
GrammaticalCase.fromIdentifier("vocative"));
@Test
public void TestDisplayOptionsFromIdentifier() {
assertEquals("test from identifier: ", GrammaticalCase.UNDEFINED,
GrammaticalCase.fromIdentifier(""));
assertEquals("test from identifier: ", GrammaticalCase.UNDEFINED,
GrammaticalCase.fromIdentifier("undefined"));
assertEquals("test from identifier: ", GrammaticalCase.ABLATIVE,
GrammaticalCase.fromIdentifier("ablative"));
assertEquals("test from identifier: ", GrammaticalCase.ACCUSATIVE,
GrammaticalCase.fromIdentifier("accusative"));
assertEquals("test from identifier: ", GrammaticalCase.COMITATIVE,
GrammaticalCase.fromIdentifier("comitative"));
assertEquals("test from identifier: ", GrammaticalCase.DATIVE,
GrammaticalCase.fromIdentifier("dative"));
assertEquals("test from identifier: ", GrammaticalCase.ERGATIVE,
GrammaticalCase.fromIdentifier("ergative"));
assertEquals("test from identifier: ", GrammaticalCase.GENITIVE,
GrammaticalCase.fromIdentifier("genitive"));
assertEquals("test from identifier: ", GrammaticalCase.INSTRUMENTAL,
GrammaticalCase.fromIdentifier("instrumental"));
assertEquals("test from identifier: ", GrammaticalCase.LOCATIVE,
GrammaticalCase.fromIdentifier("locative"));
assertEquals("test from identifier: ", GrammaticalCase.LOCATIVE_COPULATIVE,
GrammaticalCase.fromIdentifier("locative_copulative"));
assertEquals("test from identifier: ", GrammaticalCase.NOMINATIVE,
GrammaticalCase.fromIdentifier("nominative"));
assertEquals("test from identifier: ", GrammaticalCase.OBLIQUE,
GrammaticalCase.fromIdentifier("oblique"));
assertEquals("test from identifier: ", GrammaticalCase.PREPOSITIONAL,
GrammaticalCase.fromIdentifier("prepositional"));
assertEquals("test from identifier: ", GrammaticalCase.SOCIATIVE,
GrammaticalCase.fromIdentifier("sociative"));
assertEquals("test from identifier: ", GrammaticalCase.VOCATIVE,
GrammaticalCase.fromIdentifier("vocative"));
assertEquals("test from identifier: ", PluralCategory.UNDEFINED,
PluralCategory.fromIdentifier(""));
assertEquals("test from identifier: ", PluralCategory.UNDEFINED,
PluralCategory.fromIdentifier("undefined"));
assertEquals("test from identifier: ", PluralCategory.ZERO,
PluralCategory.fromIdentifier("zero"));
assertEquals("test from identifier: ", PluralCategory.ONE,
PluralCategory.fromIdentifier("one"));
assertEquals("test from identifier: ", PluralCategory.TWO,
PluralCategory.fromIdentifier("two"));
assertEquals("test from identifier: ", PluralCategory.FEW,
PluralCategory.fromIdentifier("few"));
assertEquals("test from identifier: ", PluralCategory.MANY,
PluralCategory.fromIdentifier("many"));
assertEquals("test from identifier: ", PluralCategory.OTHER,
PluralCategory.fromIdentifier("other"));
assertEquals("test from identifier: ", PluralCategory.UNDEFINED,
PluralCategory.fromIdentifier(""));
assertEquals("test from identifier: ", PluralCategory.UNDEFINED,
PluralCategory.fromIdentifier("undefined"));
assertEquals("test from identifier: ", PluralCategory.ZERO,
PluralCategory.fromIdentifier("zero"));
assertEquals("test from identifier: ", PluralCategory.ONE,
PluralCategory.fromIdentifier("one"));
assertEquals("test from identifier: ", PluralCategory.TWO,
PluralCategory.fromIdentifier("two"));
assertEquals("test from identifier: ", PluralCategory.FEW,
PluralCategory.fromIdentifier("few"));
assertEquals("test from identifier: ", PluralCategory.MANY,
PluralCategory.fromIdentifier("many"));
assertEquals("test from identifier: ", PluralCategory.OTHER,
PluralCategory.fromIdentifier("other"));
assertEquals("test from identifier: ", NounClass.UNDEFINED, NounClass.fromIdentifier(""));
assertEquals("test from identifier: ", NounClass.UNDEFINED,
NounClass.fromIdentifier("undefined"));
assertEquals("test from identifier: ", NounClass.OTHER, NounClass.fromIdentifier("other"));
assertEquals("test from identifier: ", NounClass.NEUTER,
NounClass.fromIdentifier("neuter"));
assertEquals("test from identifier: ", NounClass.FEMININE,
NounClass.fromIdentifier("feminine"));
assertEquals("test from identifier: ", NounClass.MASCULINE,
NounClass.fromIdentifier("masculine"));
assertEquals("test from identifier: ", NounClass.ANIMATE,
NounClass.fromIdentifier("animate"));
assertEquals("test from identifier: ", NounClass.INANIMATE,
NounClass.fromIdentifier("inanimate"));
assertEquals("test from identifier: ", NounClass.PERSONAL,
NounClass.fromIdentifier("personal"));
assertEquals("test from identifier: ", NounClass.COMMON,
NounClass.fromIdentifier("common"));
}
assertEquals("test from identifier: ", NounClass.UNDEFINED, NounClass.fromIdentifier(""));
assertEquals("test from identifier: ", NounClass.UNDEFINED,
NounClass.fromIdentifier("undefined"));
assertEquals("test from identifier: ", NounClass.OTHER, NounClass.fromIdentifier("other"));
assertEquals("test from identifier: ", NounClass.NEUTER,
NounClass.fromIdentifier("neuter"));
assertEquals("test from identifier: ", NounClass.FEMININE,
NounClass.fromIdentifier("feminine"));
assertEquals("test from identifier: ", NounClass.MASCULINE,
NounClass.fromIdentifier("masculine"));
assertEquals("test from identifier: ", NounClass.ANIMATE,
NounClass.fromIdentifier("animate"));
assertEquals("test from identifier: ", NounClass.INANIMATE,
NounClass.fromIdentifier("inanimate"));
assertEquals("test from identifier: ", NounClass.PERSONAL,
NounClass.fromIdentifier("personal"));
assertEquals("test from identifier: ", NounClass.COMMON,
NounClass.fromIdentifier("common"));
}
}