Skip to content

ICU-21006 Improve output from RBBI Monkey Test in ICU4J - #1023

Merged
FrankYFTang merged 1 commit into
unicode-org:masterfrom
FrankYFTang:ICU-21006
Mar 10, 2020
Merged

FrankYFTang merged 1 commit into
unicode-org:masterfrom
FrankYFTang:ICU-21006

Conversation

@FrankYFTang

Copy link
Copy Markdown
Contributor

Port the C++ changes in https://github.com/unicode-org/icu/pull/730/files
to Java.

Checklist

@FrankYFTang

FrankYFTang commented Mar 7, 2020 •

Copy link
Copy Markdown
Contributor Author

OK, here is the output I got by testing with

--- a/icu4c/source/data/brkitr/rules/word.txt
+++ b/icu4c/source/data/brkitr/rules/word.txt
@@ -151,7 +151,7 @@ $Katakana      $ExFm* $ExtendNumLet {400};    #  (13a)
 $ExtendNumLet  $ExFm* $ExtendNumLet {200};    #  (13a)
 
 $ExtendNumLet  $ExFm* $ALetterPlus  {200};    #  (13b)
-$ExtendNumLet  $ExFm* $Hebrew_Letter {200};    #  (13b)
+#$ExtendNumLet  $ExFm* $Hebrew_Letter {200};    #  (13b)
 $ExtendNumLet  $ExFm* $Numeric      {100};    #  (13b)
 $ExtendNumLet  $ExFm* $Katakana     {400};    #  (13b)

Output from ICU4J

      <testcase classname="com.ibm.icu.dev.test.rbbi.RBBITestMonkey" name="TestRTWordMonkey" time="0.027">
          <failure message="&#xa;Break found but not expected. at index 561. Parameters to reproduce: @&quot;type=word  seed=1  loop=1&quot;&#xa;     557 :  |  |     \ua902 Numeric           WB 999                                   KAYAH LI DIGIT TWO                      &#xa;     558 :  |  |     \u2024 MidNumLet         WB 999                                   ONE DOT LEADER                          &#xa;     559 :  .  .     \u0335 Extend                                                     COMBINING SHORT STROKE OVERLAY          &#xa;     560 :  |  |     \u2040 ExtendNumLet      WB 999                                   CHARACTER TIE                           &#xa; --→ 561 :  .  |     \u05e7 Hebrew            WB 13b ExtendNumLet x (ALetter | Hebrew_Letter | Numeric | Katakana) HEBREW LETTER QOF                       &#xa;     562 :  |  | \U0001f608 ExtendedPict      WB 999                                   SMILING FACE WITH HORNS                 &#xa;     564 :  |  | \U0001f1eb RegionalIndicator WB 999                                   REGIONAL INDICATOR SYMBOL LETTER F      &#xa;     566 :  .  .     \u1dec Extend                                                     COMBINING LATIN SMALL LETTER L WITH DOUBLE MIDDLE TILDE&#xa;     567 :  |  |     \u0387 MidLetter         WB 999                                   GREEK ANO TELEIA                        &#xa;     568 :  |  |     \u000d CR                WB 3a  Break before and after newlines (including CR and LF) &lt;control-000D&gt;                          &#xa;" type="junit.framework.AssertionFailedError">junit.framework.AssertionFailedError: 
Break found but not expected. at index 561. Parameters to reproduce: @&quot;type=word  seed=1  loop=1&quot;
     557 :  |  |     \ua902 Numeric           WB 999                                   KAYAH LI DIGIT TWO                      
     558 :  |  |     \u2024 MidNumLet         WB 999                                   ONE DOT LEADER                          
     559 :  .  .     \u0335 Extend                                                     COMBINING SHORT STROKE OVERLAY          
     560 :  |  |     \u2040 ExtendNumLet      WB 999                                   CHARACTER TIE                           
 --→ 561 :  .  |     \u05e7 Hebrew            WB 13b ExtendNumLet x (ALetter | Hebrew_Letter | Numeric | Katakana) HEBREW LETTER QOF                       
     562 :  |  | \U0001f608 ExtendedPict      WB 999                                   SMILING FACE WITH HORNS                 
     564 :  |  | \U0001f1eb RegionalIndicator WB 999                                   REGIONAL INDICATOR SYMBOL LETTER F      
     566 :  .  .     \u1dec Extend                                                     COMBINING LATIN SMALL LETTER L WITH DOUBLE MIDDLE TILDE
     567 :  |  |     \u0387 MidLetter         WB 999                                   GREEK ANO TELEIA                        
     568 :  |  |     \u000d CR                WB 3a  Break before and after newlines (including CR and LF) &lt;control-000D&gt;                          

        at com.ibm.icu.dev.test.AbstractTestLog.errln(AbstractTestLog.java:80)
        at com.ibm.icu.dev.test.rbbi.RBBITestMonkey.RunMonkey(RBBITestMonkey.java:2233)
        at com.ibm.icu.dev.test.rbbi.RBBITestMonkey.TestRTWordMonkey(RBBITestMonkey.java:2322)
        at java.util.Vector.forEach(Vector.java:1276)
</failure>

      </testcase>

ant checkTest -Dtestclass='com.ibm.icu.dev.test.rbbi.RBBITestMonkey'

@jira-pull-request-webhook

Copy link
Copy Markdown

Notice: the branch changed across the force-push!

  • icu4j/main/tests/core/src/com/ibm/icu/dev/test/rbbi/RBBITestMonkey.java is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

aheninger
aheninger previously approved these changes Mar 7, 2020

@aheninger aheninger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for doing this.

I had only one minor suggestion; feel free to ignore it if you think it's not worth the trouble.

// near any test failure.
int fCharProperty;

ArrayList<String> fClassNames;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you create the fClassNames and fAppliedRules ArrayLists here, in the base class declaration, you can avoid having to create them separately in each subclass. Sort-of corresponds the to C++ version, where these are value objects, so implicitly created by the base class constructor.

fSets.add(fExtendSet);
fSets.add(fRegionalIndicatorSet);
fSets = new ArrayList();
fClassNames = new ArrayList();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This line and the next could be deleted if the initialization is moved to the base class.
(fSets can't be done that way as easily, because it's not currently declared in the base class.)

fSets.add(fRegionalIndicatorSet);
fSets.add(fHebrew_LetterSet);
fSets.add(fALetterSet);
fClassNames = new ArrayList();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See earlier comment.

{
fCharProperty = UProperty.LINE_BREAK;
fSets = new ArrayList();
fClassNames = new ArrayList();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See earlier comment.

fCharProperty = UProperty.SENTENCE_BREAK;

fSets = new ArrayList();
fClassNames = new ArrayList();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See earlier comment.

aheninger
aheninger previously approved these changes Mar 9, 2020
@jira-pull-request-webhook

Copy link
Copy Markdown

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@FrankYFTang
FrankYFTang removed the request for review from sven-oly March 10, 2020 03:16
@FrankYFTang
FrankYFTang merged commit 9153d05 into unicode-org:master Mar 10, 2020
@FrankYFTang
FrankYFTang deleted the ICU-21006 branch March 16, 2020 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants