aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java
diff options
context:
space:
mode:
authorYuichiro Hanada <yhanada@google.com>2013-10-03 16:44:31 +0900
committerYuichiro Hanada <yhanada@google.com>2013-10-04 14:19:13 +0900
commit75d60e821ce09390253df21f2b83d45498567cb5 (patch)
tree641fc460421ed1efb14d6da00c2a963105988d02 /tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java
parent14d31d464037c31e7f7d382a8a86f6acf4694b06 (diff)
downloadlatinime-75d60e821ce09390253df21f2b83d45498567cb5.tar.gz
latinime-75d60e821ce09390253df21f2b83d45498567cb5.tar.xz
latinime-75d60e821ce09390253df21f2b83d45498567cb5.zip
Refactor BinaryDictIOUtilsTests.
Change-Id: I2208378b33038771b460abb33f9a690872e998e2
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java
index aa1658301..d17b30602 100644
--- a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java
+++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java
@@ -646,7 +646,7 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
}
}
- public void testDeleteWord() {
+ private void runTestDeleteWord(final FormatOptions formatOptions) {
final String dictName = "testDeleteWord";
final String dictVersion = Long.toString(System.currentTimeMillis());
final File file = setUpDictionaryFile(dictName, dictVersion);
@@ -655,10 +655,15 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
new FusionDictionary.DictionaryOptions(
new HashMap<String, String>(), false, false));
addUnigrams(sWords.size(), dict, sWords, null /* shortcutMap */);
- timeWritingDictToFile(file, dict, VERSION3_WITH_DYNAMIC_UPDATE);
+ timeWritingDictToFile(file, dict, formatOptions);
- final Ver3DictUpdater dictUpdater = new Ver3DictUpdater(file,
- DictDecoder.USE_WRITABLE_BYTEBUFFER);
+ final DictUpdater dictUpdater;
+ if (formatOptions.mVersion == 3) {
+ dictUpdater = new Ver3DictUpdater(file, DictDecoder.USE_WRITABLE_BYTEBUFFER);
+ } else {
+ throw new RuntimeException("DictUpdater for version " + formatOptions.mVersion
+ + " doesn't exist.");
+ }
try {
MoreAsserts.assertNotEqual(FormatSpec.NOT_VALID_WORD,
@@ -676,4 +681,8 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
} catch (UnsupportedFormatException e) {
}
}
+
+ public void testDeleteWord() {
+ runTestDeleteWord(VERSION3_WITH_DYNAMIC_UPDATE);
+ }
}