code coverage updates

X-SVN-Rev: 10321
This commit is contained in:
Syn Wee Quek 2002-11-21 21:43:03 +00:00
parent 0740e8b325
commit 73b1097f53
4 changed files with 62 additions and 0 deletions

View File

@ -1706,6 +1706,42 @@ void CollationAPITest::TestGetTailoredSet()
}
}
void CollationAPITest::TestUClassID()
{
char id = *((char *)RuleBasedCollator::getStaticClassID());
if (id != 0) {
errln("Static class id for RuleBasedCollator should be 0");
}
UErrorCode status = U_ZERO_ERROR;
RuleBasedCollator *coll
= (RuleBasedCollator *)Collator::createInstance(status);
id = *((char *)coll->getDynamicClassID());
if (id != 0) {
errln("Dynamic class id for RuleBasedCollator should be 0");
}
id = *((char *)CollationKey::getStaticClassID());
if (id != 0) {
errln("Static class id for CollationKey should be 0");
}
CollationKey *key = new CollationKey();
id = *((char *)key->getDynamicClassID());
if (id != 0) {
errln("Dynamic class id for CollationKey should be 0");
}
id = *((char *)CollationElementIterator::getStaticClassID());
if (id != 0) {
errln("Static class id for CollationElementIterator should be 0");
}
UnicodeString str("testing");
CollationElementIterator *iter = coll->createCollationElementIterator(str);
id = *((char *)iter->getDynamicClassID());
if (id != 0) {
errln("Dynamic class id for CollationElementIterator should be 0");
}
delete iter;
delete coll;
}
void CollationAPITest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par */)
{
if (exec) logln("TestSuite CollationAPITest: ");
@ -1730,6 +1766,7 @@ void CollationAPITest::runIndexedTest( int32_t index, UBool exec, const char* &n
case 17: name = "TestGetLocale"; if (exec) TestGetLocale(); break;
case 18: name = "TestBounds"; if (exec) TestBounds(); break;
case 19: name = "TestGetTailoredSet"; if (exec) TestGetTailoredSet(); break;
case 20: name = "TestUClassID"; if (exec) TestUClassID(); break;
default: name = ""; break;
}
}

View File

@ -149,6 +149,11 @@ public:
*/
void TestGetTailoredSet();
/**
* Tests the dynamic and static ids of collation classes
*/
void TestUClassID();
private:
// If this is too small for the test data, just increase it.
// Just don't make it too large, otherwise the executable will get too big

View File

@ -135,6 +135,7 @@ void StringSearchTest::runIndexedTest(int32_t index, UBool exec,
CASE(31, TestSupplementaryCanonical)
CASE(32, TestContractionCanonical)
CASE(33, TestSearchIterator)
CASE(34, TestUClassID)
default: name = ""; break;
}
}
@ -2165,4 +2166,22 @@ void StringSearchTest::TestSearchIterator()
}
}
void StringSearchTest::TestUClassID()
{
char id = *((char *)StringSearch::getStaticClassID());
if (id != 0) {
errln("Static class id for StringSearch should be 0");
}
UErrorCode status = U_ZERO_ERROR;
UnicodeString text("text");
UnicodeString pattern("pattern");
StringSearch *strsrch = new StringSearch(pattern, text, m_en_us_, NULL,
status);
id = *((char *)strsrch->getDynamicClassID());
if (id != 0) {
errln("Dynamic class id for StringSearch should be 0");
}
delete strsrch;
}
#endif /* #if !UCONFIG_NO_COLLATION */

View File

@ -86,6 +86,7 @@ private:
void TestSupplementaryCanonical();
void TestContractionCanonical();
void TestSearchIterator();
void TestUClassID();
};
#endif /* #if !UCONFIG_NO_COLLATION */