diff options
author | 2013-10-09 20:33:23 -0700 | |
---|---|---|
committer | 2013-10-09 20:33:23 -0700 | |
commit | 3418b4dfd9a731caed965ce5f660d1c2664c665c (patch) | |
tree | d797512bcbd36e47bdb99daa04c9f14e4fd4617c /tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java | |
parent | 3accabfc60858537304c8647b0d7efb44f7770ed (diff) | |
parent | f9de7ca5fd3e4462ccfbe1d8a6db8b8a382bc4eb (diff) | |
download | latinime-3418b4dfd9a731caed965ce5f660d1c2664c665c.tar.gz latinime-3418b4dfd9a731caed965ce5f660d1c2664c665c.tar.xz latinime-3418b4dfd9a731caed965ce5f660d1c2664c665c.zip |
am f9de7ca5: am d5c90d9d: am 618158e6: Merge "Refactor BinaryDictIOUtilsTests."
* commit 'f9de7ca5fd3e4462ccfbe1d8a6db8b8a382bc4eb':
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); + } } |