diff options
author | 2013-10-09 18:54:48 -0700 | |
---|---|---|
committer | 2013-10-09 18:54:48 -0700 | |
commit | f9de7ca5fd3e4462ccfbe1d8a6db8b8a382bc4eb (patch) | |
tree | d797512bcbd36e47bdb99daa04c9f14e4fd4617c /tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java | |
parent | 0f0cd69aa813f66ca1edf0685c933b3a33401dae (diff) | |
parent | d5c90d9d8be05d848661aba10d11bac14cf70626 (diff) | |
download | latinime-f9de7ca5fd3e4462ccfbe1d8a6db8b8a382bc4eb.tar.gz latinime-f9de7ca5fd3e4462ccfbe1d8a6db8b8a382bc4eb.tar.xz latinime-f9de7ca5fd3e4462ccfbe1d8a6db8b8a382bc4eb.zip |
am d5c90d9d: am 618158e6: Merge "Refactor BinaryDictIOUtilsTests."
* commit 'd5c90d9d8be05d848661aba10d11bac14cf70626':
Refactor BinaryDictIOUtilsTests.
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java | 17 |
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); + } } |