ICU-3083 supplementary bug fixed.

problem was that a wrong ce was given to estimate the estimated offset.

X-SVN-Rev: 12720
This commit is contained in:
Syn Wee Quek 2003-07-31 19:51:12 +00:00
parent 3ee80fc175
commit d2f1556246
2 changed files with 36 additions and 9 deletions

View file

@ -207,7 +207,23 @@ public class SearchTest extends TestFmwk {
SearchData SUPPLEMENTARY[] = {
/* 012345678901234567890123456789012345678901234567890012345678901234567890123456789012345678901234567890012345678901234567890123456789 */
new SearchData("abc \uD800\uDC00 \uD800\uDC01 \uD801\uDC00 \uD800\uDC00abc abc\uD800\uDC00 \uD800\uD800\uDC00 \uD800\uDC00\uDC00",
"\uD800\uDC00", null, Collator.TERTIARY, null, new int[] {4, 13, 22, 26, 29, -1}, new int[] {2, 2, 2, 2, 2}),
"\uD800\uDC00", null, Collator.TERTIARY, null,
new int[] {4, 13, 22, 26, 29, -1}, new int[] {2, 2, 2, 2, 2}),
new SearchData("and\uD834\uDDB9this sentence", "\uD834\uDDB9", null,
Collator.TERTIARY, null, new int[] {3, -1},
new int[] {2}),
new SearchData("and \uD834\uDDB9 this sentence", " \uD834\uDDB9 ",
null, Collator.TERTIARY, null, new int[] {3, -1},
new int[] {4}),
new SearchData("and-\uD834\uDDB9-this sentence", "-\uD834\uDDB9-",
null, Collator.TERTIARY, null, new int[] {3, -1},
new int[] {4}),
new SearchData("and,\uD834\uDDB9,this sentence", ",\uD834\uDDB9,",
null, Collator.TERTIARY, null, new int[] {3, -1},
new int[] {4}),
new SearchData("and?\uD834\uDDB9?this sentence", "?\uD834\uDDB9?",
null, Collator.TERTIARY, null, new int[] {3, -1},
new int[] {4}),
new SearchData(null, null, null, Collator.TERTIARY, null, new int[] {-1}, new int[] {0})
};
@ -371,6 +387,21 @@ public class SearchTest extends TestFmwk {
new SearchData("abc \uD800\uDC00 \uD800\uDC01 \uD801\uDC00 \uD800\uDC00abc abc\uD800\uDC00 \uD800\uD800\uDC00 \uD800\uDC00\uDC00",
"\uD800\uDC00", null, Collator.TERTIARY, null, new int[] {4, 13, 22, 26, 29, -1},
new int[] {2, 2, 2, 2, 2}),
new SearchData("and\uD834\uDDB9this sentence", "\uD834\uDDB9", null,
Collator.TERTIARY, null, new int[] {3, -1},
new int[] {2}),
new SearchData("and \uD834\uDDB9 this sentence", " \uD834\uDDB9 ",
null, Collator.TERTIARY, null, new int[] {3, -1},
new int[] {4}),
new SearchData("and-\uD834\uDDB9-this sentence", "-\uD834\uDDB9-",
null, Collator.TERTIARY, null, new int[] {3, -1},
new int[] {4}),
new SearchData("and,\uD834\uDDB9,this sentence", ",\uD834\uDDB9,",
null, Collator.TERTIARY, null, new int[] {3, -1},
new int[] {4}),
new SearchData("and?\uD834\uDDB9?this sentence", "?\uD834\uDDB9?",
null, Collator.TERTIARY, null, new int[] {3, -1},
new int[] {4}),
new SearchData(null, null, null, Collator.TERTIARY, null, new int[] {-1}, new int[] {0})
};

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/StringSearch.java,v $
* $Date: 2003/07/03 23:18:37 $
* $Revision: 1.24 $
* $Date: 2003/07/31 19:51:12 $
* $Revision: 1.25 $
*
*****************************************************************************************
*/
@ -2796,8 +2796,6 @@ public final class StringSearch extends SearchIterator
}
}
targetce = lastce;
while (found && patternceindex > 0) {
targetce = m_colEIter_.previous();
if (targetce == CollationElementIterator.NULLORDER) {
@ -2814,8 +2812,7 @@ public final class StringSearch extends SearchIterator
}
if (!found) {
textoffset = shiftForward(textoffset, targetce,
patternceindex);
textoffset = shiftForward(textoffset, lastce, patternceindex);
// status checked at loop.
patternceindex = m_pattern_.m_CELength_;
continue;
@ -2880,7 +2877,6 @@ public final class StringSearch extends SearchIterator
break;
}
}
targetce = lastce;
while (found && patternceindex > 0) {
targetce = m_colEIter_.previous();
@ -2903,7 +2899,7 @@ public final class StringSearch extends SearchIterator
}
if (!found) {
textoffset = shiftForward(textoffset, targetce, patternceindex);
textoffset = shiftForward(textoffset, lastce, patternceindex);
// status checked at loop
patternceindex = m_pattern_.m_CELength_;
continue;