am 0c2cdcc7: Fix bug of testCodePointTable.

* commit '0c2cdcc7350e8dc0e97f0aa4f343984f3cf39f72':
  Fix bug of testCodePointTable.
This commit is contained in:
Akifumi Yoshimoto 2014-09-30 04:03:32 +00:00 committed by Android Git Automerger
commit c613c3e3b8
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());
}
/**