ICU-105 Regular Expressions, Add tests for improved API code coverage

X-SVN-Rev: 10308
This commit is contained in:
Andy Heninger 2002-11-21 00:49:52 +00:00
parent f8be29dfa1
commit b029ea78a7
2 changed files with 27 additions and 4 deletions

View File

@ -47,10 +47,6 @@ RegexMatcher::RegexMatcher(const RegexPattern *pat) {
}
RegexMatcher::RegexMatcher(const RegexMatcher &other) {
U_ASSERT(FALSE);
}
RegexMatcher::~RegexMatcher() {
delete fBackTrackStack;

View File

@ -1024,6 +1024,33 @@ void RegexTest::API_Pattern() {
REGEX_ASSERT(fields[3]==",");
REGEX_ASSERT(fields[4]=="20");
delete pat1;
//
// RegexPattern::pattern()
//
pat1 = new RegexPattern();
REGEX_ASSERT(pat1->pattern() == "");
delete pat1;
pat1 = RegexPattern::compile("(Hello, world)*", pe, status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(pat1->pattern() == "(Hello, world)*");
delete pat1;
//
// classID functions
//
pat1 = RegexPattern::compile("(Hello, world)*", pe, status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(pat1->getDynamicClassID() == RegexPattern::getStaticClassID());
REGEX_ASSERT(pat1->getDynamicClassID() != NULL);
RegexMatcher *m = pat1->matcher("Hello, World", status);
REGEX_ASSERT(pat1->getDynamicClassID() != m->getDynamicClassID());
REGEX_ASSERT(m->getDynamicClassID() == RegexMatcher::getStaticClassID());
REGEX_ASSERT(m->getDynamicClassID() != NULL);
}