am b242ce4e: Merge "Add a two-args constructor to BinaryDictIOTests"

* commit 'b242ce4e6b599f568bb3bae5749a9e5f65e6a773':
  Add a two-args constructor to BinaryDictIOTests
main
Jean Chalard 2013-07-04 02:16:23 -07:00 committed by Android Git Automerger
commit 8c80b1f14b
1 changed files with 8 additions and 6 deletions

View File

@ -51,7 +51,7 @@ import java.util.Set;
@LargeTest @LargeTest
public class BinaryDictIOTests extends AndroidTestCase { public class BinaryDictIOTests extends AndroidTestCase {
private static final String TAG = BinaryDictIOTests.class.getSimpleName(); private static final String TAG = BinaryDictIOTests.class.getSimpleName();
private static final int MAX_UNIGRAMS = 100; private static final int DEFAULT_MAX_UNIGRAMS = 100;
private static final int UNIGRAM_FREQ = 10; private static final int UNIGRAM_FREQ = 10;
private static final int BIGRAM_FREQ = 50; private static final int BIGRAM_FREQ = 50;
private static final int TOLERANCE_OF_BIGRAM_FREQ = 5; private static final int TOLERANCE_OF_BIGRAM_FREQ = 5;
@ -73,13 +73,15 @@ public class BinaryDictIOTests extends AndroidTestCase {
new FormatSpec.FormatOptions(3, true /* supportsDynamicUpdate */); new FormatSpec.FormatOptions(3, true /* supportsDynamicUpdate */);
public BinaryDictIOTests() { public BinaryDictIOTests() {
super(); this(System.currentTimeMillis(), DEFAULT_MAX_UNIGRAMS);
}
final long time = System.currentTimeMillis(); public BinaryDictIOTests(final long seed, final int maxUnigrams) {
Log.e(TAG, "Testing dictionary: seed is " + time); super();
final Random random = new Random(time); Log.e(TAG, "Testing dictionary: seed is " + seed);
final Random random = new Random(seed);
sWords.clear(); sWords.clear();
generateWords(MAX_UNIGRAMS, random); generateWords(maxUnigrams, random);
for (int i = 0; i < sWords.size(); ++i) { for (int i = 0; i < sWords.size(); ++i) {
sChainBigrams.put(i, new ArrayList<Integer>()); sChainBigrams.put(i, new ArrayList<Integer>());