2626 * Tests Rule.
2727 */
2828class RuleTest {
29+
2930 private Rule .Phoneme [][] makePhonemes () {
30- final String [][] words = {
31- { "rinD" , "rinDlt" , "rina" , "rinalt" , "rino" , "rinolt" , "rinu" , "rinult" },
31+ final String [][] words = { { "rinD" , "rinDlt" , "rina" , "rinalt" , "rino" , "rinolt" , "rinu" , "rinult" },
3232 { "dortlaj" , "dortlej" , "ortlaj" , "ortlej" , "ortlej-dortlaj" } };
3333 final Rule .Phoneme [][] phonemes = new Rule .Phoneme [words .length ][];
34-
3534 for (int i = 0 ; i < words .length ; i ++) {
3635 final String [] words_i = words [i ];
3736 final Rule .Phoneme [] phonemes_i = phonemes [i ] = new Rule .Phoneme [words_i .length ];
3837 for (int j = 0 ; j < words_i .length ; j ++) {
3938 phonemes_i [j ] = new Rule .Phoneme (words_i [j ], Languages .NO_LANGUAGES );
4039 }
4140 }
42-
4341 return phonemes ;
4442 }
4543
@@ -49,7 +47,6 @@ void testPhonemeComparedToLaterIsNegative() {
4947 for (int i = 0 ; i < phs .length ; i ++) {
5048 for (int j = i + 1 ; j < phs .length ; j ++) {
5149 final int c = Rule .Phoneme .COMPARATOR .compare (phs [i ], phs [j ]);
52-
5350 assertTrue (Integer .valueOf (c ).intValue () < 0 ,
5451 "Comparing " + phs [i ].getPhonemeText () + " to " + phs [j ].getPhonemeText () + " should be negative" );
5552 }
@@ -61,23 +58,20 @@ void testPhonemeComparedToLaterIsNegative() {
6158 void testPhonemeComparedToSelfIsZero () {
6259 for (final Rule .Phoneme [] phs : makePhonemes ()) {
6360 for (final Rule .Phoneme ph : phs ) {
64- assertEquals (0 , Rule .Phoneme .COMPARATOR .compare (ph , ph ),
65- "Phoneme compared to itself should be zero: " + ph .getPhonemeText ());
61+ assertEquals (0 , Rule .Phoneme .COMPARATOR .compare (ph , ph ), "Phoneme compared to itself should be zero: " + ph .getPhonemeText ());
6662 }
6763 }
6864 }
6965
7066 @ Test
7167 void testSubSequenceWorks () {
7268 // AppendableCharSequence is private to Rule. We can only make it through a Phoneme.
73-
7469 final Rule .Phoneme a = new Rule .Phoneme ("a" , null );
7570 final Rule .Phoneme b = new Rule .Phoneme ("b" , null );
7671 final Rule .Phoneme cd = new Rule .Phoneme ("cd" , null );
7772 final Rule .Phoneme ef = new Rule .Phoneme ("ef" , null );
7873 final Rule .Phoneme ghi = new Rule .Phoneme ("ghi" , null );
7974 final Rule .Phoneme jkl = new Rule .Phoneme ("jkl" , null );
80-
8175 assertEquals ('a' , a .getPhonemeText ().charAt (0 ));
8276 assertEquals ('b' , b .getPhonemeText ().charAt (0 ));
8377 assertEquals ('c' , cd .getPhonemeText ().charAt (0 ));
@@ -90,14 +84,12 @@ void testSubSequenceWorks() {
9084 assertEquals ('j' , jkl .getPhonemeText ().charAt (0 ));
9185 assertEquals ('k' , jkl .getPhonemeText ().charAt (1 ));
9286 assertEquals ('l' , jkl .getPhonemeText ().charAt (2 ));
93-
9487 final Rule .Phoneme a_b = new Rule .Phoneme (a , b );
9588 assertEquals ('a' , a_b .getPhonemeText ().charAt (0 ));
9689 assertEquals ('b' , a_b .getPhonemeText ().charAt (1 ));
9790 assertEquals ("ab" , a_b .getPhonemeText ().subSequence (0 , 2 ).toString ());
9891 assertEquals ("a" , a_b .getPhonemeText ().subSequence (0 , 1 ).toString ());
9992 assertEquals ("b" , a_b .getPhonemeText ().subSequence (1 , 2 ).toString ());
100-
10193 final Rule .Phoneme cd_ef = new Rule .Phoneme (cd , ef );
10294 assertEquals ('c' , cd_ef .getPhonemeText ().charAt (0 ));
10395 assertEquals ('d' , cd_ef .getPhonemeText ().charAt (1 ));
@@ -113,7 +105,6 @@ void testSubSequenceWorks() {
113105 assertEquals ("cde" , cd_ef .getPhonemeText ().subSequence (0 , 3 ).toString ());
114106 assertEquals ("def" , cd_ef .getPhonemeText ().subSequence (1 , 4 ).toString ());
115107 assertEquals ("cdef" , cd_ef .getPhonemeText ().subSequence (0 , 4 ).toString ());
116-
117108 final Rule .Phoneme a_b_cd = new Rule .Phoneme (new Rule .Phoneme (a , b ), cd );
118109 assertEquals ('a' , a_b_cd .getPhonemeText ().charAt (0 ));
119110 assertEquals ('b' , a_b_cd .getPhonemeText ().charAt (1 ));
0 commit comments