Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICU-22848 Add test for rbbi rule builder failure. #3089

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions icu4c/source/test/intltest/rbbitst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ void RBBITest::runIndexedTest( int32_t index, UBool exec, const char* &name, cha
TESTCASE_AUTO(TestBug22585);
TESTCASE_AUTO(TestBug22602);
TESTCASE_AUTO(TestBug22636);
TESTCASE_AUTO(TestBug22848);

#if U_ENABLE_TRACING
TESTCASE_AUTO(TestTraceCreateCharacter);
Expand Down Expand Up @@ -6133,6 +6134,13 @@ void RBBITest::TestBug22636() {
assertEquals(WHERE, ec, U_ZERO_ERROR);
}

void RBBITest::TestBug22848() {
if (quick || logKnownIssue("ICU-22848", "Very slow case")) { return; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend

  • reduce the number of dots in the pattern to the minimum that causes the failure (copy from bug report comment). This will dramatically speed up the test.
  • add an AssertSuccess after creating the bi. So the test will actually fail, and not just hang.
  • re-title the PR to something like "Add test for rbbi rule builder failure."

The test should fail -- when the state table max size is exceeded the ec will return a failure.

UParseError pe {};
UErrorCode ec {U_ZERO_ERROR};
RuleBasedBreakIterator bi(u".*X..................;", pe, ec);
}

void RBBITest::TestBug22584() {
// Creating a break iterator from a rule consisting of a very long
// literal input string caused a stack overflow when deleting the
Expand Down
1 change: 1 addition & 0 deletions icu4c/source/test/intltest/rbbitst.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class RBBITest: public IntlTest {
void TestBug22585();
void TestBug22602();
void TestBug22636();
void TestBug22848();

#if U_ENABLE_TRACING
void TestTraceCreateCharacter();
Expand Down