diff options
author | 2013-04-17 19:47:01 -0700 | |
---|---|---|
committer | 2013-04-17 19:47:01 -0700 | |
commit | d244574be84119505d3712559b743c67a783103c (patch) | |
tree | d2741dbeee31253ad0e3c1aed3dc6f3fc038a472 | |
parent | b8540f8ee523753c6bbc04a70ff9f850220a7dea (diff) | |
parent | fd959fd15991717ca0f67851d38bf36052746596 (diff) | |
download | latinime-d244574be84119505d3712559b743c67a783103c.tar.gz latinime-d244574be84119505d3712559b743c67a783103c.tar.xz latinime-d244574be84119505d3712559b743c67a783103c.zip |
am fd959fd1: am 1903b41f: Merge "Clean up tests and increase speed"
* commit 'fd959fd15991717ca0f67851d38bf36052746596':
Clean up tests and increase speed
-rw-r--r-- | tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOTests.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOTests.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOTests.java index 6d39d929e..b704d08b3 100644 --- a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOTests.java +++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOTests.java @@ -51,7 +51,7 @@ import java.util.Set; @LargeTest public class BinaryDictIOTests extends AndroidTestCase { private static final String TAG = BinaryDictIOTests.class.getSimpleName(); - private static final int MAX_UNIGRAMS = 1000; + private static final int MAX_UNIGRAMS = 100; private static final int UNIGRAM_FREQ = 10; private static final int BIGRAM_FREQ = 50; private static final int TOLERANCE_OF_BIGRAM_FREQ = 5; @@ -135,11 +135,12 @@ public class BinaryDictIOTests extends AndroidTestCase { while (count > 0) { final long r = Math.abs(random.nextInt()); if (r < 0) continue; - // Don't insert 0~20, but insert any other code point. + // Don't insert 0~0x20, but insert any other code point. // Code points are in the range 0~0x10FFFF. - final int candidateCodePoint = (int)(20 + r % (0x10FFFF - 20)); - // Code points between 0xD800 and 0xDFFF are not valid. - if (candidateCodePoint >= 0xD800 && candidateCodePoint <= 0xDFFF) continue; + final int candidateCodePoint = (int)(0x20 + r % (Character.MAX_CODE_POINT - 0x20)); + // Code points between MIN_ and MAX_SURROGATE are not valid on their own. + if (candidateCodePoint >= Character.MIN_SURROGATE + && candidateCodePoint <= Character.MAX_SURROGATE) continue; builder.appendCodePoint(candidateCodePoint); --count; } |