am 388c9536: Fix tests by adding @UsedForTesting.
* commit '388c953613bc06721eba28be31dc1f4936d8b88a': Fix tests by adding @UsedForTesting.main
commit
5ddd43a45c
|
@ -33,6 +33,7 @@ import java.util.LinkedList;
|
|||
* 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 @@ public class ExpandableDictionary extends Dictionary {
|
|||
|
||||
private int[][] mCodes;
|
||||
|
||||
@UsedForTesting
|
||||
public ExpandableDictionary(final String dictType) {
|
||||
super(dictType);
|
||||
clearDictionary();
|
||||
|
@ -164,6 +166,7 @@ public class ExpandableDictionary extends Dictionary {
|
|||
* @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) {
|
||||
|
|
|
@ -20,6 +20,9 @@ import android.util.Log;
|
|||
|
||||
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 @@ public final class UserHistoryForgettingCurveUtils {
|
|||
}
|
||||
}
|
||||
|
||||
@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 @@ public final class UserHistoryForgettingCurveUtils {
|
|||
return calcFreq(elapsedTime, count, level);
|
||||
}
|
||||
|
||||
@UsedForTesting
|
||||
public static byte pushElapsedTime(byte fc) {
|
||||
int elapsedTime = fcToElapsedTime(fc);
|
||||
int count = fcToCount(fc);
|
||||
|
@ -173,6 +181,7 @@ public final class UserHistoryForgettingCurveUtils {
|
|||
return calcFc(elapsedTime, count, level);
|
||||
}
|
||||
|
||||
@UsedForTesting
|
||||
public static byte pushCount(byte fc, boolean isValid) {
|
||||
final int elapsedTime = fcToElapsedTime(fc);
|
||||
int count = fcToCount(fc);
|
||||
|
|
Loading…
Reference in New Issue