am 03d1dff3
: Merge "Fix Binary dict tests"
* commit '03d1dff38d4de0f043420aae8a292d74b531324a': Fix Binary dict tests
This commit is contained in:
commit
69ffa8b0ff
2 changed files with 8 additions and 5 deletions
|
@ -1467,8 +1467,8 @@ public final class BinaryDictInputOutput {
|
|||
if (null == last) continue;
|
||||
builder.append(new String(last.mCharacters, 0, last.mCharacters.length));
|
||||
buffer.position(last.mChildrenAddress + headerSize);
|
||||
groupOffset = last.mChildrenAddress + 1;
|
||||
i = buffer.readUnsignedByte();
|
||||
i = readCharGroupCount(buffer);
|
||||
groupOffset = last.mChildrenAddress + getGroupCountSize(i);
|
||||
last = null;
|
||||
continue;
|
||||
}
|
||||
|
@ -1477,8 +1477,8 @@ public final class BinaryDictInputOutput {
|
|||
if (0 == i && hasChildrenAddress(last.mChildrenAddress)) {
|
||||
builder.append(new String(last.mCharacters, 0, last.mCharacters.length));
|
||||
buffer.position(last.mChildrenAddress + headerSize);
|
||||
groupOffset = last.mChildrenAddress + 1;
|
||||
i = buffer.readUnsignedByte();
|
||||
i = readCharGroupCount(buffer);
|
||||
groupOffset = last.mChildrenAddress + getGroupCountSize(i);
|
||||
last = null;
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -137,7 +137,10 @@ public class BinaryDictIOTests extends AndroidTestCase {
|
|||
if (r < 0) continue;
|
||||
// Don't insert 0~20, but insert any other code point.
|
||||
// Code points are in the range 0~0x10FFFF.
|
||||
builder.appendCodePoint((int)(20 + r % (0x10FFFF - 20)));
|
||||
final int candidateCodePoint = (int)(20 + r % (0x10FFFF - 20));
|
||||
// Code points between 0xD800 and 0xDFFF are not valid.
|
||||
if (candidateCodePoint >= 0xD800 && candidateCodePoint <= 0xDFFF) continue;
|
||||
builder.appendCodePoint(candidadeCodePoint);
|
||||
--count;
|
||||
}
|
||||
return builder.toString();
|
||||
|
|
Loading…
Reference in a new issue