ICU-6991 Code coverage for missing functions in NumberingSystem and Collator.

X-SVN-Rev: 26606
This commit is contained in:
John Vu 2009-09-04 22:14:57 +00:00
parent 05d0e02083
commit d617aa5932
2 changed files with 30 additions and 3 deletions

View file

@ -111,13 +111,17 @@ CollationAPITest::TestProperty(/* char* par */)
logln("The property tests begin : ");
logln("Test ctors : ");
col = Collator::createInstance(Locale::getEnglish(), success);
if (U_FAILURE(success))
{
if (U_FAILURE(success)){
errcheckln(success, "Default Collator creation failed. - %s", u_errorName(success));
return;
}
col->getKeywordValuesForLocale("", Locale::getEnglish(),true,success);
if (U_FAILURE(success)){
errcheckln(success, "Get Keyword Values for Locale failed. - %s", u_errorName(success));
return;
}
col->getVersion(versionArray);
for (i=0; i<4; ++i) {
if (versionArray[i] != currVersionArray[i]) {
@ -132,6 +136,7 @@ CollationAPITest::TestProperty(/* char* par */)
doAssert((col->compare("blackbird", "black-bird") == Collator::GREATER), "black-bird > blackbird comparison failed");
doAssert((col->compare("black bird", "black-bird") == Collator::LESS), "black bird > black-bird comparison failed");
doAssert((col->compare("Hello", "hello") == Collator::GREATER), "Hello > hello comparison failed");
doAssert((col->compare("","",success) == Collator::EQUAL), "Comparison between empty strings failed");
doAssert((col->compareUTF8("\x61\x62\xc3\xa4", "\x61\x62\xc3\x9f", success) == UCOL_LESS), "ab a-umlaut < ab sharp-s UTF-8 comparison failed");
success = U_ZERO_ERROR;

View file

@ -29,6 +29,7 @@
#include <string.h>
#include <stdlib.h>
#include "cstring.h"
#include "unicode/numsys.h"
//#define NUMFMTST_CACHE_DEBUG 1
#ifdef NUMFMTST_CACHE_DEBUG
@ -2688,6 +2689,27 @@ void NumberFormatTest::TestNumberingSystems() {
errln("FAIL: getInstance(en_US@numbers=foobar) should have returned U_UNSUPPORTED_ERROR");
}
NumberingSystem *ns = NumberingSystem::createInstance(ec);
if (U_FAILURE(ec)) {
dataerrln("FAIL: NumberingSystem::createInstance(ec); - %s", u_errorName(ec));
}
const NumberingSystem ns1 = NumberingSystem::NumberingSystem();
NumberingSystem::NumberingSystem(ns1);
if (U_FAILURE(ec)) {
dataerrln("FAIL: NumberingSystem::NumberingSystem(ns1); - %s", u_errorName(ec));
}
ns->getDynamicClassID();
if (U_FAILURE(ec)) {
dataerrln("FAIL: NumberingSystem::getDynamicClassID(); - %s", u_errorName(ec));
}
ns->getStaticClassID();
if (U_FAILURE(ec)) {
dataerrln("FAIL: NumberingSystem::getStaticClassID(); - %s", u_errorName(ec));
}
delete fmt1;
delete fmt2;
delete fmt3;