/********************************************************************
- * 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 */
#include "cmemory.h"
static void TestPluralRules(void);
+static void TestOrdinalRules(void);
void addPluralRulesTest(TestNode** root);
void addPluralRulesTest(TestNode** root)
{
TESTCASE(TestPluralRules);
+ TESTCASE(TestOrdinalRules);
}
typedef struct {
}
}
+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 */