diff options
author | 2014-10-21 15:37:22 +0900 | |
---|---|---|
committer | 2014-11-05 12:27:35 +0900 | |
commit | ae55db95a74c72220961824c8054ec38b38492cb (patch) | |
tree | 697fbe3dadb771c8c0e7ae53478f05d1e0488379 /tools/dicttool/tests | |
parent | b1439c28723c86cd05c31d3651a897329a55a5de (diff) | |
download | latinime-ae55db95a74c72220961824c8054ec38b38492cb.tar.gz latinime-ae55db95a74c72220961824c8054ec38b38492cb.tar.xz latinime-ae55db95a74c72220961824c8054ec38b38492cb.zip |
Large simplification in obtaining a raw dictionary
That is where the last refactorings were leading. This code is
simpler, but it's far more flexible. Importantly, it only makes
a single copy instead of making a full disk copy for every
intermediate step.
Next we're going to make the "copy" part modular for processes
that don't need to copy the whole file.
Change-Id: Ief32ac665d804b9b20c44f443a9c87452ceb367a
Diffstat (limited to 'tools/dicttool/tests')
-rw-r--r-- | tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java b/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java index 6cdbff7e5..757f51a5f 100644 --- a/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java +++ b/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java @@ -68,9 +68,7 @@ public class BinaryDictOffdeviceUtilsTests extends TestCase { final File dst = File.createTempFile("testGetRawDict", ".tmp"); dst.deleteOnExit(); try (final OutputStream out = Compress.getCompressedStream( - Compress.getCompressedStream( - Compress.getCompressedStream( - new BufferedOutputStream(new FileOutputStream(dst)))))) { + new BufferedOutputStream(new FileOutputStream(dst)))) { final DictEncoder dictEncoder = new Ver2DictEncoder(out); dictEncoder.writeDictionary(dict, new FormatOptions(2, false)); } @@ -78,11 +76,7 @@ public class BinaryDictOffdeviceUtilsTests extends TestCase { // Test for an actually compressed dictionary and its contents final BinaryDictOffdeviceUtils.DecoderChainSpec decodeSpec = BinaryDictOffdeviceUtils.getRawDictionaryOrNull(dst); - for (final int step : decodeSpec.mDecoderSpec) { - assertEquals("Wrong decode spec", - BinaryDictOffdeviceUtils.DecoderChainSpec.COMPRESSION, step); - } - assertEquals("Wrong decode spec", 3, decodeSpec.mDecoderSpec.length); + assertEquals("Wrong decode spec", "raw > compression", decodeSpec.describeChain()); final DictDecoder dictDecoder = BinaryDictIOUtils.getDictDecoder(decodeSpec.mFile, 0, decodeSpec.mFile.length()); final FusionDictionary resultDict = |