diff options
author | 2013-06-28 19:58:34 +0900 | |
---|---|---|
committer | 2013-07-01 15:28:32 +0900 | |
commit | 4b7acd1df6610fbe24eab04b72763de152f24176 (patch) | |
tree | 0c0dde0d2d8d779a999a74eac84ebba284182d6b /tests/src | |
parent | 8142a7b637326e8fe8736de94246b1fffb4f2886 (diff) | |
download | latinime-4b7acd1df6610fbe24eab04b72763de152f24176.tar.gz latinime-4b7acd1df6610fbe24eab04b72763de152f24176.tar.xz latinime-4b7acd1df6610fbe24eab04b72763de152f24176.zip |
Add args to dicttool test.
Change-Id: I0667e0a5a6f6db3964cfcca5c8f083b9ceb41a2e
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtilsTests.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtilsTests.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtilsTests.java index d33142ce0..9331da44b 100644 --- a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtilsTests.java +++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtilsTests.java @@ -44,9 +44,10 @@ public class BinaryDictIOUtilsTests extends AndroidTestCase { private static final String TAG = BinaryDictIOUtilsTests.class.getSimpleName(); private static final FormatSpec.FormatOptions FORMAT_OPTIONS = new FormatSpec.FormatOptions(3, true); - private static final int MAX_UNIGRAMS = 1500; private static final ArrayList<String> sWords = CollectionUtils.newArrayList(); + public static final int DEFAULT_MAX_UNIGRAMS = 1500; + private final int mMaxUnigrams; private static final String[] CHARACTERS = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", @@ -57,15 +58,17 @@ public class BinaryDictIOUtilsTests extends AndroidTestCase { }; public BinaryDictIOUtilsTests() { - this(System.currentTimeMillis()); + // 1500 is the default max unigrams + this(System.currentTimeMillis(), DEFAULT_MAX_UNIGRAMS); } - public BinaryDictIOUtilsTests(final long seed) { + public BinaryDictIOUtilsTests(final long seed, final int maxUnigrams) { super(); - Log.d(TAG, "Seed for test is " + seed); + Log.d(TAG, "Seed for test is " + seed + ", maxUnigrams is " + maxUnigrams); + mMaxUnigrams = maxUnigrams; final Random random = new Random(seed); sWords.clear(); - for (int i = 0; i < MAX_UNIGRAMS; ++i) { + for (int i = 0; i < maxUnigrams; ++i) { sWords.add(generateWord(random.nextInt())); } } @@ -395,6 +398,6 @@ public class BinaryDictIOUtilsTests extends AndroidTestCase { Log.d(TAG, "max = " + ((double)maxTimeToInsert/1000000) + " ms."); Log.d(TAG, "min = " + ((double)minTimeToInsert/1000000) + " ms."); - Log.d(TAG, "avg = " + ((double)sum/MAX_UNIGRAMS/1000000) + " ms."); + Log.d(TAG, "avg = " + ((double)sum/mMaxUnigrams/1000000) + " ms."); } } |