Fix bug of testCodePointTable.

Bug:17097992
Change-Id: Ia26bfceb008f52e2c3b760159c5129b7eca5d6d6
This commit is contained in:
Akifumi Yoshimoto 2014-09-30 12:49:25 +09:00
parent a69c170a3f
commit 0c2cdcc735
2 changed files with 9 additions and 6 deletions

View File

@ -100,7 +100,10 @@ public class Ver2DictEncoder implements DictEncoder {
Collections.sort(codePointOccurrenceArray, new Comparator<Entry<Integer, Integer>>() {
@Override
public int compare(final Entry<Integer, Integer> a, final Entry<Integer, Integer> b) {
return b.getValue().compareTo(a.getValue());
if (a.getValue() != b.getValue()) {
return b.getValue().compareTo(a.getValue());
}
return b.getKey().compareTo(a.getKey());
}
});
int currentCodePointTableIndex = FormatSpec.MINIMAL_ONE_BYTE_CHARACTER_VALUE;

View File

@ -42,8 +42,8 @@ public class Ver2DictEncoderTests extends AndroidTestCase {
final List<String> words = Arrays.asList(wordSource);
final String correctCodePointTable = "eotdsanirfg bclwup";
final String correctCodePointOccurrenceArrayString =
"10141164111411531003110297210521142103111911171108198199132111211021";
final String correctCodePointExpectedMapString = "323433363538373940494147454644424348";
"11641114101411531003114211021052972119111711121108110311021991981321";
final String correctCodePointExpectedMapString = "343332363540383937464549484744414243";
final String dictName = "codePointTableTest";
final String dictVersion = Long.toString(System.currentTimeMillis());
@ -60,8 +60,8 @@ public class Ver2DictEncoderTests extends AndroidTestCase {
codePointOccurrenceArrayString.append(entry.getKey());
codePointOccurrenceArrayString.append(entry.getValue());
}
assertEquals(codePointOccurrenceArrayString.toString(),
correctCodePointOccurrenceArrayString);
assertEquals(correctCodePointOccurrenceArrayString,
codePointOccurrenceArrayString.toString());
// Check if mCodePointToOneByteCodeMap is correct
final StringBuilder codePointExpectedMapString = new StringBuilder();
@ -69,7 +69,7 @@ public class Ver2DictEncoderTests extends AndroidTestCase {
codePointExpectedMapString.append(codePointTable.mCodePointToOneByteCodeMap.get(
correctCodePointTable.codePointAt(i)));
}
assertEquals(codePointExpectedMapString.toString(), correctCodePointExpectedMapString);
assertEquals(correctCodePointExpectedMapString, codePointExpectedMapString.toString());
}
/**