X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/ba6d6ed23dec08b1cd5700a128c0752491c10ac9..51004dcb01e06fef634b61be77ed73dd61cb6db9:/icuSources/test/cintltst/cpluralrulestest.c diff --git a/icuSources/test/cintltst/cpluralrulestest.c b/icuSources/test/cintltst/cpluralrulestest.c index 7b12fadd..3f33d234 100644 --- a/icuSources/test/cintltst/cpluralrulestest.c +++ b/icuSources/test/cintltst/cpluralrulestest.c @@ -1,5 +1,5 @@ /******************************************************************** - * Copyright (c) 2011, International Business Machines Corporation + * Copyright (c) 2011-2012, International Business Machines Corporation * and others. All Rights Reserved. ********************************************************************/ /* C API TEST FOR PLURAL RULES */ @@ -14,6 +14,7 @@ #include "cmemory.h" static void TestPluralRules(void); +static void TestOrdinalRules(void); void addPluralRulesTest(TestNode** root); @@ -22,6 +23,7 @@ void addPluralRulesTest(TestNode** root); void addPluralRulesTest(TestNode** root) { TESTCASE(TestPluralRules); + TESTCASE(TestOrdinalRules); } typedef struct { @@ -89,4 +91,22 @@ static void TestPluralRules() } } +static void TestOrdinalRules() { + U_STRING_DECL(two, "two", 3); + UChar keyword[8]; + int32_t length; + UErrorCode errorCode = U_ZERO_ERROR; + UPluralRules* upr = uplrules_openForType("en", UPLURAL_TYPE_ORDINAL, &errorCode); + if (U_FAILURE(errorCode)) { + log_err("uplrules_openForType(en, ordinal) failed - %s\n", u_errorName(errorCode)); + return; + } + U_STRING_INIT(two, "two", 3); + length = uplrules_select(upr, 2., keyword, 8, &errorCode); + if (U_FAILURE(errorCode) || u_strCompare(keyword, length, two, 3, FALSE) != 0) { + log_data_err("uplrules_select(en-ordinal, 2) failed - %s\n", u_errorName(errorCode)); + } + uplrules_close(upr); +} + #endif /* #if !UCONFIG_NO_FORMATTING */