Fix tests by adding @UsedForTesting.
Change-Id: I5b98db67a083bde65bb0f2fb714ae2e799fb1d45
diff --git a/java/src/com/android/inputmethod/latin/ExpandableDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableDictionary.java
index 95c9bca..8fdff8f 100644
--- a/java/src/com/android/inputmethod/latin/ExpandableDictionary.java
+++ b/java/src/com/android/inputmethod/latin/ExpandableDictionary.java
@@ -33,6 +33,7 @@
* be searched for suggestions and valid words.
*/
// TODO: Remove after binary dictionary supports dynamic update.
+@UsedForTesting
public class ExpandableDictionary extends Dictionary {
private static final String TAG = ExpandableDictionary.class.getSimpleName();
/**
@@ -146,6 +147,7 @@
private int[][] mCodes;
+ @UsedForTesting
public ExpandableDictionary(final String dictType) {
super(dictType);
clearDictionary();
@@ -164,6 +166,7 @@
* @param shortcutFreq The frequency of the shortcut (0~15, with 15 = whitelist). Ignored
* if shortcutTarget is null.
*/
+ @UsedForTesting
public void addWord(final String word, final String shortcutTarget, final int frequency,
final int shortcutFreq) {
if (word.length() >= Constants.DICTIONARY_MAX_WORD_LENGTH) {
diff --git a/java/src/com/android/inputmethod/latin/utils/UserHistoryForgettingCurveUtils.java b/java/src/com/android/inputmethod/latin/utils/UserHistoryForgettingCurveUtils.java
index 1992b2f..677035e 100644
--- a/java/src/com/android/inputmethod/latin/utils/UserHistoryForgettingCurveUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/UserHistoryForgettingCurveUtils.java
@@ -20,6 +20,9 @@
import java.util.concurrent.TimeUnit;
+import com.android.inputmethod.annotations.UsedForTesting;
+
+@UsedForTesting
public final class UserHistoryForgettingCurveUtils {
private static final String TAG = UserHistoryForgettingCurveUtils.class.getSimpleName();
private static final boolean DEBUG = false;
@@ -118,18 +121,22 @@
}
}
+ @UsedForTesting
/* package */ static int fcToElapsedTime(byte fc) {
return fc & 0x0F;
}
+ @UsedForTesting
/* package */ static int fcToCount(byte fc) {
return (fc >> 4) & 0x03;
}
+ @UsedForTesting
/* package */ static int fcToLevel(byte fc) {
return (fc >> 6) & 0x03;
}
+ @UsedForTesting
private static int calcFreq(int elapsedTime, int count, int level) {
if (level <= 0) {
// Reserved words, just return -1
@@ -158,6 +165,7 @@
return calcFreq(elapsedTime, count, level);
}
+ @UsedForTesting
public static byte pushElapsedTime(byte fc) {
int elapsedTime = fcToElapsedTime(fc);
int count = fcToCount(fc);
@@ -173,6 +181,7 @@
return calcFc(elapsedTime, count, level);
}
+ @UsedForTesting
public static byte pushCount(byte fc, boolean isValid) {
final int elapsedTime = fcToElapsedTime(fc);
int count = fcToCount(fc);