mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 15:42:14 +00:00
ICU-447 Additional tests for extended code coverage
X-SVN-Rev: 1663
This commit is contained in:
parent
4b0286defe
commit
9000a6f33a
1 changed files with 46 additions and 0 deletions
|
@ -53,7 +53,53 @@ TestChoiceFormat::TestSimpleExample( void )
|
|||
res2 = " ??? ";
|
||||
it_out << ix << " -> " << res1 << " -> " << res2 << endl;
|
||||
}
|
||||
//Testing ==operator
|
||||
const double filelimits[] = {0,1,2};
|
||||
const UnicodeString filepart[] = {"are no files","is one file","are {2} files"};
|
||||
ChoiceFormat* formnew=new ChoiceFormat(filelimits, filepart, 3);
|
||||
ChoiceFormat* formequal=new ChoiceFormat(limits, monthNames, 7);
|
||||
if(*formnew == *form){
|
||||
errln("ERROR: ==operator failed\n");
|
||||
}
|
||||
if(!(*form == *formequal)){
|
||||
errln("ERROR: ==operator failed\n");
|
||||
}
|
||||
delete formequal;
|
||||
|
||||
//Testing adoptChoices()
|
||||
formnew->adoptChoices(limits, monthNames, 7);
|
||||
if(!(*formnew == *form)){
|
||||
errln("ERROR: ==Operator or adoptChoices failed\n");
|
||||
}
|
||||
|
||||
//Testing getLimits()
|
||||
double *gotLimits=0;
|
||||
int32_t count=0;
|
||||
gotLimits=(double*)form->getLimits(count);
|
||||
if(count != 7){
|
||||
errln("getLimits didn't update the count correctly\n");
|
||||
}
|
||||
for(ix=0; ix<count; ix++){
|
||||
if(gotLimits[ix] != limits[ix]){
|
||||
errln((UnicodeString)"getLimits didn't get the limits correctly. Expected " + limits[ix] + " Got " + gotLimits[ix]);
|
||||
}
|
||||
}
|
||||
//Testing getFormat()
|
||||
count=0;
|
||||
UnicodeString *gotFormats=0;
|
||||
gotFormats=(UnicodeString*)form->getFormats(count);
|
||||
if(count != 7){
|
||||
errln("getFormats didn't update the count correctly\n");
|
||||
}
|
||||
for(ix=0; ix<count; ix++){
|
||||
if(gotFormats[ix] != monthNames[ix]){
|
||||
errln((UnicodeString)"getFormats didn't get the Formats correctly. Expected " + monthNames[ix] + " Got " + gotFormats[ix]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
delete form;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Reference in a new issue