From 7644adcaea843e53efc43778b7ac8e23d3c71214 Mon Sep 17 00:00:00 2001 From: Frank Tang Date: Tue, 6 Aug 2024 21:13:15 -0700 Subject: [PATCH] ICU-22848 Show the problem of infinity loop Add test to show very slow creation --- icu4c/source/test/intltest/rbbitst.cpp | 8 ++++++++ icu4c/source/test/intltest/rbbitst.h | 1 + 2 files changed, 9 insertions(+) diff --git a/icu4c/source/test/intltest/rbbitst.cpp b/icu4c/source/test/intltest/rbbitst.cpp index 3ccd4b5a14cc..6e54a3f02e5e 100644 --- a/icu4c/source/test/intltest/rbbitst.cpp +++ b/icu4c/source/test/intltest/rbbitst.cpp @@ -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); @@ -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; } + 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 diff --git a/icu4c/source/test/intltest/rbbitst.h b/icu4c/source/test/intltest/rbbitst.h index 9638caf6a277..0d69008673f7 100644 --- a/icu4c/source/test/intltest/rbbitst.h +++ b/icu4c/source/test/intltest/rbbitst.h @@ -106,6 +106,7 @@ class RBBITest: public IntlTest { void TestBug22585(); void TestBug22602(); void TestBug22636(); + void TestBug22848(); #if U_ENABLE_TRACING void TestTraceCreateCharacter();