private void assertEqual(String expected, Normalizer iter, String msg)
{
int index = 0;
int ch;
UCharacterIterator cIter = UCharacterIterator.getInstance(expected);
while ((ch=iter.next())!= Normalizer.DONE){
if (index >= expected.length()) {
errln("FAIL: " + msg + "Unexpected character '" + (char)ch
+ "' (" + hex(ch) + ")"
+ " at index " + index);
break;
}
int want = UTF16.charAt(expected,index);
if (ch != want) {
errln("FAIL: " + msg + "got '" + (char)ch
+ "' (" + hex(ch) + ")"
+ " but expected '" + want + "' (" + hex(want)+ ")"
+ " at index " + index);
}
index+= UTF16.getCharCount(ch);
}
if (index < expected.length()) {
errln("FAIL: " + msg + "Only got " + index + " chars, expected "
+ expected.length());
}
cIter.setToLimit();
while((ch=iter.previous())!=Normalizer.DONE){
int want = cIter.previousCodePoint();
if (ch != want ) {
errln("FAIL: " + msg + "got '" + (char)ch
+ "' (" + hex(ch) + ")"
+ " but expected '" + want + "' (" + hex(want) + ")"
+ " at index " + index);