Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2897)

Unified Diff: icu4c/source/test/intltest/rbbimonkeytest.cpp

Issue 330940043: RBBI, add caching, remove reverse rules. Base URL: svn+ssh://source.icu-project.org/repos/icu/trunk/
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: icu4c/source/test/intltest/rbbimonkeytest.cpp
===================================================================
--- icu4c/source/test/intltest/rbbimonkeytest.cpp (revision 40432)
+++ icu4c/source/test/intltest/rbbimonkeytest.cpp (working copy)
@@ -667,6 +667,7 @@
testFollowing(status);
testPreceding(status);
testIsBoundary(status);
+ testIsBoundaryRandom(status);
if (fLoopCount < 0 && loopCount % 100 == 0) {
fprintf(stderr, ".");
@@ -802,6 +803,29 @@
checkResults("testForwards", FORWARD, status);
}
+void RBBIMonkeyImpl::testIsBoundaryRandom(UErrorCode &status) {
+ if (U_FAILURE(status)) {
+ return;
+ }
+ fBI->setText(fTestData->fString);
+
+ int stringLen = fTestData->fString.length();
+ for (int i=stringLen; i>=0; --i) {
+ int strIdx = fRandomGenerator() % stringLen;
+ if (fTestData->fExpectedBreaks.charAt(strIdx) != fBI->isBoundary(strIdx)) {
+ IntlTest::gTest->errln("%s:%d testIsBoundaryRandom failure at index %d. Parameters to reproduce: @rules=%s,seed=%u,loop=1,verbose ",
+ __FILE__, __LINE__, strIdx, fRuleFileName, fTestData->fRandomSeed);
+ if (fVerbose) {
+ fTestData->dump(i);
+ }
+ status = U_INVALID_STATE_ERROR;
+ break;
+ }
+ }
+}
+
+
+
void RBBIMonkeyImpl::checkResults(const char *msg, CheckDirection direction, UErrorCode &status) {
if (U_FAILURE(status)) {
return;

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b