ICU-2085 Don't use deprecated code anymore
X-SVN-Rev: 9755
This commit is contained in:
parent
0e1a828f22
commit
56cbadb751
@ -12,7 +12,6 @@
|
||||
* Madhu Katragadda Ported for C API
|
||||
*********************************************************************************
|
||||
*//* C API TEST For COLLATOR */
|
||||
#include <stdio.h>
|
||||
#include "unicode/utypes.h"
|
||||
#include "ucol_imp.h"
|
||||
#include "unicode/uloc.h"
|
||||
@ -20,10 +19,13 @@
|
||||
#include "capitst.h"
|
||||
#include "unicode/ustring.h"
|
||||
#include "unicode/ures.h"
|
||||
#include "unicode/ucoleitr.h"
|
||||
#include "cmemory.h"
|
||||
#include "cstring.h"
|
||||
#include "ccolltst.h"
|
||||
#include <stdio.h>
|
||||
|
||||
static void TestAttribute(void);
|
||||
|
||||
void addCollAPITest(TestNode** root)
|
||||
{
|
||||
@ -42,6 +44,8 @@ void addCollAPITest(TestNode** root)
|
||||
addTest(root, &TestBounds, "tscoll/capitst/TestBounds");
|
||||
addTest(root, &TestGetLocale, "tscoll/capitst/TestGetLocale");
|
||||
addTest(root, &TestSortKeyBufferOverrun, "tscoll/capitst/TestSortKeyBufferOverrun");
|
||||
addTest(root, &TestAttribute, "tscoll/capitst/TestAttribute");
|
||||
|
||||
}
|
||||
|
||||
void TestGetSetAttr(void) {
|
||||
@ -178,6 +182,7 @@ void TestGetDefaultRules(){
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef U_USE_DEPRECATED_UCOL_API
|
||||
/*
|
||||
* Test ucol_openVersion for some locale. Called by TestProperty().
|
||||
*/
|
||||
@ -207,6 +212,7 @@ TestOpenVersion(const char *locale) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Collator Properties
|
||||
ucol_open, ucol_strcoll, getStrength/setStrength
|
||||
@ -289,11 +295,13 @@ void TestProperty()
|
||||
doAssert( (ucol_getStrength(col) != UCOL_PRIMARY), "collation object's strength is primary difference");
|
||||
doAssert( (ucol_getStrength(col) == UCOL_SECONDARY), "collation object has the wrong strength");
|
||||
|
||||
#ifdef ICU_NORMALIZER_USE_DEPRECATES
|
||||
log_verbose("testing ucol_setDecomposition() method ...\n");
|
||||
ucol_setNormalization(col, UNORM_NONE);
|
||||
doAssert( (ucol_getNormalization(col) != UNORM_NFC), "collation object's normalization mode is Canonical decomposition followed by canonical composition");
|
||||
doAssert( (ucol_getNormalization(col) != UNORM_NFD), "collation object's normalization mode is canonical decomposition");
|
||||
doAssert( (ucol_getNormalization(col) == UNORM_NONE), "collation object has the wrong normalization mode");
|
||||
#endif
|
||||
|
||||
|
||||
log_verbose("Get display name for the default collation in German : \n");
|
||||
@ -368,6 +376,7 @@ void TestProperty()
|
||||
}
|
||||
log_verbose("Default collation getDisplayName ended.\n");
|
||||
|
||||
#ifdef U_USE_DEPRECATED_UCOL_API
|
||||
/* test ucol_openVersion */
|
||||
TestOpenVersion("");
|
||||
TestOpenVersion("da");
|
||||
@ -384,6 +393,7 @@ void TestProperty()
|
||||
log_err("error: ucol_openVersion(bogus version) succeeded\n");
|
||||
ucol_close(col);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Test RuleBasedCollator and getRules*/
|
||||
@ -566,6 +576,27 @@ void TestDecomposition() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ucol_getAttribute(vi_VN, UCOL_NORMALIZATION_MODE, &status) != UCOL_ON ||
|
||||
U_FAILURE(status))
|
||||
{
|
||||
log_err("ERROR: vi_VN collation did not have cannonical decomposition for normalization!\n");
|
||||
}
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
if (ucol_getAttribute(el_GR, UCOL_NORMALIZATION_MODE, &status) != UCOL_ON ||
|
||||
U_FAILURE(status))
|
||||
{
|
||||
log_err("ERROR: el_GR collation did not have cannonical decomposition for normalization!\n");
|
||||
}
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
if (ucol_getAttribute(en_US, UCOL_NORMALIZATION_MODE, &status) != UCOL_OFF ||
|
||||
U_FAILURE(status))
|
||||
{
|
||||
log_err("ERROR: en_US collation had cannonical decomposition for normalization!\n");
|
||||
}
|
||||
|
||||
#ifdef ICU_NORMALIZER_USE_DEPRECATES
|
||||
/* there is no reason to have canonical decomposition in en_US OR default locale */
|
||||
if(ucol_getNormalization(vi_VN) != UNORM_NFD)
|
||||
{
|
||||
@ -581,6 +612,7 @@ void TestDecomposition() {
|
||||
{
|
||||
log_err("ERROR: en_US collation had cannonical decomposition for normalization!\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
ucol_close(en_US);
|
||||
ucol_close(el_GR);
|
||||
@ -658,7 +690,7 @@ void TestSafeClone() {
|
||||
if (col) ucol_close(col);
|
||||
/* size one byte too small - should allocate & let us know */
|
||||
--bufferSize;
|
||||
if (0 == (col = ucol_safeClone(someCollators[0], 0, &bufferSize, &err)) || err != U_SAFECLONE_ALLOCATED_ERROR)
|
||||
if (0 == (col = ucol_safeClone(someCollators[0], 0, &bufferSize, &err)) || err != U_SAFECLONE_ALLOCATED_WARNING)
|
||||
{
|
||||
log_err("FAIL: Cloned Collator failed to deal correctly with too-small buffer size\n");
|
||||
}
|
||||
@ -668,7 +700,7 @@ void TestSafeClone() {
|
||||
|
||||
|
||||
/* Null buffer pointer - return Collator & set error to U_SAFECLONE_ALLOCATED_ERROR */
|
||||
if (0 == (col = ucol_safeClone(someCollators[0], 0, &bufferSize, &err)) || err != U_SAFECLONE_ALLOCATED_ERROR)
|
||||
if (0 == (col = ucol_safeClone(someCollators[0], 0, &bufferSize, &err)) || err != U_SAFECLONE_ALLOCATED_WARNING)
|
||||
{
|
||||
log_err("FAIL: Cloned Collator failed to deal correctly with null buffer pointer\n");
|
||||
}
|
||||
@ -921,7 +953,7 @@ void TestElemIter()
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
log_verbose("testing UCollatorElements begins...\n");
|
||||
col = ucol_open("en_US", &status);
|
||||
ucol_setNormalization(col, UNORM_NONE);
|
||||
ucol_setAttribute(col, UCOL_NORMALIZATION_MODE, UCOL_OFF, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
log_err("ERROR: Default collation creation failed.: %s\n", myErrorName(status));
|
||||
return;
|
||||
@ -1363,3 +1395,105 @@ void TestSortKeyBufferOverrun(void) {
|
||||
ucol_close(coll);
|
||||
}
|
||||
|
||||
static void TestAttribute()
|
||||
{
|
||||
UErrorCode error = U_ZERO_ERROR;
|
||||
UCollator *coll = ucol_open(NULL, &error);
|
||||
|
||||
if (U_FAILURE(error)) {
|
||||
log_err("Creation of default collator failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ucol_setAttribute(coll, UCOL_FRENCH_COLLATION, UCOL_OFF, &error);
|
||||
if (ucol_getAttribute(coll, UCOL_FRENCH_COLLATION, &error) != UCOL_OFF ||
|
||||
U_FAILURE(error)) {
|
||||
log_err("Setting and retrieving of the french collation failed");
|
||||
}
|
||||
|
||||
ucol_setAttribute(coll, UCOL_FRENCH_COLLATION, UCOL_ON, &error);
|
||||
if (ucol_getAttribute(coll, UCOL_FRENCH_COLLATION, &error) != UCOL_ON ||
|
||||
U_FAILURE(error)) {
|
||||
log_err("Setting and retrieving of the french collation failed");
|
||||
}
|
||||
|
||||
ucol_setAttribute(coll, UCOL_ALTERNATE_HANDLING, UCOL_SHIFTED, &error);
|
||||
if (ucol_getAttribute(coll, UCOL_ALTERNATE_HANDLING, &error) != UCOL_SHIFTED ||
|
||||
U_FAILURE(error)) {
|
||||
log_err("Setting and retrieving of the alternate handling failed");
|
||||
}
|
||||
|
||||
ucol_setAttribute(coll, UCOL_ALTERNATE_HANDLING, UCOL_NON_IGNORABLE, &error);
|
||||
if (ucol_getAttribute(coll, UCOL_ALTERNATE_HANDLING, &error) != UCOL_NON_IGNORABLE ||
|
||||
U_FAILURE(error)) {
|
||||
log_err("Setting and retrieving of the alternate handling failed");
|
||||
}
|
||||
|
||||
ucol_setAttribute(coll, UCOL_CASE_FIRST, UCOL_LOWER_FIRST, &error);
|
||||
if (ucol_getAttribute(coll, UCOL_CASE_FIRST, &error) != UCOL_LOWER_FIRST ||
|
||||
U_FAILURE(error)) {
|
||||
log_err("Setting and retrieving of the case first attribute failed");
|
||||
}
|
||||
|
||||
ucol_setAttribute(coll, UCOL_CASE_FIRST, UCOL_UPPER_FIRST, &error);
|
||||
if (ucol_getAttribute(coll, UCOL_CASE_FIRST, &error) != UCOL_UPPER_FIRST ||
|
||||
U_FAILURE(error)) {
|
||||
log_err("Setting and retrieving of the case first attribute failed");
|
||||
}
|
||||
|
||||
ucol_setAttribute(coll, UCOL_CASE_LEVEL, UCOL_ON, &error);
|
||||
if (ucol_getAttribute(coll, UCOL_CASE_LEVEL, &error) != UCOL_ON ||
|
||||
U_FAILURE(error)) {
|
||||
log_err("Setting and retrieving of the case level attribute failed");
|
||||
}
|
||||
|
||||
ucol_setAttribute(coll, UCOL_CASE_LEVEL, UCOL_OFF, &error);
|
||||
if (ucol_getAttribute(coll, UCOL_CASE_LEVEL, &error) != UCOL_OFF ||
|
||||
U_FAILURE(error)) {
|
||||
log_err("Setting and retrieving of the case level attribute failed");
|
||||
}
|
||||
|
||||
ucol_setAttribute(coll, UCOL_NORMALIZATION_MODE, UCOL_ON, &error);
|
||||
if (ucol_getAttribute(coll, UCOL_NORMALIZATION_MODE, &error) != UCOL_ON ||
|
||||
U_FAILURE(error)) {
|
||||
log_err("Setting and retrieving of the normalization on/off attribute failed");
|
||||
}
|
||||
|
||||
ucol_setAttribute(coll, UCOL_NORMALIZATION_MODE, UCOL_OFF, &error);
|
||||
if (ucol_getAttribute(coll, UCOL_NORMALIZATION_MODE, &error) != UCOL_OFF ||
|
||||
U_FAILURE(error)) {
|
||||
log_err("Setting and retrieving of the normalization on/off attribute failed");
|
||||
}
|
||||
|
||||
ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_PRIMARY, &error);
|
||||
if (ucol_getAttribute(coll, UCOL_STRENGTH, &error) != UCOL_PRIMARY ||
|
||||
U_FAILURE(error)) {
|
||||
log_err("Setting and retrieving of the collation strength failed");
|
||||
}
|
||||
|
||||
ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_SECONDARY, &error);
|
||||
if (ucol_getAttribute(coll, UCOL_STRENGTH, &error) != UCOL_SECONDARY ||
|
||||
U_FAILURE(error)) {
|
||||
log_err("Setting and retrieving of the collation strength failed");
|
||||
}
|
||||
|
||||
ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_TERTIARY, &error);
|
||||
if (ucol_getAttribute(coll, UCOL_STRENGTH, &error) != UCOL_TERTIARY ||
|
||||
U_FAILURE(error)) {
|
||||
log_err("Setting and retrieving of the collation strength failed");
|
||||
}
|
||||
|
||||
ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_QUATERNARY, &error);
|
||||
if (ucol_getAttribute(coll, UCOL_STRENGTH, &error) != UCOL_QUATERNARY ||
|
||||
U_FAILURE(error)) {
|
||||
log_err("Setting and retrieving of the collation strength failed");
|
||||
}
|
||||
|
||||
ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_IDENTICAL, &error);
|
||||
if (ucol_getAttribute(coll, UCOL_STRENGTH, &error) != UCOL_IDENTICAL ||
|
||||
U_FAILURE(error)) {
|
||||
log_err("Setting and retrieving of the collation strength failed");
|
||||
}
|
||||
|
||||
ucol_close(coll);
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ static void TestBreakIteratorSafeClone(void)
|
||||
ubrk_close(brk);
|
||||
/* size one byte too small - should allocate & let us know */
|
||||
--bufferSize;
|
||||
if (0 == (brk = ubrk_safeClone(someIterators[i], 0, &bufferSize, &status)) || status != U_SAFECLONE_ALLOCATED_ERROR)
|
||||
if (0 == (brk = ubrk_safeClone(someIterators[i], 0, &bufferSize, &status)) || status != U_SAFECLONE_ALLOCATED_WARNING)
|
||||
{
|
||||
log_err("FAIL: Cloned Iterator failed to deal correctly with too-small buffer size\n");
|
||||
}
|
||||
@ -381,7 +381,7 @@ static void TestBreakIteratorSafeClone(void)
|
||||
bufferSize = U_BRK_SAFECLONE_BUFFERSIZE;
|
||||
|
||||
/* Null buffer pointer - return Iterator & set error to U_SAFECLONE_ALLOCATED_ERROR */
|
||||
if (0 == (brk = ubrk_safeClone(someIterators[i], 0, &bufferSize, &status)) || status != U_SAFECLONE_ALLOCATED_ERROR)
|
||||
if (0 == (brk = ubrk_safeClone(someIterators[i], 0, &bufferSize, &status)) || status != U_SAFECLONE_ALLOCATED_WARNING)
|
||||
{
|
||||
log_err("FAIL: Cloned Iterator failed to deal correctly with null buffer pointer\n");
|
||||
}
|
||||
@ -399,7 +399,7 @@ static void TestBreakIteratorSafeClone(void)
|
||||
if (U_FAILURE(status) || brk == 0) {
|
||||
log_err("FAIL: Cloned Iterator failed with misaligned buffer pointer\n");
|
||||
}
|
||||
if (status == U_SAFECLONE_ALLOCATED_ERROR) {
|
||||
if (status == U_SAFECLONE_ALLOCATED_WARNING) {
|
||||
log_err("FAIL: Cloned Iterator allocated when using a mis-aligned buffer.\n");
|
||||
}
|
||||
offset = (int32_t)((char *)&p-(char*)brk);
|
||||
|
@ -1546,7 +1546,7 @@ static void TestConvertSafeClone()
|
||||
ucnv_close(cnv);
|
||||
/* size one byte too small - should allocate & let us know */
|
||||
--bufferSize;
|
||||
if (0 == (cnv = ucnv_safeClone(someConverters[0], 0, &bufferSize, &err)) || err != U_SAFECLONE_ALLOCATED_ERROR)
|
||||
if (0 == (cnv = ucnv_safeClone(someConverters[0], 0, &bufferSize, &err)) || err != U_SAFECLONE_ALLOCATED_WARNING)
|
||||
{
|
||||
log_err("FAIL: Cloned converter failed to deal correctly with too-small buffer size\n");
|
||||
}
|
||||
@ -1556,7 +1556,7 @@ static void TestConvertSafeClone()
|
||||
bufferSize = U_CNV_SAFECLONE_BUFFERSIZE;
|
||||
|
||||
/* Null buffer pointer - return converter & set error to U_SAFECLONE_ALLOCATED_ERROR */
|
||||
if (0 == (cnv = ucnv_safeClone(someConverters[0], 0, &bufferSize, &err)) || err != U_SAFECLONE_ALLOCATED_ERROR)
|
||||
if (0 == (cnv = ucnv_safeClone(someConverters[0], 0, &bufferSize, &err)) || err != U_SAFECLONE_ALLOCATED_WARNING)
|
||||
{
|
||||
log_err("FAIL: Cloned converter failed to deal correctly with null buffer pointer\n");
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ static void TestTertiary( )
|
||||
return;
|
||||
}
|
||||
log_verbose("Testing German Collation with Tertiary strength\n");
|
||||
ucol_setNormalization(myCollation, UNORM_NFC);
|
||||
ucol_setAttribute(myCollation, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);
|
||||
ucol_setStrength(myCollation, UCOL_TERTIARY);
|
||||
for (i = 0; i < 12 ; i++)
|
||||
{
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "cintltst.h"
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/ucol.h"
|
||||
#include "unicode/ucoleitr.h"
|
||||
|
||||
#define MAX_TOKEN_LEN 16
|
||||
|
||||
|
@ -2196,7 +2196,7 @@ static void TestIncrementalNormalize(void) {
|
||||
strB = malloc((maxSLen+1) * sizeof(UChar));
|
||||
|
||||
coll = ucol_open("en_US", &status);
|
||||
ucol_setNormalization(coll, UNORM_NFD);
|
||||
ucol_setAttribute(coll, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);
|
||||
|
||||
/* for (sLen = 4; sLen<maxSLen; sLen++) { */
|
||||
for (sLen = 1000; sLen<1001; sLen++) {
|
||||
|
@ -136,13 +136,13 @@ void TestDecomp()
|
||||
for(x=0; x < ARRAY_LENGTH(canonTests); x++)
|
||||
{
|
||||
source=CharsToUChars(canonTests[x][0]);
|
||||
neededLen= unorm_normalize(source, u_strlen(source), UNORM_NFD, UCOL_IGNORE_HANGUL, NULL, 0, &status);
|
||||
neededLen= unorm_normalize(source, u_strlen(source), UNORM_NFD, 0, NULL, 0, &status);
|
||||
if(status==U_BUFFER_OVERFLOW_ERROR)
|
||||
{
|
||||
status=U_ZERO_ERROR;
|
||||
resLen=neededLen+1;
|
||||
result=(UChar*)malloc(sizeof(UChar*) * resLen);
|
||||
unorm_normalize(source, u_strlen(source), UNORM_NFD, UCOL_IGNORE_HANGUL, result, resLen, &status);
|
||||
unorm_normalize(source, u_strlen(source), UNORM_NFD, 0, result, resLen, &status);
|
||||
}
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR in unorm_normalize at %s: %s\n", austrdup(source), myErrorName(status) );
|
||||
@ -170,13 +170,13 @@ void TestCompatDecomp()
|
||||
for(x=0; x < ARRAY_LENGTH(compatTests); x++)
|
||||
{
|
||||
source=CharsToUChars(compatTests[x][0]);
|
||||
neededLen= unorm_normalize(source, u_strlen(source), UNORM_NFKD, UCOL_IGNORE_HANGUL, NULL, 0, &status);
|
||||
neededLen= unorm_normalize(source, u_strlen(source), UNORM_NFKD, 0, NULL, 0, &status);
|
||||
if(status==U_BUFFER_OVERFLOW_ERROR)
|
||||
{
|
||||
status=U_ZERO_ERROR;
|
||||
resLen=neededLen+1;
|
||||
result=(UChar*)malloc(sizeof(UChar*) * resLen);
|
||||
unorm_normalize(source, u_strlen(source), UNORM_NFKD,UCOL_IGNORE_HANGUL, result, resLen, &status);
|
||||
unorm_normalize(source, u_strlen(source), UNORM_NFKD, 0, result, resLen, &status);
|
||||
}
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR in unorm_normalize at %s: %s\n", austrdup(source), myErrorName(status) );
|
||||
@ -204,13 +204,13 @@ void TestCanonDecompCompose()
|
||||
for(x=0; x < ARRAY_LENGTH(canonTests); x++)
|
||||
{
|
||||
source=CharsToUChars(canonTests[x][0]);
|
||||
neededLen= unorm_normalize(source, u_strlen(source), UNORM_NFC, UCOL_IGNORE_HANGUL, NULL, 0, &status);
|
||||
neededLen= unorm_normalize(source, u_strlen(source), UNORM_NFC, 0, NULL, 0, &status);
|
||||
if(status==U_BUFFER_OVERFLOW_ERROR)
|
||||
{
|
||||
status=U_ZERO_ERROR;
|
||||
resLen=neededLen+1;
|
||||
result=(UChar*)malloc(sizeof(UChar*) * resLen);
|
||||
unorm_normalize(source, u_strlen(source), UNORM_NFC, UCOL_IGNORE_HANGUL, result, resLen, &status);
|
||||
unorm_normalize(source, u_strlen(source), UNORM_NFC, 0, result, resLen, &status);
|
||||
}
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR in unorm_normalize at %s: %s\n", austrdup(source),myErrorName(status) );
|
||||
@ -238,13 +238,13 @@ void TestCompatDecompCompose()
|
||||
for(x=0; x < ARRAY_LENGTH(compatTests); x++)
|
||||
{
|
||||
source=CharsToUChars(compatTests[x][0]);
|
||||
neededLen= unorm_normalize(source, u_strlen(source), UNORM_NFKC, UCOL_IGNORE_HANGUL, NULL, 0, &status);
|
||||
neededLen= unorm_normalize(source, u_strlen(source), UNORM_NFKC, 0, NULL, 0, &status);
|
||||
if(status==U_BUFFER_OVERFLOW_ERROR)
|
||||
{
|
||||
status=U_ZERO_ERROR;
|
||||
resLen=neededLen+1;
|
||||
result=(UChar*)malloc(sizeof(UChar*) * resLen);
|
||||
unorm_normalize(source, u_strlen(source), UNORM_NFKC, UCOL_IGNORE_HANGUL, result, resLen, &status);
|
||||
unorm_normalize(source, u_strlen(source), UNORM_NFKC, 0, result, resLen, &status);
|
||||
}
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR in unorm_normalize at %s: %s\n", austrdup(source), myErrorName(status) );
|
||||
@ -709,7 +709,7 @@ void TestCheckFCD()
|
||||
while (size != 19) {
|
||||
data[size] = datachar[(rand() * 50) / RAND_MAX];
|
||||
log_verbose("0x%x", data[size]);
|
||||
normsize += unorm_normalize(data + size, 1, UNORM_NFD, UCOL_IGNORE_HANGUL,
|
||||
normsize += unorm_normalize(data + size, 1, UNORM_NFD, 0,
|
||||
norm + normsize, 100 - normsize, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
log_err("unorm_quickCheck(FCD) failed: exception occured at data generation\n");
|
||||
@ -719,7 +719,7 @@ void TestCheckFCD()
|
||||
}
|
||||
log_verbose("\n");
|
||||
|
||||
nfdsize = unorm_normalize(data, size, UNORM_NFD, UCOL_IGNORE_HANGUL,
|
||||
nfdsize = unorm_normalize(data, size, UNORM_NFD, 0,
|
||||
nfd, 100, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
log_err("unorm_quickCheck(FCD) failed: exception occured at normalized data generation\n");
|
||||
|
@ -69,9 +69,9 @@ static struct
|
||||
{ "root", U_ZERO_ERROR, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } },
|
||||
{ "te", U_ZERO_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } },
|
||||
{ "te_IN", U_ZERO_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } },
|
||||
{ "te_NE", U_USING_FALLBACK_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } },
|
||||
{ "te_IN_NE", U_USING_FALLBACK_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } },
|
||||
{ "ne", U_USING_DEFAULT_ERROR, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } }
|
||||
{ "te_NE", U_USING_FALLBACK_WARNING, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } },
|
||||
{ "te_IN_NE", U_USING_FALLBACK_WARNING, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } },
|
||||
{ "ne", U_USING_DEFAULT_WARNING, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } }
|
||||
};
|
||||
|
||||
static int32_t bundles_count = sizeof(param) / sizeof(param[0]);
|
||||
@ -87,11 +87,14 @@ void addResourceBundleTest(TestNode** root);
|
||||
void addResourceBundleTest(TestNode** root)
|
||||
{
|
||||
addTest(root, &TestConstruction1, "tsutil/crestst/TestConstruction1");
|
||||
addTest(root, &TestConstruction2, "tsutil/crestst/TestConstruction2");
|
||||
addTest(root, &TestOpenDirect, "tsutil/crestst/TestOpenDirect");
|
||||
addTest(root, &TestResourceBundles, "tsutil/crestst/TestResourceBundle");
|
||||
addTest(root, &TestFallback, "tsutil/crestst/TestFallback");
|
||||
addTest(root, &TestAliasConflict, "tsutil/crestst/TestAliasConflict");
|
||||
|
||||
#ifdef ICU_URES_USE_DEPRECATES
|
||||
addTest(root, &TestConstruction2, "tsutil/crestst/TestConstruction2");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -136,6 +139,7 @@ void TestConstruction1()
|
||||
UResourceBundle *test1 = 0, *test2 = 0;
|
||||
const UChar *result1, *result2;
|
||||
int32_t resultLen;
|
||||
UChar temp[7];
|
||||
|
||||
UErrorCode err = U_ZERO_ERROR;
|
||||
const char* testdatapath ;
|
||||
@ -174,6 +178,31 @@ void TestConstruction1()
|
||||
return;
|
||||
}
|
||||
|
||||
u_uastrcpy(temp, "TE_IN");
|
||||
|
||||
if(u_strcmp(result2, temp)!=0)
|
||||
{
|
||||
int n;
|
||||
|
||||
log_err("Construction test failed for ures_open();\n");
|
||||
if(!VERBOSITY)
|
||||
log_info("(run verbose for more information)\n");
|
||||
|
||||
log_verbose("\nGot->");
|
||||
for(n=0;result2[n];n++)
|
||||
{
|
||||
log_verbose("%04X ",result2[n]);
|
||||
}
|
||||
log_verbose("<\n");
|
||||
|
||||
log_verbose("\nWant>");
|
||||
for(n=0;temp[n];n++)
|
||||
{
|
||||
log_verbose("%04X ",temp[n]);
|
||||
}
|
||||
log_verbose("<\n");
|
||||
|
||||
}
|
||||
|
||||
log_verbose("for string_in_Root_te_te_IN, default.txt had %s\n", austrdup(result1));
|
||||
log_verbose("for string_in_Root_te_te_IN, te_IN.txt had %s\n", austrdup(result2));
|
||||
@ -186,6 +215,7 @@ void TestConstruction1()
|
||||
ures_close(test2);
|
||||
}
|
||||
|
||||
#ifdef ICU_URES_USE_DEPRECATES
|
||||
void TestConstruction2()
|
||||
{
|
||||
int n;
|
||||
@ -244,6 +274,7 @@ void TestConstruction2()
|
||||
|
||||
ures_close(test4);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
@ -325,9 +356,9 @@ UBool testTag(const char* frag,
|
||||
if(j == actual_bundle) /* it's in the same bundle OR it's a nonexistent=default bundle (5) */
|
||||
expected_resource_status = U_ZERO_ERROR;
|
||||
else if(j == 0)
|
||||
expected_resource_status = U_USING_DEFAULT_ERROR;
|
||||
expected_resource_status = U_USING_DEFAULT_WARNING;
|
||||
else
|
||||
expected_resource_status = U_USING_FALLBACK_ERROR;
|
||||
expected_resource_status = U_USING_FALLBACK_WARNING;
|
||||
|
||||
log_verbose("%s[%d]::%s: in<%d:%s> inherits<%d:%s>. actual_bundle=%s\n",
|
||||
param[i].name,
|
||||
@ -458,7 +489,7 @@ static void TestFallback()
|
||||
|
||||
/* OK first one. This should be a Default value. */
|
||||
junk = ures_getStringByKey(fr_FR, "%%PREEURO", &resultLen, &status);
|
||||
if(status != U_USING_DEFAULT_ERROR)
|
||||
if(status != U_USING_DEFAULT_WARNING)
|
||||
{
|
||||
log_err("Expected U_USING_DEFAULT_ERROR when trying to get %%PREEURO from fr_FR, got %s\n",
|
||||
u_errorName(status));
|
||||
@ -468,7 +499,7 @@ static void TestFallback()
|
||||
|
||||
/* and this is a Fallback, to fr */
|
||||
junk = ures_getStringByKey(fr_FR, "DayNames", &resultLen, &status);
|
||||
if(status != U_USING_FALLBACK_ERROR)
|
||||
if(status != U_USING_FALLBACK_WARNING)
|
||||
{
|
||||
log_err("Expected U_USING_FALLBACK_ERROR when trying to get DayNames from fr_FR, got %s\n",
|
||||
u_errorName(status));
|
||||
@ -523,7 +554,7 @@ TestOpenDirect(void) {
|
||||
/* now make sure that "translit_index" will not work with ures_open() */
|
||||
errorCode=U_ZERO_ERROR;
|
||||
translit_index=ures_open(NULL, "translit_index", &errorCode);
|
||||
if(U_FAILURE(errorCode) || errorCode==U_USING_DEFAULT_ERROR || errorCode==U_USING_FALLBACK_ERROR) {
|
||||
if(U_FAILURE(errorCode) || errorCode==U_USING_DEFAULT_WARNING || errorCode==U_USING_FALLBACK_WARNING) {
|
||||
/* falling back to default or root is ok */
|
||||
errorCode=U_ZERO_ERROR;
|
||||
} else if(0!=uprv_strcmp("translit_INDEX", ures_getLocale(translit_index, &errorCode))) {
|
||||
|
@ -149,9 +149,9 @@ param[] =
|
||||
{ "root", U_ZERO_ERROR, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } },
|
||||
{ "te", U_ZERO_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } },
|
||||
{ "te_IN", U_ZERO_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } },
|
||||
{ "te_NE", U_USING_FALLBACK_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } },
|
||||
{ "te_IN_NE", U_USING_FALLBACK_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } },
|
||||
{ "ne", U_USING_DEFAULT_ERROR, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } }
|
||||
{ "te_NE", U_USING_FALLBACK_WARNING, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } },
|
||||
{ "te_IN_NE", U_USING_FALLBACK_WARNING, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } },
|
||||
{ "ne", U_USING_DEFAULT_WARNING, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } }
|
||||
};
|
||||
|
||||
static int32_t bundles_count = sizeof(param) / sizeof(param[0]);
|
||||
@ -168,7 +168,6 @@ void addNEWResourceBundleTest(TestNode** root)
|
||||
{
|
||||
addTest(root, &TestEmptyBundle, "tsutil/creststn/TestEmptyBundle");
|
||||
addTest(root, &TestConstruction1, "tsutil/creststn/TestConstruction1");
|
||||
addTest(root, &TestConstruction2, "tsutil/creststn/TestConstruction2");
|
||||
addTest(root, &TestResourceBundles, "tsutil/creststn/TestResourceBundle");
|
||||
addTest(root, &TestFallback, "tsutil/creststn/TestFallback");
|
||||
addTest(root, &TestGetVersion, "tsutil/creststn/TestGetVersion");
|
||||
@ -181,6 +180,10 @@ void addNEWResourceBundleTest(TestNode** root)
|
||||
addTest(root, &TestDecodedBundle, "tsutil/creststn/TestDecodedBundle");
|
||||
addTest(root, &TestResourceLevelAliasing, "tsutil/creststn/TestResourceLevelAliasing");
|
||||
addTest(root, &TestDirectAccess, "tsutil/creststn/TestDirectAccess");
|
||||
|
||||
#ifdef ICU_URES_USE_DEPRECATES
|
||||
addTest(root, &TestConstruction2, "tsutil/creststn/TestConstruction2");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -1134,6 +1137,7 @@ static void TestConstruction1()
|
||||
|
||||
}
|
||||
|
||||
#ifdef ICU_URES_USE_DEPRECATES
|
||||
static void TestConstruction2()
|
||||
{
|
||||
|
||||
@ -1184,6 +1188,7 @@ static void TestConstruction2()
|
||||
|
||||
ures_close(test4);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
@ -1266,9 +1271,9 @@ static UBool testTag(const char* frag,
|
||||
if(j == actual_bundle) /* it's in the same bundle OR it's a nonexistent=default bundle (5) */
|
||||
expected_resource_status = U_ZERO_ERROR;
|
||||
else if(j == 0)
|
||||
expected_resource_status = U_USING_DEFAULT_ERROR;
|
||||
expected_resource_status = U_USING_DEFAULT_WARNING;
|
||||
else
|
||||
expected_resource_status = U_USING_FALLBACK_ERROR;
|
||||
expected_resource_status = U_USING_FALLBACK_WARNING;
|
||||
|
||||
log_verbose("%s[%d]::%s: in<%d:%s> inherits<%d:%s>. actual_bundle=%s\n",
|
||||
param[i].name,
|
||||
@ -1653,7 +1658,7 @@ static void TestFallback()
|
||||
|
||||
/* OK first one. This should be a Default value. */
|
||||
junk = ures_getStringByKey(fr_FR, "%%PREEURO", &resultLen, &status);
|
||||
if(status != U_USING_DEFAULT_ERROR)
|
||||
if(status != U_USING_DEFAULT_WARNING)
|
||||
{
|
||||
log_err("Expected U_USING_DEFAULT_ERROR when trying to get %%PREEURO from fr_FR, got %s\n",
|
||||
u_errorName(status));
|
||||
@ -1663,7 +1668,7 @@ static void TestFallback()
|
||||
|
||||
/* and this is a Fallback, to fr */
|
||||
junk = ures_getStringByKey(fr_FR, "DayNames", &resultLen, &status);
|
||||
if(status != U_USING_FALLBACK_ERROR)
|
||||
if(status != U_USING_FALLBACK_WARNING)
|
||||
{
|
||||
log_err("Expected U_USING_FALLBACK_ERROR when trying to get DayNames from fr_FR, got %d\n",
|
||||
status);
|
||||
@ -1687,7 +1692,7 @@ static void TestFallback()
|
||||
log_err("Expected LocaleID=814, but got 0x%X\n", ures_getInt(resLocID, &err));
|
||||
}
|
||||
tResB = ures_getByKey(myResB, "DayNames", NULL, &err);
|
||||
if(err != U_USING_FALLBACK_ERROR){
|
||||
if(err != U_USING_FALLBACK_WARNING){
|
||||
log_err("Expected U_USING_FALLBACK_ERROR when trying to test no_NO_NY aliased with nn_NO_NY for DayNames err=%s\n",u_errorName(err));
|
||||
}
|
||||
ures_close(resLocID);
|
||||
|
@ -20,10 +20,6 @@
|
||||
*********************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef U_USE_DEPRECATED_FORMAT_API
|
||||
#define U_USE_DEPRECATED_FORMAT_API 1
|
||||
#endif
|
||||
|
||||
#include "unicode/unum.h"
|
||||
#include "unicode/ucol.h"
|
||||
#include "unicode/udat.h"
|
||||
@ -72,13 +68,18 @@ void addTestDeprecatedAPI(TestNode** root);
|
||||
void
|
||||
addTestDeprecatedAPI(TestNode** root)
|
||||
{
|
||||
#ifdef U_USE_DEPRECATED_UCOL_API
|
||||
addTest(root, &TestDeprecatedCollationAPI, "ctstdep/TestDeprecatedCollationAPI");
|
||||
#endif
|
||||
#ifdef U_USE_DEPRECATED_FORMAT_API
|
||||
addTest(root, &TestDeprecatedNumFmtAPI, "ctstdep/TestDeprecatedNumFmtAPI");
|
||||
addTest(root, &TestDeprecatedDateFmtAPI, "ctstdep/TestDeprecatedDateFmtAPI");
|
||||
addTest(root, &TestDeprecatedDateFmtAPI, "ctstdep/TestDeprecatedUErrorCode");
|
||||
addTest(root, &TestDeprecatedDateFmtAPI, "ctstdep/TestDeprecatedUCharScript");
|
||||
addTest(root, &TestDeprecatedUErrorCode, "ctstdep/TestDeprecatedUErrorCode");
|
||||
addTest(root, &TestDeprecatedUCharScript, "ctstdep/TestDeprecatedUCharScript");
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef U_USE_DEPRECATED_UCOL_API
|
||||
/*
|
||||
*TODO: The ucol_openRules method which does not take UParseError as one of its params
|
||||
* has been deprecated in 2.0 release.Please remove this API by 10/1/2002
|
||||
@ -141,7 +142,9 @@ TestDeprecatedCollationAPI(void)
|
||||
|
||||
ucol_close(coll);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef U_USE_DEPRECATED_FORMAT_API
|
||||
/*
|
||||
*TODO: The unum_open,unum_applyPattern, which does not take UParseError as one of their params
|
||||
*and unum_openPattern methods have been deprecated in 2.0 release.Please remove this API by 10/1/2002
|
||||
@ -513,3 +516,4 @@ TestDeprecatedUErrorCode(void){
|
||||
log_err("U_USING_FALLBACK_WARNING != U_USING_FALLBACK_ERROR");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -40,6 +40,9 @@ static void TestMisc(void);
|
||||
static void TestControlPrint(void);
|
||||
static void TestIdentifier(void);
|
||||
static void TestUnicodeData(void);
|
||||
static void TestCodeUnit(void);
|
||||
static void TestCodePoint(void);
|
||||
static void TestCharLength(void);
|
||||
static void TestStringCopy(void);
|
||||
static void TestStringFunctions(void);
|
||||
static void TestStringSearching(void);
|
||||
@ -126,6 +129,9 @@ void addUnicodeTest(TestNode** root);
|
||||
void addUnicodeTest(TestNode** root)
|
||||
{
|
||||
addTest(root, &TestUnicodeData, "tsutil/cucdtst/TestUnicodeData");
|
||||
addTest(root, &TestCodeUnit, "tsutil/cucdtst/TestCodeUnit");
|
||||
addTest(root, &TestCodePoint, "tsutil/cucdtst/TestCodePoint");
|
||||
addTest(root, &TestCharLength, "tsutil/cucdtst/TestCharLength");
|
||||
addTest(root, &TestAdditionalProperties, "tsutil/cucdtst/TestAdditionalProperties");
|
||||
addTest(root, &TestNumericProperties, "tsutil/cucdtst/TestNumericProperties");
|
||||
addTest(root, &TestUpperLower, "tsutil/cucdtst/TestUpperLower");
|
||||
@ -162,6 +168,20 @@ static void TestUpperLower()
|
||||
U_STRING_INIT(upperTest, "abcdefg123hij.?:klmno", 21);
|
||||
U_STRING_INIT(lowerTest, "ABCDEFG123HIJ.?:KLMNO", 21);
|
||||
|
||||
/*
|
||||
Checks LetterLike Symbols which were previously a source of confusion
|
||||
[Bertrand A. D. 02/04/98]
|
||||
*/
|
||||
for (i=0x2100;i<0x2138;i++)
|
||||
{
|
||||
if(i!=0x2126 && i!=0x212a && i!=0x212b)
|
||||
{
|
||||
if (i != (int)u_tolower(i)) /* itself */
|
||||
log_err("Failed case conversion with itself: \\u%4X\n", i);
|
||||
if (i != (int)u_toupper(i))
|
||||
log_err("Failed case conversion with itself: \\u%4X\n", i);
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0; i < u_strlen(upper); i++){
|
||||
if(u_tolower(upper[i]) != lower[i]){
|
||||
@ -857,6 +877,155 @@ static void TestUnicodeData()
|
||||
u_enumCharTypes(enumTypeRange, "a1");
|
||||
}
|
||||
|
||||
static void TestCodeUnit(){
|
||||
const UChar codeunit[]={0x0000,0xe065,0x20ac,0xd7ff,0xd800,0xd841,0xd905,0xdbff,0xdc00,0xdc02,0xddee,0xdfff,0};
|
||||
|
||||
int32_t i;
|
||||
|
||||
for(i=0; i<(int32_t)(sizeof(codeunit)/sizeof(codeunit[0])); i++){
|
||||
UChar c=codeunit[i];
|
||||
log_verbose("Testing code unit value of \\u%4X\n", c);
|
||||
if(i<4){
|
||||
if(!(UTF_IS_SINGLE(c)) || (UTF_IS_LEAD(c)) || (UTF_IS_TRAIL(c)) ||(UTF_IS_SURROGATE(c))){
|
||||
log_err("ERROR: \\u%4X is a single", c);
|
||||
}
|
||||
|
||||
}
|
||||
if(i >= 4 && i< 8){
|
||||
if(!(UTF_IS_LEAD(c)) || UTF_IS_SINGLE(c) || UTF_IS_TRAIL(c) || !(UTF_IS_SURROGATE(c))){
|
||||
log_err("ERROR: \\u%4X is a first surrogate", c);
|
||||
}
|
||||
}
|
||||
if(i >= 8 && i< 12){
|
||||
if(!(UTF_IS_TRAIL(c)) || UTF_IS_SINGLE(c) || UTF_IS_LEAD(c) || !(UTF_IS_SURROGATE(c))){
|
||||
log_err("ERROR: \\u%4X is a second surrogate", c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void TestCodePoint(){
|
||||
const UChar32 codePoint[]={
|
||||
/*surrogate, notvalid(codepoint), not a UnicodeChar, not Error */
|
||||
0xd800,
|
||||
0xdbff,
|
||||
0xdc00,
|
||||
0xdfff,
|
||||
0xdc04,
|
||||
0xd821,
|
||||
/*not a surrogate, valid, isUnicodeChar , not Error*/
|
||||
0x20ac,
|
||||
0xd7ff,
|
||||
0xe000,
|
||||
0xe123,
|
||||
0x0061,
|
||||
0xe065,
|
||||
0x20402,
|
||||
0x24506,
|
||||
0x23456,
|
||||
0x20402,
|
||||
0x10402,
|
||||
0x23456,
|
||||
/*not a surrogate, not valid, isUnicodeChar, isError */
|
||||
0x0015,
|
||||
0x009f,
|
||||
/*not a surrogate, not valid, not isUnicodeChar, isError */
|
||||
0xffff,
|
||||
0xfffe,
|
||||
};
|
||||
int32_t i;
|
||||
for(i=0; i<(int32_t)(sizeof(codePoint)/sizeof(codePoint[0])); i++){
|
||||
UChar32 c=codePoint[i];
|
||||
log_verbose("Testing code unit value of \\u%4X\n", c);
|
||||
if(i<6){
|
||||
if(!UTF_IS_SURROGATE(c)){
|
||||
log_err("ERROR: isSurrogate() failed for \\u%4X\n", c);
|
||||
}
|
||||
if(UTF_IS_VALID(c)){
|
||||
log_err("ERROR: isValid() failed for \\u%4X\n", c);
|
||||
}
|
||||
if(UTF_IS_UNICODE_CHAR(c)){
|
||||
log_err("ERROR: isUnicodeChar() failed for \\u%4X\n", c);
|
||||
}
|
||||
if(UTF_IS_ERROR(c)){
|
||||
log_err("ERROR: isError() failed for \\u%4X\n", c);
|
||||
}
|
||||
}else if(i >=6 && i<18){
|
||||
if(UTF_IS_SURROGATE(c)){
|
||||
log_err("ERROR: isSurrogate() failed for \\u%4X\n", c);
|
||||
}
|
||||
if(!UTF_IS_VALID(c)){
|
||||
log_err("ERROR: isValid() failed for \\u%4X\n", c);
|
||||
}
|
||||
if(!UTF_IS_UNICODE_CHAR(c)){
|
||||
log_err("ERROR: isUnicodeChar() failed for \\u%4X\n", c);
|
||||
}
|
||||
if(UTF_IS_ERROR(c)){
|
||||
log_err("ERROR: isError() failed for \\u%4X\n", c);
|
||||
}
|
||||
}else if(i >=18 && i<20){
|
||||
if(UTF_IS_SURROGATE(c)){
|
||||
log_err("ERROR: isSurrogate() failed for \\u%4X\n", c);
|
||||
}
|
||||
if(UTF_IS_VALID(c)){
|
||||
log_err("ERROR: isValid() failed for \\u%4X\n", c);
|
||||
}
|
||||
if(!UTF_IS_UNICODE_CHAR(c)){
|
||||
log_err("ERROR: isUnicodeChar() failed for \\u%4X\n", c);
|
||||
}
|
||||
if(!UTF_IS_ERROR(c)){
|
||||
log_err("ERROR: isError() failed for \\u%4X\n", c);
|
||||
}
|
||||
}
|
||||
else if(i >=18 && i<(int32_t)(sizeof(codePoint)/sizeof(codePoint[0]))){
|
||||
if(UTF_IS_SURROGATE(c)){
|
||||
log_err("ERROR: isSurrogate() failed for \\u%4X\n", c);
|
||||
}
|
||||
if(UTF_IS_VALID(c)){
|
||||
log_err("ERROR: isValid() failed for \\u%4X\n", c);
|
||||
}
|
||||
if(UTF_IS_UNICODE_CHAR(c)){
|
||||
log_err("ERROR: isUnicodeChar() failed for \\u%4X\n", c);
|
||||
}
|
||||
if(!UTF_IS_ERROR(c)){
|
||||
log_err("ERROR: isError() failed for \\u%4X\n", c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void TestCharLength()
|
||||
{
|
||||
const int32_t codepoint[]={
|
||||
1, 0x0061,
|
||||
1, 0xe065,
|
||||
1, 0x20ac,
|
||||
2, 0x20402,
|
||||
2, 0x23456,
|
||||
2, 0x24506,
|
||||
2, 0x20402,
|
||||
2, 0x10402,
|
||||
1, 0xd7ff,
|
||||
1, 0xe000
|
||||
};
|
||||
|
||||
int32_t i;
|
||||
UBool multiple;
|
||||
for(i=0; i<(int32_t)(sizeof(codepoint)/sizeof(codepoint[0])); i=(int16_t)(i+2)){
|
||||
UChar32 c=codepoint[i+1];
|
||||
if(UTF_CHAR_LENGTH(c) != codepoint[i]){
|
||||
log_err("The no: of code units for \\u%4X:- Expected: %d Got: %d", c, codepoint[i], UTF_CHAR_LENGTH(c));
|
||||
}else{
|
||||
log_verbose("The no: of code units for \\u%4X is %d", c, UTF_CHAR_LENGTH(c));
|
||||
}
|
||||
multiple=(UBool)(codepoint[i] == 1 ? FALSE : TRUE);
|
||||
if(UTF_NEED_MULTIPLE_UCHAR(c) != multiple){
|
||||
log_err("ERROR: Unicode::needMultipleUChar() failed for \\u%4X\n", c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*internal functions ----*/
|
||||
static int32_t MakeProp(char* str)
|
||||
|
@ -145,11 +145,14 @@ CollationAPITest::TestProperty(/* char* par */)
|
||||
doAssert((col->getStrength() != Collator::PRIMARY), "collation object's strength is primary difference");
|
||||
doAssert((col->getStrength() == Collator::SECONDARY), "collation object has the wrong strength");
|
||||
|
||||
#ifdef ICU_NORMALIZER_USE_DEPRECATES
|
||||
/* The replacement API is tested in TestAttribute() */
|
||||
logln("testing Collator::setDecomposition() method ...");
|
||||
col->setDecomposition(Normalizer::NO_OP);
|
||||
doAssert((col->getDecomposition() != Normalizer::DECOMP), "collation object's strength is secondary difference");
|
||||
doAssert((col->getDecomposition() != Normalizer::DECOMP_COMPAT), "collation object's strength is primary difference");
|
||||
doAssert((col->getDecomposition() == Normalizer::NO_OP), "collation object has the wrong strength");
|
||||
#endif
|
||||
|
||||
UnicodeString name;
|
||||
|
||||
@ -374,6 +377,7 @@ CollationAPITest::TestDecomposition() {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef ICU_NORMALIZER_USE_DEPRECATES
|
||||
/* there is no reason to have canonical decomposition in en_US OR default locale */
|
||||
if (vi_VN->getDecomposition() != Normalizer::DECOMP)
|
||||
{
|
||||
@ -389,6 +393,23 @@ CollationAPITest::TestDecomposition() {
|
||||
{
|
||||
errln("ERROR: en_US collation had cannonical decomposition for normalization!\n");
|
||||
}
|
||||
#else
|
||||
/* there is no reason to have canonical decomposition in en_US OR default locale */
|
||||
if (vi_VN->getAttribute(UCOL_NORMALIZATION_MODE, status) != UCOL_ON)
|
||||
{
|
||||
errln("ERROR: vi_VN collation did not have cannonical decomposition for normalization!\n");
|
||||
}
|
||||
|
||||
if (el_GR->getAttribute(UCOL_NORMALIZATION_MODE, status) != UCOL_ON)
|
||||
{
|
||||
errln("ERROR: el_GR collation did not have cannonical decomposition for normalization!\n");
|
||||
}
|
||||
|
||||
if (en_US->getAttribute(UCOL_NORMALIZATION_MODE, status) != UCOL_OFF)
|
||||
{
|
||||
errln("ERROR: en_US collation had cannonical decomposition for normalization!\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
delete en_US;
|
||||
delete el_GR;
|
||||
@ -859,13 +880,13 @@ CollationAPITest::TestOperators(/* char* par */)
|
||||
return;
|
||||
}
|
||||
success = U_ZERO_ERROR;
|
||||
RuleBasedCollator *col8 = new RuleBasedCollator(ruleset2, Normalizer::NO_OP, success);
|
||||
RuleBasedCollator *col8 = new RuleBasedCollator(ruleset2, UCOL_OFF, success);
|
||||
if (U_FAILURE(success)) {
|
||||
errln("The RuleBasedCollator constructor failed when building with the 2nd rule set with Normalizer::NO_OP.");
|
||||
return;
|
||||
}
|
||||
success = U_ZERO_ERROR;
|
||||
RuleBasedCollator *col9 = new RuleBasedCollator(ruleset2, Collator::PRIMARY, Normalizer::DECOMP_COMPAT, success);
|
||||
RuleBasedCollator *col9 = new RuleBasedCollator(ruleset2, Collator::PRIMARY, UCOL_ON, success);
|
||||
if (U_FAILURE(success)) {
|
||||
errln("The RuleBasedCollator constructor failed when building with the 2nd rule set with tertiary strength and Normalizer::NO_OP.");
|
||||
return;
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "biditst.h"
|
||||
#include "cmemory.h"
|
||||
|
||||
#ifdef ICU_UBIDI_USE_DEPRECATES
|
||||
static const char levelString[]="...............................................................";
|
||||
|
||||
static const char *dirPropNames[dirPropCount]={
|
||||
@ -910,3 +911,4 @@ void BiDiTest::runIndexedTest(int32_t index, UBool exec, const char *&name, char
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "unicode/uchar.h"
|
||||
#include "unicode/bidi.h"
|
||||
#include "intltest.h"
|
||||
#ifdef ICU_UBIDI_USE_DEPRECATES
|
||||
|
||||
#define MAX_STRING_LENGTH 200
|
||||
|
||||
@ -95,5 +96,6 @@ public:
|
||||
|
||||
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par = NULL */);
|
||||
};
|
||||
#endif /* ICU_UBIDI_USE_DEPRECATES */
|
||||
|
||||
#endif
|
||||
|
@ -661,7 +661,7 @@ CalendarTest::test4064654(int32_t yr, int32_t mo, int32_t dt, int32_t hr, int32_
|
||||
cal->get(Calendar::MONTH, status),
|
||||
cal->get(Calendar::DATE, status),
|
||||
(uint8_t)cal->get(Calendar::DAY_OF_WEEK, status),
|
||||
cal->get(Calendar::MILLISECOND, status));
|
||||
cal->get(Calendar::MILLISECOND, status), status);
|
||||
if (U_FAILURE(status)) { errln("Calendar::get failed"); return; }
|
||||
logln("offset for " + dateToString(date, str) + "= " + (offset / 1000 / 60 / 60.0) + "hr");
|
||||
int32_t utc = ((cal->get(Calendar::HOUR_OF_DAY, status) * 60 +
|
||||
|
@ -8,6 +8,9 @@
|
||||
* 03/09/2000 Madhu Creation.
|
||||
************************************************************************/
|
||||
|
||||
/* These APIs are becoming private */
|
||||
#define ICU_COMPOUNDTRANSLITERATOR_USE_DEPRECATES 1
|
||||
|
||||
#include "ittrans.h"
|
||||
#include "cpdtrtst.h"
|
||||
#include "unicode/utypes.h"
|
||||
|
@ -4,13 +4,14 @@
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cppcnvt.h"
|
||||
|
||||
#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES
|
||||
#include "unicode/locid.h"
|
||||
#include "unicode/unistr.h"
|
||||
#include "unicode/convert.h"
|
||||
#include "unicode/ucnv_err.h"
|
||||
#include "cppcnvt.h"
|
||||
#include "cstring.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#define NUM_CODEPAGE 1
|
||||
#define MAX_FILE_LEN 1024*20
|
||||
@ -36,6 +37,7 @@ void ConvertTest::runIndexedTest( int32_t index, UBool exec, const char* &name,
|
||||
}
|
||||
}
|
||||
|
||||
/* Test is also located in ccapitst.c */
|
||||
void ConvertTest::TestConvert()
|
||||
{
|
||||
char myptr[4];
|
||||
@ -677,6 +679,7 @@ UConverterToUCallback otherCharAction(UConverterToUCallback MIA)
|
||||
return (MIA==(UConverterToUCallback)UCNV_TO_U_CALLBACK_STOP)?(UConverterToUCallback)UCNV_TO_U_CALLBACK_SUBSTITUTE:(UConverterToUCallback)UCNV_TO_U_CALLBACK_STOP;
|
||||
}
|
||||
|
||||
/* Test is also located in nucnvtst.c */
|
||||
void ConvertTest::TestAmbiguous()
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
@ -745,3 +748,4 @@ void ConvertTest::TestAmbiguous()
|
||||
delete ascii_cnv;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
@ -5,7 +5,9 @@
|
||||
********************************************************************/
|
||||
|
||||
#include "intltest.h"
|
||||
#include "unicode/convert.h"
|
||||
|
||||
#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES
|
||||
/**
|
||||
* Test for APIs of CPPUnicodeConverter
|
||||
**/
|
||||
@ -22,6 +24,7 @@ public:
|
||||
void TestConvert(void);
|
||||
void TestAmbiguous(void);
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -123,8 +123,9 @@ void CollationGermanTest::TestTertiary(/* char* par */)
|
||||
}
|
||||
|
||||
int32_t i = 0;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
myCollation->setStrength(Collator::TERTIARY);
|
||||
myCollation->setDecomposition(Normalizer::COMPOSE_COMPAT);
|
||||
myCollation->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
|
||||
for (i = 0; i < 12 ; i++)
|
||||
{
|
||||
doTest(testSourceCases[i], testTargetCases[i], results[i][1]);
|
||||
@ -137,8 +138,9 @@ void CollationGermanTest::TestPrimary(/* char* par */)
|
||||
return;
|
||||
}
|
||||
int32_t i;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
myCollation->setStrength(Collator::PRIMARY);
|
||||
myCollation->setDecomposition(Normalizer::DECOMP);
|
||||
myCollation->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
|
||||
for (i = 0; i < 12 ; i++)
|
||||
{
|
||||
doTest(testSourceCases[i], testTargetCases[i], results[i][0]);
|
||||
|
@ -5,13 +5,13 @@
|
||||
********************************************************************/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "unicode/datefmt.h"
|
||||
#include "unicode/smpdtfmt.h"
|
||||
#include "unicode/gregocal.h"
|
||||
#include "dtfmtrtts.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
// *****************************************************************************
|
||||
// class DateFormatRoundTripTest
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "itconv.h"
|
||||
#include "cppcnvt.h"
|
||||
|
||||
#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES
|
||||
void IntlTestConvert::runIndexedTest( int32_t index, UBool exec, const char* &name, char* par )
|
||||
{
|
||||
if (exec) logln("TestSuite Convert: ");
|
||||
@ -39,3 +40,4 @@ void IntlTestConvert::runIndexedTest( int32_t index, UBool exec, const char* &na
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ICU_UNICODECONVERTER_USE_DEPRECATES */
|
||||
|
@ -12,13 +12,16 @@
|
||||
#define _INTLTESTCONVERT
|
||||
|
||||
|
||||
#include "cppcnvt.h"
|
||||
#include "intltest.h"
|
||||
|
||||
|
||||
#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES
|
||||
class IntlTestConvert: public IntlTest {
|
||||
public:
|
||||
virtual void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
|
||||
};
|
||||
#endif /* ICU_UNICODECONVERTER_USE_DEPRECATES */
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -407,7 +407,7 @@ void CollationIteratorTest::TestAssignment()
|
||||
}
|
||||
|
||||
source = CharsToUnicodeString("a\\u0300\\u0325");
|
||||
coll->setDecomposition(Normalizer::DECOMP);
|
||||
coll->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
|
||||
CollationElementIterator *iter4
|
||||
= coll->createCollationElementIterator(source);
|
||||
CollationElementIterator iter5(*iter4);
|
||||
|
@ -50,15 +50,7 @@ void MajorTestLevel::runIndexedTest( int32_t index, UBool exec, const char* &nam
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: name = "convert";
|
||||
if (exec) {
|
||||
logln("TestSuite Convert---"); logln();
|
||||
IntlTestConvert test;
|
||||
callTest( test, par );
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: name = "normalize";
|
||||
case 1: name = "normalize";
|
||||
if (exec) {
|
||||
logln("TestSuite Normalize---"); logln();
|
||||
IntlTestNormalize test;
|
||||
@ -66,7 +58,7 @@ void MajorTestLevel::runIndexedTest( int32_t index, UBool exec, const char* &nam
|
||||
}
|
||||
break;
|
||||
|
||||
case 3: name = "collate";
|
||||
case 2: name = "collate";
|
||||
if (exec) {
|
||||
logln("TestSuite Collator---"); logln();
|
||||
IntlTestCollator test;
|
||||
@ -74,7 +66,7 @@ void MajorTestLevel::runIndexedTest( int32_t index, UBool exec, const char* &nam
|
||||
}
|
||||
break;
|
||||
|
||||
case 4: name = "textbounds";
|
||||
case 3: name = "textbounds";
|
||||
if (exec) {
|
||||
logln("TestSuite TextBoundary---"); logln();
|
||||
IntlTestTextBoundary test;
|
||||
@ -82,7 +74,7 @@ void MajorTestLevel::runIndexedTest( int32_t index, UBool exec, const char* &nam
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: name = "format";
|
||||
case 4: name = "format";
|
||||
if (exec) {
|
||||
logln("TestSuite Format---"); logln();
|
||||
IntlTestFormat test;
|
||||
@ -90,7 +82,7 @@ void MajorTestLevel::runIndexedTest( int32_t index, UBool exec, const char* &nam
|
||||
}
|
||||
break;
|
||||
|
||||
case 6: name = "translit";
|
||||
case 5: name = "translit";
|
||||
if (exec) {
|
||||
logln("TestSuite Transliterator---"); logln();
|
||||
IntlTestTransliterator test;
|
||||
@ -98,21 +90,21 @@ void MajorTestLevel::runIndexedTest( int32_t index, UBool exec, const char* &nam
|
||||
}
|
||||
break;
|
||||
|
||||
case 7: name = "rbbi";
|
||||
case 6: name = "rbbi";
|
||||
if (exec) {
|
||||
logln("TestSuite RuleBasedBreakIterator---"); logln();
|
||||
IntlTestRBBI test;
|
||||
callTest( test, par );
|
||||
}
|
||||
break;
|
||||
case 8: name = "rbnf";
|
||||
case 7: name = "rbnf";
|
||||
if (exec) {
|
||||
logln("TestSuite RuleBasedNumberFormat----"); logln();
|
||||
IntlTestRBNF test;
|
||||
callTest(test, par);
|
||||
}
|
||||
break;
|
||||
case 9: name = "rbnfrt";
|
||||
case 8: name = "rbnfrt";
|
||||
if (exec) {
|
||||
logln("TestSuite RuleBasedNumberFormat RT----"); logln();
|
||||
RbnfRoundTripTest test;
|
||||
@ -120,6 +112,17 @@ void MajorTestLevel::runIndexedTest( int32_t index, UBool exec, const char* &nam
|
||||
}
|
||||
break;
|
||||
|
||||
/* Only the C API is exists */
|
||||
#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES
|
||||
case 9: name = "convert";
|
||||
if (exec) {
|
||||
logln("TestSuite Convert---"); logln();
|
||||
IntlTestConvert test;
|
||||
callTest( test, par );
|
||||
}
|
||||
break;
|
||||
#endif /* ICU_UNICODECONVERTER_USE_DEPRECATES */
|
||||
|
||||
default: name = ""; break;
|
||||
}
|
||||
}
|
||||
|
@ -739,16 +739,16 @@ void IntlTestTextBoundary::TestLineInvariants()
|
||||
UChar c1 = work[1] = dashes[j];
|
||||
for (k = 0; k < testCharsLen; k++) {
|
||||
UChar c2 = work[2] = testChars[k];
|
||||
int8_t type = Unicode::getType(c2);
|
||||
if (type == Unicode::DECIMAL_DIGIT_NUMBER ||
|
||||
type == Unicode::OTHER_NUMBER ||
|
||||
type == Unicode::NON_SPACING_MARK ||
|
||||
type == Unicode::ENCLOSING_MARK ||
|
||||
type == Unicode::CURRENCY_SYMBOL ||
|
||||
type == Unicode::SPACE_SEPARATOR ||
|
||||
type == Unicode::DASH_PUNCTUATION ||
|
||||
type == Unicode::CONTROL ||
|
||||
type == Unicode::FORMAT ||
|
||||
int8_t type = u_charType(c2);
|
||||
if (type == U_DECIMAL_DIGIT_NUMBER ||
|
||||
type == U_OTHER_NUMBER ||
|
||||
type == U_NON_SPACING_MARK ||
|
||||
type == U_ENCLOSING_MARK ||
|
||||
type == U_CURRENCY_SYMBOL ||
|
||||
type == U_SPACE_SEPARATOR ||
|
||||
type == U_DASH_PUNCTUATION ||
|
||||
type == U_CONTROL_CHAR ||
|
||||
type == U_FORMAT_CHAR ||
|
||||
c2 == '\n' || c2 == '\r' || c2 == 0x2028 || c2 == 0x2029 ||
|
||||
c2 == 0x0003 || c2 == 0x00a0 || c2 == 0x2007 || c2 == 0x2011 ||
|
||||
c2 == 0xfeff)
|
||||
@ -1626,9 +1626,9 @@ void IntlTestTextBoundary::doOtherInvariantTest(BreakIterator& tb, UnicodeString
|
||||
work[1] = c1;
|
||||
for (j = 0; j < testCharsLen; j++) {
|
||||
UChar c2 = testChars[j];
|
||||
type = Unicode::getType(c2);
|
||||
if ((type != Unicode::NON_SPACING_MARK) &&
|
||||
(type != Unicode::ENCLOSING_MARK)) {
|
||||
type = u_charType(c2);
|
||||
if ((type != U_NON_SPACING_MARK) &&
|
||||
(type != U_ENCLOSING_MARK)) {
|
||||
continue;
|
||||
}
|
||||
work[2] = c2;
|
||||
|
@ -121,6 +121,7 @@ void IntlTestUtilities::runIndexedTest( int32_t index, UBool exec, const char* &
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef ICU_UBIDI_USE_DEPRECATES
|
||||
case 10:
|
||||
name = "BiDiTest";
|
||||
if(exec){
|
||||
@ -129,7 +130,7 @@ void IntlTestUtilities::runIndexedTest( int32_t index, UBool exec, const char* &
|
||||
callTest(test,par);
|
||||
}
|
||||
break;
|
||||
|
||||
#endif
|
||||
/*
|
||||
case 8:
|
||||
name = "LocaleTest";
|
||||
|
@ -24,7 +24,7 @@ CollationKanaTest::CollationKanaTest()
|
||||
return;
|
||||
}
|
||||
|
||||
myCollation->setDecomposition(Normalizer::DECOMP);
|
||||
myCollation->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
|
||||
}
|
||||
|
||||
CollationKanaTest::~CollationKanaTest()
|
||||
|
@ -9,6 +9,10 @@
|
||||
* 03/01/2001 George port to HP/UX
|
||||
************************************************************************/
|
||||
|
||||
/* These APIs are becoming private */
|
||||
#define ICU_COMPOUNDTRANSLITERATOR_USE_DEPRECATES 1
|
||||
#define ICU_RULEBASEDTRANSLITERATOR_USE_DEPRECATES 1
|
||||
|
||||
#include "jamotest.h"
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/translit.h"
|
||||
|
@ -28,7 +28,7 @@ LotusCollationKoreanTest::LotusCollationKoreanTest()
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
myCollation = Collator::createInstance("ko_kr", status);
|
||||
myCollation->setDecomposition(Normalizer::DECOMP);
|
||||
myCollation->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
|
||||
}
|
||||
|
||||
LotusCollationKoreanTest::~LotusCollationKoreanTest()
|
||||
|
@ -137,7 +137,8 @@ void CollationRegressionTest::Test4054238(/* char* par */)
|
||||
|
||||
// NOTE: The Java code uses en_us to create the CollationElementIterators
|
||||
// but I'm pretty sure that's wrong, so I've changed this to use c.
|
||||
c->setDecomposition(Normalizer::DECOMP);
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
|
||||
CollationElementIterator *i1 = c->createCollationElementIterator(test3);
|
||||
delete i1;
|
||||
delete c;
|
||||
@ -173,11 +174,12 @@ void CollationRegressionTest::Test4054734(/* char* par */)
|
||||
};
|
||||
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone();
|
||||
|
||||
c->setStrength(Collator::IDENTICAL);
|
||||
|
||||
c->setDecomposition(Normalizer::DECOMP);
|
||||
c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
|
||||
compareArray(*c, decomp, ARRAY_LENGTH(decomp));
|
||||
|
||||
delete c;
|
||||
@ -189,10 +191,11 @@ void CollationRegressionTest::Test4054734(/* char* par */)
|
||||
//
|
||||
void CollationRegressionTest::Test4054736(/* char* par */)
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone();
|
||||
|
||||
c->setStrength(Collator::SECONDARY);
|
||||
c->setDecomposition(Normalizer::DECOMP_COMPAT);
|
||||
c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
|
||||
|
||||
static const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN] =
|
||||
{
|
||||
@ -238,7 +241,7 @@ void CollationRegressionTest::Test4058613(/* char* par */)
|
||||
|
||||
// Since the fix to this bug was to turn off decomposition for Korean collators,
|
||||
// ensure that's what we got
|
||||
if (c->getDecomposition() != Normalizer::NO_OP)
|
||||
if (c->getAttribute(UCOL_NORMALIZATION_MODE, status) != UCOL_OFF)
|
||||
{
|
||||
errln("Decomposition is not set to NO_DECOMPOSITION for Korean collator");
|
||||
}
|
||||
@ -304,7 +307,7 @@ void CollationRegressionTest::Test4060154(/* char* par */)
|
||||
return;
|
||||
}
|
||||
|
||||
c->setDecomposition(Normalizer::DECOMP);
|
||||
c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
|
||||
|
||||
/*
|
||||
String[] tertiary = {
|
||||
@ -408,16 +411,17 @@ void CollationRegressionTest::Test4066189(/* char* par */)
|
||||
static const UChar chars2[] = {0x61, 0x0306, 0x0300, 0};
|
||||
const UnicodeString test1(chars1);
|
||||
const UnicodeString test2(chars2);
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
// NOTE: The java code used en_us to create the
|
||||
// CollationElementIterator's. I'm pretty sure that
|
||||
// was wrong, so I've change the code to use c1 and c2
|
||||
RuleBasedCollator *c1 = (RuleBasedCollator *) en_us->clone();
|
||||
c1->setDecomposition(Normalizer::DECOMP_COMPAT);
|
||||
c1->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
|
||||
CollationElementIterator *i1 = c1->createCollationElementIterator(test1);
|
||||
|
||||
RuleBasedCollator *c2 = (RuleBasedCollator *) en_us->clone();
|
||||
c2->setDecomposition(Normalizer::NO_OP);
|
||||
c2->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_OFF, status);
|
||||
CollationElementIterator *i2 = c2->createCollationElementIterator(test2);
|
||||
|
||||
assertEqual(*i1, *i2);
|
||||
@ -559,13 +563,14 @@ void CollationRegressionTest::Test4081866(/* char* par */)
|
||||
static const UChar s1[] = {0x41, 0x0300, 0x0316, 0x0327, 0x0315, 0};
|
||||
static const UChar s2[] = {0x41, 0x0327, 0x0316, 0x0315, 0x0300, 0};
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone();
|
||||
c->setStrength(Collator::TERTIARY);
|
||||
|
||||
// Now that the default collators are set to NO_DECOMPOSITION
|
||||
// (as a result of fixing bug 4114077), we must set it explicitly
|
||||
// when we're testing reordering behavior. -- lwerner, 5/5/98
|
||||
c->setDecomposition(Normalizer::DECOMP);
|
||||
c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
|
||||
|
||||
if (c->compare(s1,s2) != 0)
|
||||
{
|
||||
@ -744,6 +749,7 @@ void CollationRegressionTest::Test4103436(/* char* par */)
|
||||
//
|
||||
void CollationRegressionTest::Test4114076(/* char* par */)
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone();
|
||||
c->setStrength(Collator::TERTIARY);
|
||||
|
||||
@ -757,7 +763,7 @@ void CollationRegressionTest::Test4114076(/* char* par */)
|
||||
{0xd4db, 0}, {0x3d, 0}, {0x1111, 0x1171, 0x11b6, 0}
|
||||
};
|
||||
|
||||
c->setDecomposition(Normalizer::DECOMP);
|
||||
c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
|
||||
compareArray(*c, test1, ARRAY_LENGTH(test1));
|
||||
|
||||
// From UTR #15:
|
||||
@ -866,6 +872,7 @@ void CollationRegressionTest::Test4114077(/* char* par */)
|
||||
// Ensure that we get the same results with decomposition off
|
||||
// as we do with it on....
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone();
|
||||
c->setStrength(Collator::TERTIARY);
|
||||
|
||||
@ -879,7 +886,7 @@ void CollationRegressionTest::Test4114077(/* char* par */)
|
||||
{0x41, 0x0300, 0x0316, 0}, {0x3c, 0}, {0x41, 0x0316, 0x0300, 0} // No reordering --> unequal
|
||||
};
|
||||
|
||||
c->setDecomposition(Normalizer::NO_OP);
|
||||
c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_OFF, status);
|
||||
compareArray(*c, test1, ARRAY_LENGTH(test1));
|
||||
|
||||
static const UChar test2[][CollationRegressionTest::MAX_TOKEN_LEN] =
|
||||
@ -887,7 +894,7 @@ void CollationRegressionTest::Test4114077(/* char* par */)
|
||||
{0x41, 0x0300, 0x0316, 0}, {0x3d, 0}, {0x41, 0x0316, 0x0300, 0} // Reordering --> equal
|
||||
};
|
||||
|
||||
c->setDecomposition(Normalizer::DECOMP);
|
||||
c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
|
||||
compareArray(*c, test2, ARRAY_LENGTH(test2));
|
||||
|
||||
delete c;
|
||||
|
@ -103,9 +103,9 @@ param[] =
|
||||
{ "root", NULL, U_ZERO_ERROR, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } },
|
||||
{ "te", NULL, U_ZERO_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } },
|
||||
{ "te_IN", NULL, U_ZERO_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } },
|
||||
{ "te_NE", NULL, U_USING_FALLBACK_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } },
|
||||
{ "te_IN_NE", NULL, U_USING_FALLBACK_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } },
|
||||
{ "ne", NULL, U_USING_DEFAULT_ERROR, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } }
|
||||
{ "te_NE", NULL, U_USING_FALLBACK_WARNING, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } },
|
||||
{ "te_IN_NE", NULL, U_USING_FALLBACK_WARNING, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } },
|
||||
{ "ne", NULL, U_USING_DEFAULT_WARNING, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } }
|
||||
};
|
||||
|
||||
int32_t bundles_count = sizeof(param) / sizeof(param[0]);
|
||||
@ -358,9 +358,9 @@ ResourceBundleTest::testTag(const char* frag,
|
||||
if(j == actual_bundle) /* it's in the same bundle OR it's a nonexistent=default bundle (5) */
|
||||
expected_resource_status = U_ZERO_ERROR;
|
||||
else if(j == 0)
|
||||
expected_resource_status = U_USING_DEFAULT_ERROR;
|
||||
expected_resource_status = U_USING_DEFAULT_WARNING;
|
||||
else
|
||||
expected_resource_status = U_USING_FALLBACK_ERROR;
|
||||
expected_resource_status = U_USING_FALLBACK_WARNING;
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -102,9 +102,9 @@ param[] =
|
||||
{ "root", 0, U_ZERO_ERROR, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } },
|
||||
{ "te", 0, U_ZERO_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } },
|
||||
{ "te_IN", 0, U_ZERO_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } },
|
||||
{ "te_NE", 0, U_USING_FALLBACK_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } },
|
||||
{ "te_IN_NE", 0, U_USING_FALLBACK_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } },
|
||||
{ "ne", 0, U_USING_DEFAULT_ERROR, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } }
|
||||
{ "te_NE", 0, U_USING_FALLBACK_WARNING, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } },
|
||||
{ "te_IN_NE", 0, U_USING_FALLBACK_WARNING, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } },
|
||||
{ "ne", 0, U_USING_DEFAULT_WARNING, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } }
|
||||
};
|
||||
|
||||
static int32_t bundles_count = sizeof(param) / sizeof(param[0]);
|
||||
@ -631,9 +631,9 @@ NewResourceBundleTest::testTag(const char* frag,
|
||||
if(j == actual_bundle) /* it's in the same bundle OR it's a nonexistent=default bundle (5) */
|
||||
expected_resource_status = U_ZERO_ERROR;
|
||||
else if(j == 0)
|
||||
expected_resource_status = U_USING_DEFAULT_ERROR;
|
||||
expected_resource_status = U_USING_DEFAULT_WARNING;
|
||||
else
|
||||
expected_resource_status = U_USING_FALLBACK_ERROR;
|
||||
expected_resource_status = U_USING_FALLBACK_WARNING;
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -1401,7 +1401,7 @@ void StringSearchTest::TestContraction()
|
||||
UnicodeString rules;
|
||||
rules.setTo(temp, u_strlen(temp));
|
||||
RuleBasedCollator *collator = new RuleBasedCollator(rules,
|
||||
getECollationStrength(UCOL_TERTIARY), Normalizer::DECOMP, status);
|
||||
getECollationStrength(UCOL_TERTIARY), UCOL_ON, status);
|
||||
if (U_FAILURE(status)) {
|
||||
errln("Error opening collator %s", u_errorName(status));
|
||||
}
|
||||
@ -1440,7 +1440,7 @@ void StringSearchTest::TestIgnorable()
|
||||
int count = 0;
|
||||
RuleBasedCollator *collator = new RuleBasedCollator(rules,
|
||||
getECollationStrength(IGNORABLE[count].strength),
|
||||
Normalizer::DECOMP, status);
|
||||
UCOL_ON, status);
|
||||
if (U_FAILURE(status)) {
|
||||
errln("Error opening collator %s", u_errorName(status));
|
||||
return;
|
||||
@ -1681,7 +1681,7 @@ void StringSearchTest::TestCollatorCanonical()
|
||||
rules.setTo(temp, u_strlen(temp));
|
||||
RuleBasedCollator *tailored = new RuleBasedCollator(rules,
|
||||
getECollationStrength(COLLATORCANONICAL[1].strength),
|
||||
Normalizer::DECOMP, status);
|
||||
UCOL_ON, status);
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
errln("Error opening rule based collator %s", u_errorName(status));
|
||||
@ -1952,7 +1952,7 @@ void StringSearchTest::TestContractionCanonical()
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
RuleBasedCollator *collator = new RuleBasedCollator(rules,
|
||||
getECollationStrength(UCOL_TERTIARY), Normalizer::DECOMP, status);
|
||||
getECollationStrength(UCOL_TERTIARY), UCOL_ON, status);
|
||||
if (U_FAILURE(status)) {
|
||||
errln("Error opening collator %s", u_errorName(status));
|
||||
}
|
||||
|
@ -8,6 +8,10 @@
|
||||
* 1/03/2000 Madhu Creation.
|
||||
************************************************************************/
|
||||
|
||||
/* These APIs are becoming private */
|
||||
#define ICU_NULLTRANSLITERATOR_USE_DEPRECATES 1
|
||||
#define ICU_RULEBASEDTRANSLITERATOR_USE_DEPRECATES 1
|
||||
|
||||
#include "ittrans.h"
|
||||
#include "transapi.h"
|
||||
#include "unicode/utypes.h"
|
||||
|
@ -7,6 +7,13 @@
|
||||
* 11/10/99 aliu Creation.
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
/* These APIs are becoming private */
|
||||
#define ICU_COMPOUNDTRANSLITERATOR_USE_DEPRECATES 1
|
||||
#define ICU_NULLTRANSLITERATOR_USE_DEPRECATES 1
|
||||
#define ICU_RULEBASEDTRANSLITERATOR_USE_DEPRECATES 1
|
||||
#define ICU_UNICODETOHEXTRANSLITERATOR_USE_DEPRECATES 1
|
||||
|
||||
#include "transtst.h"
|
||||
#include "unicode/cpdtrans.h"
|
||||
#include "unicode/dtfmtsym.h"
|
||||
|
@ -13,6 +13,10 @@
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
/* These APIs are becoming private */
|
||||
#define ICU_RULEBASEDTRANSLITERATOR_USE_DEPRECATES 1
|
||||
#define ICU_UNICODETOHEXTRANSLITERATOR_USE_DEPRECATES 1
|
||||
|
||||
#include "ittrans.h"
|
||||
#include "trnserr.h"
|
||||
#include "unicode/utypes.h"
|
||||
|
@ -739,7 +739,8 @@ BasicNormalizerTest::TestNormalizerAPI() {
|
||||
}
|
||||
|
||||
// test setIndex()
|
||||
if(norm.setIndex(3)!=0x4e3d) {
|
||||
norm.setIndexOnly(3);
|
||||
if(norm.current()!=0x4e3d) {
|
||||
errln("error in Normalizer(CharacterIterator).setIndex(3)");
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,8 @@ TimeZoneBoundaryTest::verifyDST(UDate d, TimeZone* time_zone, UBool expUseDaylig
|
||||
int32_t offset = time_zone->getOffset((uint8_t)gc->get(gc->ERA, status),
|
||||
gc->get(gc->YEAR, status), gc->get(gc->MONTH, status),
|
||||
gc->get(gc->DAY_OF_MONTH, status), (uint8_t)gc->get(gc->DAY_OF_WEEK, status),
|
||||
((gc->get(gc->HOUR_OF_DAY, status) * 60 + gc->get(gc->MINUTE, status)) * 60 + gc->get(gc->SECOND, status)) * 1000 + gc->get(gc->MILLISECOND, status));
|
||||
((gc->get(gc->HOUR_OF_DAY, status) * 60 + gc->get(gc->MINUTE, status)) * 60 + gc->get(gc->SECOND, status)) * 1000 + gc->get(gc->MILLISECOND, status),
|
||||
status);
|
||||
if (failure(status, "GregorianCalendar::get")) return;
|
||||
if (offset == expDSTOffset) logln(UnicodeString("PASS: getOffset() = ") + (offset / ONE_HOUR));
|
||||
else errln(UnicodeString("FAIL: getOffset() = ") + (offset / ONE_HOUR) + "; expected " + (expDSTOffset / ONE_HOUR));
|
||||
|
@ -191,17 +191,18 @@ void TimeZoneRegressionTest:: Test4073215()
|
||||
* 1:00 AM STD = display name 1:00 AM ST
|
||||
*/
|
||||
void TimeZoneRegressionTest:: Test4084933() {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
TimeZone *tz = TimeZone::createTimeZone("PST");
|
||||
|
||||
int32_t offset1 = tz->getOffset(1,
|
||||
1997, Calendar::OCTOBER, 26, Calendar::SUNDAY, (2*60*60*1000));
|
||||
1997, Calendar::OCTOBER, 26, Calendar::SUNDAY, (2*60*60*1000), status);
|
||||
int32_t offset2 = tz->getOffset(1,
|
||||
1997, Calendar::OCTOBER, 26, Calendar::SUNDAY, (2*60*60*1000)-1);
|
||||
1997, Calendar::OCTOBER, 26, Calendar::SUNDAY, (2*60*60*1000)-1, status);
|
||||
|
||||
int32_t offset3 = tz->getOffset(1,
|
||||
1997, Calendar::OCTOBER, 26, Calendar::SUNDAY, (1*60*60*1000));
|
||||
1997, Calendar::OCTOBER, 26, Calendar::SUNDAY, (1*60*60*1000), status);
|
||||
int32_t offset4 = tz->getOffset(1,
|
||||
1997, Calendar::OCTOBER, 26, Calendar::SUNDAY, (1*60*60*1000)-1);
|
||||
1997, Calendar::OCTOBER, 26, Calendar::SUNDAY, (1*60*60*1000)-1, status);
|
||||
|
||||
/*
|
||||
* The following was added just for consistency. It shows that going *to* Daylight
|
||||
@ -209,21 +210,22 @@ void TimeZoneRegressionTest:: Test4084933() {
|
||||
*/
|
||||
|
||||
int32_t offset5 = tz->getOffset(1,
|
||||
1997, Calendar::APRIL, 6, Calendar::SUNDAY, (2*60*60*1000));
|
||||
1997, Calendar::APRIL, 6, Calendar::SUNDAY, (2*60*60*1000), status);
|
||||
int32_t offset6 = tz->getOffset(1,
|
||||
1997, Calendar::APRIL, 6, Calendar::SUNDAY, (2*60*60*1000)-1);
|
||||
1997, Calendar::APRIL, 6, Calendar::SUNDAY, (2*60*60*1000)-1, status);
|
||||
|
||||
int32_t offset7 = tz->getOffset(1,
|
||||
1997, Calendar::APRIL, 6, Calendar::SUNDAY, (1*60*60*1000));
|
||||
1997, Calendar::APRIL, 6, Calendar::SUNDAY, (1*60*60*1000), status);
|
||||
int32_t offset8 = tz->getOffset(1,
|
||||
1997, Calendar::APRIL, 6, Calendar::SUNDAY, (1*60*60*1000)-1);
|
||||
1997, Calendar::APRIL, 6, Calendar::SUNDAY, (1*60*60*1000)-1, status);
|
||||
|
||||
int32_t SToffset = (int32_t)(-8 * 60*60*1000L);
|
||||
int32_t DToffset = (int32_t)(-7 * 60*60*1000L);
|
||||
if (offset1 != SToffset || offset2 != SToffset ||
|
||||
offset3 != SToffset || offset4 != DToffset ||
|
||||
offset5 != DToffset || offset6 != SToffset ||
|
||||
offset7 != SToffset || offset8 != SToffset)
|
||||
offset7 != SToffset || offset8 != SToffset
|
||||
|| U_FAILURE(status))
|
||||
errln("Fail: TimeZone misbehaving");
|
||||
|
||||
delete tz;
|
||||
@ -426,7 +428,7 @@ void TimeZoneRegressionTest:: Test4126678()
|
||||
cal->set(1998 - 1900, Calendar::APRIL, 5, 10, 0);
|
||||
//Date dt = new Date(1998-1900, Calendar::APRIL, 5, 10, 0);
|
||||
|
||||
if (! tz->inDaylightTime(cal->getTime(status), status) || U_FAILURE(status))
|
||||
if (! tz->useDaylightTime() || U_FAILURE(status))
|
||||
errln("We're not in Daylight Savings Time and we should be.\n");
|
||||
|
||||
//cal.setTime(dt);
|
||||
@ -442,7 +444,7 @@ void TimeZoneRegressionTest:: Test4126678()
|
||||
cal->get(Calendar::DST_OFFSET, status);
|
||||
|
||||
failure(status, "cal->get");
|
||||
int32_t offset = tz->getOffset((uint8_t)era, year, month, day, (uint8_t)dayOfWeek, millis);
|
||||
int32_t offset = tz->getOffset((uint8_t)era, year, month, day, (uint8_t)dayOfWeek, millis, status);
|
||||
int32_t raw_offset = tz->getRawOffset();
|
||||
if (offset == raw_offset)
|
||||
errln("Offsets should not match when in DST");
|
||||
|
@ -267,7 +267,7 @@ TimeZoneTest::TestVariousAPI518()
|
||||
gc->setTime(d, status);
|
||||
if (U_FAILURE(status)) { errln("FAIL: GregorianCalendar::setTime failed"); return; }
|
||||
if (time_zone->getOffset(gc->AD, gc->get(gc->YEAR, status), gc->get(gc->MONTH, status),
|
||||
gc->get(gc->DAY_OF_MONTH, status), (uint8_t)gc->get(gc->DAY_OF_WEEK, status), 0) != - 7 * millisPerHour)
|
||||
gc->get(gc->DAY_OF_MONTH, status), (uint8_t)gc->get(gc->DAY_OF_WEEK, status), 0, status) != - 7 * millisPerHour)
|
||||
errln("FAIL: getOffset returned wrong value");
|
||||
if (U_FAILURE(status)) { errln("FAIL: GregorianCalendar::set failed"); return; }
|
||||
delete gc;
|
||||
|
@ -26,16 +26,18 @@ void UnicodeTest::runIndexedTest( int32_t index, UBool exec, const char* &name,
|
||||
{
|
||||
if (exec) logln("TestSuite UnicodeTest: ");
|
||||
switch (index) {
|
||||
case 0: name = "TestUpperLower"; if (exec) TestUpperLower(); break;
|
||||
case 1: name = "TestLetterNumber"; if (exec) TestLetterNumber(); break;
|
||||
case 2: name = "TestMisc"; if (exec) TestMisc(); break;
|
||||
case 3: name = "TestUnicodeData"; if (exec) TestUnicodeData(); break;
|
||||
case 4: name = "TestCodeUnit"; if(exec) TestCodeUnit(); break;
|
||||
case 5: name = "TestCodePoint"; if(exec) TestCodePoint(); break;
|
||||
case 6: name = "TestCharLength"; if(exec) TestCharLength(); break;
|
||||
case 7: name = "TestIdentifier"; if(exec) TestIdentifier(); break;
|
||||
case 8: name = "TestScript"; if(exec) TestScript(); break;
|
||||
case 9: name = "TestAdditionalProperties"; if(exec) TestAdditionalProperties(); break;
|
||||
case 0: name = "TestAdditionalProperties"; if(exec) TestAdditionalProperties(); break;
|
||||
#ifdef ICU_UNICODE_CLASS_USE_DEPRECATES
|
||||
case 1: name = "TestUpperLower"; if (exec) TestUpperLower(); break;
|
||||
case 2: name = "TestLetterNumber"; if (exec) TestLetterNumber(); break;
|
||||
case 3: name = "TestMisc"; if (exec) TestMisc(); break;
|
||||
case 4: name = "TestUnicodeData"; if (exec) TestUnicodeData(); break;
|
||||
case 5: name = "TestCodeUnit"; if(exec) TestCodeUnit(); break;
|
||||
case 6: name = "TestCodePoint"; if(exec) TestCodePoint(); break;
|
||||
case 7: name = "TestCharLength"; if(exec) TestCharLength(); break;
|
||||
case 8: name = "TestIdentifier"; if(exec) TestIdentifier(); break;
|
||||
case 9: name = "TestScript"; if(exec) TestScript(); break;
|
||||
#endif
|
||||
default: name = ""; break; //needed to end loop
|
||||
}
|
||||
}
|
||||
@ -44,6 +46,7 @@ void UnicodeTest::runIndexedTest( int32_t index, UBool exec, const char* &name,
|
||||
// private data used by the tests
|
||||
//====================================================
|
||||
|
||||
#ifdef ICU_UNICODE_CLASS_USE_DEPRECATES
|
||||
const UChar LAST_CHAR_CODE_IN_FILE = 0xFFFD;
|
||||
const char tagStrings[] = "MnMcMeNdNlNoZsZlZpCcCfCsCoCnLuLlLtLmLoPcPdPsPePoSmScSkSoPiPf";
|
||||
const int32_t tagValues[] =
|
||||
@ -728,6 +731,7 @@ void UnicodeTest::TestScript()
|
||||
errln("ERROR: Diffe rent Thai values in EUnicodeScript and UCharScript");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// test DerivedCoreProperties.txt -------------------------------------------
|
||||
|
||||
|
@ -11,6 +11,9 @@
|
||||
#ifndef UNITOHEXTRTST_H
|
||||
#define UNITOHEXTRTST_H
|
||||
|
||||
#define ICU_UNICODETOHEXTRANSLITERATOR_USE_DEPRECATES 1
|
||||
|
||||
|
||||
#include "unicode/translit.h"
|
||||
#include "unicode/unitohex.h"
|
||||
#include "intltest.h"
|
||||
|
@ -182,7 +182,7 @@ UnicodeSetTest::TestCategories(void) {
|
||||
set.applyPattern("[:L:]", status);
|
||||
if (U_FAILURE(status)) { errln("FAIL"); return; }
|
||||
for (i=0; i<0x200; ++i) {
|
||||
UBool l = Unicode::isLetter((UChar)i);
|
||||
UBool l = u_isalpha((UChar)i);
|
||||
if (l != set.contains(i)) {
|
||||
errln((UnicodeString)"FAIL: L contains " + (unsigned short)i + " = " +
|
||||
set.contains(i));
|
||||
@ -193,7 +193,7 @@ UnicodeSetTest::TestCategories(void) {
|
||||
set.applyPattern("[:Lu:]", status);
|
||||
if (U_FAILURE(status)) { errln("FAIL"); return; }
|
||||
for (i=0; i<0x200; ++i) {
|
||||
UBool lu = (Unicode::getType((UChar)i) == Unicode::UPPERCASE_LETTER);
|
||||
UBool lu = (u_charType((UChar)i) == U_UPPERCASE_LETTER);
|
||||
if (lu != set.contains(i)) {
|
||||
errln((UnicodeString)"FAIL: Lu contains " + (unsigned short)i + " = " +
|
||||
set.contains(i));
|
||||
@ -204,14 +204,14 @@ UnicodeSetTest::TestCategories(void) {
|
||||
void
|
||||
UnicodeSetTest::TestCloneEqualHash(void) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
int8_t category=Unicode::LOWERCASE_LETTER;
|
||||
int8_t category=U_LOWERCASE_LETTER;
|
||||
UnicodeSet *set1=new UnicodeSet(category, status); // :Ll: Letter, lowercase
|
||||
UnicodeSet *set1a=new UnicodeSet("[:Ll:]", status); // Letter, lowercase
|
||||
if (U_FAILURE(status)){
|
||||
errln((UnicodeString)"FAIL: Can't construst set with category->Ll");
|
||||
return;
|
||||
}
|
||||
category=Unicode::DECIMAL_DIGIT_NUMBER;
|
||||
category=U_DECIMAL_DIGIT_NUMBER;
|
||||
UnicodeSet *set2=new UnicodeSet(category, status); //Number, Decimal digit
|
||||
UnicodeSet *set2a=new UnicodeSet("[:Nd:]", status); //Number, Decimal digit
|
||||
if (U_FAILURE(status)){
|
||||
|
@ -1137,7 +1137,7 @@ UnicodeStringTest::TestStackAllocation()
|
||||
|
||||
// test the UChar32 constructor
|
||||
UnicodeString c32Test((UChar32)0x10ff2a);
|
||||
if( c32Test.length() != Unicode::charLength(0x10ff2a) ||
|
||||
if( c32Test.length() != UTF_CHAR_LENGTH(0x10ff2a) ||
|
||||
c32Test.char32At(c32Test.length() - 1) != 0x10ff2a
|
||||
) {
|
||||
errln("The UnicodeString(UChar32) constructor does not work with a 0x10ff2a filler");
|
||||
@ -1145,7 +1145,7 @@ UnicodeStringTest::TestStackAllocation()
|
||||
|
||||
// test the (new) capacity constructor
|
||||
UnicodeString capTest(5, (UChar32)0x2a, 5);
|
||||
if( capTest.length() != 5 * Unicode::charLength(0x2a) ||
|
||||
if( capTest.length() != 5 * UTF_CHAR_LENGTH(0x2a) ||
|
||||
capTest.char32At(0) != 0x2a ||
|
||||
capTest.char32At(4) != 0x2a
|
||||
) {
|
||||
@ -1153,7 +1153,7 @@ UnicodeStringTest::TestStackAllocation()
|
||||
}
|
||||
|
||||
capTest = UnicodeString(5, (UChar32)0x10ff2a, 5);
|
||||
if( capTest.length() != 5 * Unicode::charLength(0x10ff2a) ||
|
||||
if( capTest.length() != 5 * UTF_CHAR_LENGTH(0x10ff2a) ||
|
||||
capTest.char32At(0) != 0x10ff2a ||
|
||||
capTest.char32At(4) != 0x10ff2a
|
||||
) {
|
||||
|
Loading…
Reference in New Issue
Block a user