ICU-5045 tests for codes in iso 15924
X-SVN-Rev: 19106
This commit is contained in:
parent
d3ac526291
commit
3657fc5b7f
@ -1,6 +1,6 @@
|
||||
/********************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 1997-2005, International Business Machines Corporation and
|
||||
* Copyright (c) 1997-2006, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
#include "cintltst.h"
|
||||
#include "cucdapi.h"
|
||||
|
||||
#define ARRAY_SIZE(array) (int32_t)(sizeof array / sizeof array[0])
|
||||
|
||||
void TestUScriptCodeAPI(){
|
||||
int i =0;
|
||||
int numErrors =0;
|
||||
@ -280,7 +282,8 @@ void TestUScriptCodeAPI(){
|
||||
}
|
||||
}
|
||||
{
|
||||
for(i=0; (UScriptCode)i< USCRIPT_CODE_LIMIT; i++){
|
||||
for(i=0; (UScriptCode)i< USCRIPT_CODE_LIMIT && (UScriptCode)i == USCRIPT_UNICODE_LIMIT;
|
||||
i++){
|
||||
const char* name = uscript_getName((UScriptCode)i);
|
||||
if(name==NULL || strcmp(name,"")==0){
|
||||
log_err("uscript_getName failed for code : %i\n",i);
|
||||
@ -288,5 +291,39 @@ void TestUScriptCodeAPI(){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
static const char* expected[] = {
|
||||
"Bali", "Batk", "Blis", "Brah", "Cham", "Cirt", "Cyrs", "Egyd", "Egyh", "Egyp",
|
||||
"Geok", "Hans", "Hant", "Hmng", "Hung", "Inds", "Java", "Kali", "Latf", "Latg",
|
||||
"Lepc", "Lina", "Mand", "Maya", "Mero", "Nkoo", "Orkh", "Perm", "Phag", "Phnx",
|
||||
"Plrd", "Roro", "Sara", "Syre", "Syrj", "Syrn", "Teng", "Vaii", "Visp", "Xsux",
|
||||
"Zxxx", "Zzzz",
|
||||
};
|
||||
int32_t j = 0;
|
||||
for(i=USCRIPT_BALINESE; (UScriptCode)i<USCRIPT_CODE_LIMIT; i++, j++){
|
||||
const char* name = uscript_getName((UScriptCode)i);
|
||||
if(name==NULL || strcmp(name,expected[j])!=0){
|
||||
log_err("uscript_getName failed for code : %i\n",i);
|
||||
}
|
||||
name = uscript_getShortName((UScriptCode)i);
|
||||
if(name==NULL || strcmp(name,expected[j])!=0){
|
||||
log_err("uscript_getShortName failed for code : %i\n",i);
|
||||
}
|
||||
}
|
||||
for(i=0; i<ARRAY_SIZE(expected); i++){
|
||||
UScriptCode fillIn[5] = {USCRIPT_INVALID_CODE};
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
int32_t len = 0;
|
||||
len = uscript_getCode(expected[i], fillIn, ARRAY_SIZE(fillIn), &status);
|
||||
if(U_FAILURE(status)){
|
||||
log_err("uscript_getCode failed for script name %s. Error: %s\n",expected[i], u_errorName(status));
|
||||
}
|
||||
if(len>1){
|
||||
log_err("uscript_getCode did not return expected number of codes for script %s. EXPECTED: 1 GOT: %i\n", expected[i], len);
|
||||
}
|
||||
if(fillIn[0]!= (UScriptCode)(USCRIPT_BALINESE+i)){
|
||||
log_err("uscript_getCode did not return expected code for script %s. EXPECTED: %i GOT: %i\n", expected[i], (USCRIPT_BALINESE+i), fillIn[0] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/********************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 1997-2005, International Business Machines Corporation and
|
||||
* Copyright (c) 1997-2006, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
/********************************************************************************
|
||||
@ -2416,6 +2416,7 @@ TestAdditionalProperties() {
|
||||
UChar32 c;
|
||||
int32_t i, result, uVersion;
|
||||
UProperty which;
|
||||
int32_t n = 0xdeadbeef;
|
||||
|
||||
/* what is our Unicode version? */
|
||||
u_getUnicodeVersion(version);
|
||||
@ -2447,21 +2448,46 @@ TestAdditionalProperties() {
|
||||
) {
|
||||
log_err("error: u_getIntPropertyMinValue() wrong\n");
|
||||
}
|
||||
|
||||
if( u_getIntPropertyMaxValue(UCHAR_DASH)!=1 ||
|
||||
u_getIntPropertyMaxValue(UCHAR_ID_CONTINUE)!=1 ||
|
||||
u_getIntPropertyMaxValue(UCHAR_BINARY_LIMIT-1)!=1 ||
|
||||
u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)!=(int32_t)U_CHAR_DIRECTION_COUNT-1 ||
|
||||
u_getIntPropertyMaxValue(UCHAR_BLOCK)!=(int32_t)UBLOCK_COUNT-1 ||
|
||||
u_getIntPropertyMaxValue(UCHAR_LINE_BREAK)!=(int32_t)U_LB_COUNT-1 ||
|
||||
u_getIntPropertyMaxValue(UCHAR_SCRIPT)!=(int32_t)USCRIPT_CODE_LIMIT-1 ||
|
||||
u_getIntPropertyMaxValue(0x2345)!=-1 /*JB#2410*/ ||
|
||||
u_getIntPropertyMaxValue(UCHAR_DECOMPOSITION_TYPE) != (int32_t) (U_DT_COUNT - 1) ||
|
||||
u_getIntPropertyMaxValue(UCHAR_JOINING_GROUP) != (int32_t) (U_JG_COUNT -1) ||
|
||||
u_getIntPropertyMaxValue(UCHAR_JOINING_TYPE) != (int32_t) (U_JT_COUNT -1) ||
|
||||
u_getIntPropertyMaxValue(UCHAR_EAST_ASIAN_WIDTH) != (int32_t) (U_EA_COUNT -1)
|
||||
) {
|
||||
log_err("error: u_getIntPropertyMaxValue() wrong\n");
|
||||
n=0xdeadbeef;
|
||||
if( (n= u_getIntPropertyMaxValue(UCHAR_DASH))!=1) {
|
||||
log_err("error: u_getIntPropertyMaxValue(UCHAR_DASH) wrong\n");
|
||||
}
|
||||
if( u_getIntPropertyMaxValue(UCHAR_ID_CONTINUE)!=1) {
|
||||
log_err("error: u_getIntPropertyMaxValue(UCHAR_ID_CONTINUE) wrong\n");
|
||||
}
|
||||
n=0xdeadbeef;
|
||||
if( (n=u_getIntPropertyMaxValue(UCHAR_BINARY_LIMIT-1))!=1) {
|
||||
log_err("error: u_getIntPropertyMaxValue(UCHAR_BINARY_LIMIT-1) wrong\n");
|
||||
}
|
||||
if( u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)!=(int32_t)U_CHAR_DIRECTION_COUNT-1 ) {
|
||||
log_err("error: u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS) wrong\n");
|
||||
}
|
||||
if( u_getIntPropertyMaxValue(UCHAR_BLOCK)!=(int32_t)UBLOCK_COUNT-1 ) {
|
||||
log_err("error: u_getIntPropertyMaxValue(UCHAR_BLOCK) wrong\n");
|
||||
}
|
||||
if(u_getIntPropertyMaxValue(UCHAR_LINE_BREAK)!=(int32_t)U_LB_COUNT-1) {
|
||||
log_err("error: u_getIntPropertyMaxValue(UCHAR_LINE_BREAK) wrong\n");
|
||||
}
|
||||
n=0xdeadbeef;
|
||||
if( (n=u_getIntPropertyMaxValue(UCHAR_SCRIPT))!=(int32_t)USCRIPT_UNICODE_LIMIT-1) {
|
||||
log_err("error: u_getIntPropertyMaxValue(UCHAR_SCRIPT) wrong\n");
|
||||
}
|
||||
/*JB#2410*/
|
||||
n=0xdeadbeef;
|
||||
if( (n=u_getIntPropertyMaxValue(0x2345))!=-1) {
|
||||
log_err("error: u_getIntPropertyMaxValue(0x2345) wrong\n");
|
||||
}
|
||||
if( u_getIntPropertyMaxValue(UCHAR_DECOMPOSITION_TYPE) != (int32_t) (U_DT_COUNT - 1)) {
|
||||
log_err("error: u_getIntPropertyMaxValue(UCHAR_DECOMPOSITION_TYPE) wrong\n");
|
||||
}
|
||||
if( u_getIntPropertyMaxValue(UCHAR_JOINING_GROUP) != (int32_t) (U_JG_COUNT -1)) {
|
||||
log_err("error: u_getIntPropertyMaxValue(UCHAR_JOINING_GROUP) wrong\n");
|
||||
}
|
||||
if( u_getIntPropertyMaxValue(UCHAR_JOINING_TYPE) != (int32_t) (U_JT_COUNT -1)) {
|
||||
log_err("error: u_getIntPropertyMaxValue(UCHAR_JOINING_TYPE) wrong\n");
|
||||
}
|
||||
if( u_getIntPropertyMaxValue(UCHAR_EAST_ASIAN_WIDTH) != (int32_t) (U_EA_COUNT -1)) {
|
||||
log_err("error: u_getIntPropertyMaxValue(UCHAR_EAST_ASIAN_WIDTH) wrong\n");
|
||||
}
|
||||
|
||||
/* test u_hasBinaryProperty() and u_getIntPropertyValue() */
|
||||
|
Loading…
Reference in New Issue
Block a user