summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohammadinamul Sheik <inamul@google.com>2015-03-13 18:21:22 -0700
committerMohammadinamul Sheik <inamul@google.com>2015-03-13 18:21:22 -0700
commit29500ef4ba8e01f4c467a62399c8249d532ee82c (patch)
tree33edf5ff254cc932391323a034193c95fcdafacb
parent54bf24f64b9bbd4c5e4b6d4c3c6144c047d6ddc6 (diff)
downloadandroid_packages_inputmethods_LatinIME-29500ef4ba8e01f4c467a62399c8249d532ee82c.tar.gz
android_packages_inputmethods_LatinIME-29500ef4ba8e01f4c467a62399c8249d532ee82c.tar.bz2
android_packages_inputmethods_LatinIME-29500ef4ba8e01f4c467a62399c8249d532ee82c.zip
Fix the BinaryDictionaryTests
Change-Id: I09378d74705e6943946ea4f76b15664086a387ed
-rw-r--r--java/src/com/android/inputmethod/latin/BinaryDictionary.java10
-rw-r--r--tests/src/com/android/inputmethod/latin/BinaryDictionaryTests.java2
2 files changed, 7 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
index c1015511b..daac5b521 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
@@ -58,6 +58,8 @@ public final class BinaryDictionary extends Dictionary {
// Must be equal to CONFIDENCE_TO_AUTO_COMMIT in native/jni/src/defines.h
private static final int CONFIDENCE_TO_AUTO_COMMIT = 1000000;
+ static final int DICTIONARY_MAX_WORD_LENGTH = 48;
+
@UsedForTesting
public static final String UNIGRAM_COUNT_QUERY = "UNIGRAM_COUNT";
@UsedForTesting
@@ -318,9 +320,9 @@ public final class BinaryDictionary extends Dictionary {
final int count = session.mOutputSuggestionCount[0];
final ArrayList<SuggestedWordInfo> suggestions = new ArrayList<>();
for (int j = 0; j < count; ++j) {
- final int start = j * DecoderSpecificConstants.DICTIONARY_MAX_WORD_LENGTH;
+ final int start = j * DICTIONARY_MAX_WORD_LENGTH;
int len = 0;
- while (len < DecoderSpecificConstants.DICTIONARY_MAX_WORD_LENGTH
+ while (len < DICTIONARY_MAX_WORD_LENGTH
&& session.mOutputCodePoints[start + len] != 0) {
++len;
}
@@ -389,7 +391,7 @@ public final class BinaryDictionary extends Dictionary {
return null;
}
final int[] codePoints = StringUtils.toCodePointArray(word);
- final int[] outCodePoints = new int[DecoderSpecificConstants.DICTIONARY_MAX_WORD_LENGTH];
+ final int[] outCodePoints = new int[DICTIONARY_MAX_WORD_LENGTH];
final boolean[] outFlags = new boolean[FORMAT_WORD_PROPERTY_OUTPUT_FLAG_COUNT];
final int[] outProbabilityInfo =
new int[FORMAT_WORD_PROPERTY_OUTPUT_PROBABILITY_INFO_COUNT];
@@ -428,7 +430,7 @@ public final class BinaryDictionary extends Dictionary {
* If token is 0, this method newly starts iterating the dictionary.
*/
public GetNextWordPropertyResult getNextWordProperty(final int token) {
- final int[] codePoints = new int[DecoderSpecificConstants.DICTIONARY_MAX_WORD_LENGTH];
+ final int[] codePoints = new int[DICTIONARY_MAX_WORD_LENGTH];
final boolean[] isBeginningOfSentence = new boolean[1];
final int nextToken = getNextWordNative(mNativeDict, token, codePoints,
isBeginningOfSentence);
diff --git a/tests/src/com/android/inputmethod/latin/BinaryDictionaryTests.java b/tests/src/com/android/inputmethod/latin/BinaryDictionaryTests.java
index 9da1e9470..752051775 100644
--- a/tests/src/com/android/inputmethod/latin/BinaryDictionaryTests.java
+++ b/tests/src/com/android/inputmethod/latin/BinaryDictionaryTests.java
@@ -170,7 +170,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
private void testAddTooLongWord(final int formatVersion) {
final BinaryDictionary binaryDictionary = getEmptyBinaryDictionary(formatVersion);
final StringBuffer stringBuilder = new StringBuffer();
- for (int i = 0; i < DecoderSpecificConstants.DICTIONARY_MAX_WORD_LENGTH; i++) {
+ for (int i = 0; i < BinaryDictionary.DICTIONARY_MAX_WORD_LENGTH; i++) {
stringBuilder.append('a');
}
final String validLongWord = stringBuilder.toString();