ICU-1099 Test the change a bit more completely.
X-SVN-Rev: 5616
This commit is contained in:
parent
95abeb91e1
commit
b58c59045a
@ -218,7 +218,7 @@ static void TestMisc()
|
||||
const UChar sampleDefined[] = {0x523E, 0x4f88, 0xfffd};
|
||||
const UChar sampleBase[] = {0x0061, 0x0031, 0x03d2};
|
||||
const UChar sampleNonBase[] = {0x002B, 0x0020, 0x203B};
|
||||
const UChar sampleChars[] = {0x000a, 0x0045, 0x4e00, 0xDC00};
|
||||
const UChar sampleChars[] = {0x000a, 0x0045, 0x4e00, 0xDC00, 0xFFE8, 0xFFF0};
|
||||
const UChar sampleDigits[]= {0x0030, 0x0662, 0x0F23, 0x0ED5};
|
||||
const UChar sample2Digits[]= {0x3007, 0x4e00, 0x4e8c, 0x4e09, 0x56d8, 0x4e94, 0x516d, 0x4e03, 0x516b, 0x4e5d}; /*sp characters not in the proptable*/
|
||||
const UChar sampleNonDigits[] = {0x0010, 0x0041, 0x0122, 0x68FE};
|
||||
@ -241,7 +241,9 @@ static void TestMisc()
|
||||
const uint16_t sampleCellWidth[] = { ZERO_WIDTH,
|
||||
HALF_WIDTH,
|
||||
FULL_WIDTH,
|
||||
NEUTRAL};
|
||||
NEUTRAL,
|
||||
U_HALF_WIDTH,
|
||||
U_ZERO_WIDTH};
|
||||
int i;
|
||||
char icuVersion[U_MAX_VERSION_STRING_LENGTH];
|
||||
UVersionInfo realVersion;
|
||||
@ -279,7 +281,7 @@ static void TestMisc()
|
||||
log_err("Non-baseform char test error : %d or %d",(int32_t)sampleNonBase[i], (int32_t)sampleBase[i]);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < 5; i++) {
|
||||
log_verbose("Testing for charcellwidth\n");
|
||||
if (u_charCellWidth(sampleChars[i]) != sampleCellWidth[i])
|
||||
{
|
||||
|
@ -131,10 +131,10 @@ void
|
||||
TestChoiceFormat::TestComplexExample( void )
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
const double filelimits[] = {0,1,2};
|
||||
const UnicodeString filepart[] = {"are no files","is one file","are {2} files"};
|
||||
const double filelimits[] = {-1, 0,1,2};
|
||||
const UnicodeString filepart[] = {"are corrupted files", "are no files","is one file","are {2} files"};
|
||||
|
||||
ChoiceFormat* fileform = new ChoiceFormat( filelimits, filepart, 3);
|
||||
ChoiceFormat* fileform = new ChoiceFormat( filelimits, filepart, 4);
|
||||
|
||||
if (!fileform) {
|
||||
it_errln("*** test_complex_example fileform");
|
||||
@ -181,7 +181,7 @@ TestChoiceFormat::TestComplexExample( void )
|
||||
it_out << "MessageFormat toPattern: " << res1 << endl;
|
||||
fileform->toPattern( res1 );
|
||||
it_out << "ChoiceFormat toPattern: " << res1 << endl;
|
||||
if (res1 == "0.0#are no files|1.0#is one file|2.0#are {2} files") {
|
||||
if (res1 == "-1.0#are corrupted files|0.0#are no files|1.0#is one file|2.0#are {2} files") {
|
||||
it_out << "toPattern tested!" << endl;
|
||||
}else{
|
||||
it_errln("*** ChoiceFormat to Pattern result!");
|
||||
@ -190,6 +190,7 @@ TestChoiceFormat::TestComplexExample( void )
|
||||
FieldPosition fpos(0);
|
||||
|
||||
UnicodeString checkstr[] = {
|
||||
"There are corrupted files on Disk_A",
|
||||
"There are no files on Disk_A",
|
||||
"There is one file on Disk_A",
|
||||
"There are 2 files on Disk_A",
|
||||
@ -207,7 +208,8 @@ TestChoiceFormat::TestComplexExample( void )
|
||||
|
||||
|
||||
int32_t i;
|
||||
for (i = 0; i < 4; ++i) {
|
||||
int32_t start = -1;
|
||||
for (i = start; i < 4; ++i) {
|
||||
str = "";
|
||||
status = U_ZERO_ERROR;
|
||||
testArgs[0] = Formattable((int32_t)i);
|
||||
@ -220,7 +222,7 @@ TestChoiceFormat::TestComplexExample( void )
|
||||
return;
|
||||
}
|
||||
it_out << i << " -> " << res2 << endl;
|
||||
if (res2 != checkstr[i]) {
|
||||
if (res2 != checkstr[i - start]) {
|
||||
it_errln("*** test_complex_example res string");
|
||||
it_out << "*** " << i << " -> '" << res2 << "' unlike '" << checkstr[i] << "' ! " << endl;
|
||||
}
|
||||
@ -231,20 +233,22 @@ TestChoiceFormat::TestComplexExample( void )
|
||||
//
|
||||
int32_t retCount;
|
||||
const double* retLimits = fileform->getLimits( retCount );
|
||||
if ((retCount == 3) && (retLimits)
|
||||
&& (retLimits[0] == 0.0)
|
||||
&& (retLimits[1] == 1.0)
|
||||
&& (retLimits[2] == 2.0)) {
|
||||
if ((retCount == 4) && (retLimits)
|
||||
&& (retLimits[0] == -1.0)
|
||||
&& (retLimits[1] == 0.0)
|
||||
&& (retLimits[2] == 1.0)
|
||||
&& (retLimits[3] == 2.0)) {
|
||||
it_out << "getLimits tested!" << endl;
|
||||
}else{
|
||||
it_errln("*** getLimits unexpected result!");
|
||||
}
|
||||
|
||||
const UnicodeString* retFormats = fileform->getFormats( retCount );
|
||||
if ((retCount == 3) && (retFormats)
|
||||
&& (retFormats[0] == "are no files")
|
||||
&& (retFormats[1] == "is one file")
|
||||
&& (retFormats[2] == "are {2} files")) {
|
||||
if ((retCount == 4) && (retFormats)
|
||||
&& (retFormats[0] == "are corrupted files")
|
||||
&& (retFormats[1] == "are no files")
|
||||
&& (retFormats[2] == "is one file")
|
||||
&& (retFormats[3] == "are {2} files")) {
|
||||
it_out << "getFormats tested!" << endl;
|
||||
}else{
|
||||
it_errln("*** getFormats unexpected result!");
|
||||
|
Loading…
Reference in New Issue
Block a user