Use FormatSpec.VERSION4 instead of 4 for unit tests.

Bug: 10197478
Change-Id: I330bfa3f45b9e282b49ccde7868d49676506f268
main
Keisuke Kuroyanagi 2013-12-09 16:38:28 +09:00
parent 8317acad48
commit ddef88d0bf
2 changed files with 23 additions and 23 deletions

View File

@ -108,7 +108,7 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase {
attributeMap.put(FormatSpec.FileHeader.HAS_HISTORICAL_INFO_ATTRIBUTE, attributeMap.put(FormatSpec.FileHeader.HAS_HISTORICAL_INFO_ATTRIBUTE,
FormatSpec.FileHeader.ATTRIBUTE_VALUE_TRUE); FormatSpec.FileHeader.ATTRIBUTE_VALUE_TRUE);
if (BinaryDictionary.createEmptyDictFile(file.getAbsolutePath(), if (BinaryDictionary.createEmptyDictFile(file.getAbsolutePath(),
4 /* dictVersion */, attributeMap)) { FormatSpec.VERSION4, attributeMap)) {
return new File(file, FormatSpec.TRIE_FILE_EXTENSION); return new File(file, FormatSpec.TRIE_FILE_EXTENSION);
} else { } else {
throw new IOException("Empty dictionary " + file.getAbsolutePath() + " " throw new IOException("Empty dictionary " + file.getAbsolutePath() + " "
@ -117,7 +117,7 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase {
} }
public void testAddValidAndInvalidWords() { public void testAddValidAndInvalidWords() {
testAddValidAndInvalidWords(4 /* formatVersion */); testAddValidAndInvalidWords(FormatSpec.VERSION4);
} }
private void testAddValidAndInvalidWords(final int formatVersion) { private void testAddValidAndInvalidWords(final int formatVersion) {
@ -167,7 +167,7 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase {
} }
public void testDecayingProbability() { public void testDecayingProbability() {
testDecayingProbability(4 /* formatVersion */); testDecayingProbability(FormatSpec.VERSION4);
} }
private void testDecayingProbability(final int formatVersion) { private void testDecayingProbability(final int formatVersion) {
@ -225,7 +225,7 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase {
} }
public void testAddManyUnigramsToDecayingDict() { public void testAddManyUnigramsToDecayingDict() {
testAddManyUnigramsToDecayingDict(4 /* formatVersion */); testAddManyUnigramsToDecayingDict(FormatSpec.VERSION4);
} }
private void testAddManyUnigramsToDecayingDict(final int formatVersion) { private void testAddManyUnigramsToDecayingDict(final int formatVersion) {
@ -281,7 +281,7 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase {
} }
public void testAddManyBigramsToDecayingDict() { public void testAddManyBigramsToDecayingDict() {
testAddManyBigramsToDecayingDict(4 /* formatVersion */); testAddManyBigramsToDecayingDict(FormatSpec.VERSION4);
} }
private void testAddManyBigramsToDecayingDict(final int formatVersion) { private void testAddManyBigramsToDecayingDict(final int formatVersion) {

View File

@ -54,7 +54,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
private File createEmptyDictionaryAndGetFile(final String dictId, private File createEmptyDictionaryAndGetFile(final String dictId,
final int formatVersion) throws IOException { final int formatVersion) throws IOException {
if (formatVersion == 4) { if (formatVersion == FormatSpec.VERSION4) {
return createEmptyVer4DictionaryAndGetFile(dictId); return createEmptyVer4DictionaryAndGetFile(dictId);
} else { } else {
throw new IOException("Dictionary format version " + formatVersion throw new IOException("Dictionary format version " + formatVersion
@ -71,7 +71,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
attributeMap.put(FormatSpec.FileHeader.SUPPORTS_DYNAMIC_UPDATE_ATTRIBUTE, attributeMap.put(FormatSpec.FileHeader.SUPPORTS_DYNAMIC_UPDATE_ATTRIBUTE,
FormatSpec.FileHeader.ATTRIBUTE_VALUE_TRUE); FormatSpec.FileHeader.ATTRIBUTE_VALUE_TRUE);
if (BinaryDictionary.createEmptyDictFile(file.getAbsolutePath(), if (BinaryDictionary.createEmptyDictFile(file.getAbsolutePath(),
4 /* dictVersion */, attributeMap)) { FormatSpec.VERSION4, attributeMap)) {
return new File(file, FormatSpec.TRIE_FILE_EXTENSION); return new File(file, FormatSpec.TRIE_FILE_EXTENSION);
} else { } else {
throw new IOException("Empty dictionary " + file.getAbsolutePath() + " " throw new IOException("Empty dictionary " + file.getAbsolutePath() + " "
@ -80,7 +80,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
} }
public void testIsValidDictionary() { public void testIsValidDictionary() {
testIsValidDictionary(4 /* formatVersion */); testIsValidDictionary(FormatSpec.VERSION4);
} }
private void testIsValidDictionary(final int formatVersion) { private void testIsValidDictionary(final int formatVersion) {
@ -122,7 +122,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
} }
public void testAddUnigramWord() { public void testAddUnigramWord() {
testAddUnigramWord(4 /* formatVersion */); testAddUnigramWord(FormatSpec.VERSION4);
} }
private void testAddUnigramWord(final int formatVersion) { private void testAddUnigramWord(final int formatVersion) {
@ -164,7 +164,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
} }
public void testRandomlyAddUnigramWord() { public void testRandomlyAddUnigramWord() {
testRandomlyAddUnigramWord(4 /* formatVersion */); testRandomlyAddUnigramWord(FormatSpec.VERSION4);
} }
private void testRandomlyAddUnigramWord(final int formatVersion) { private void testRandomlyAddUnigramWord(final int formatVersion) {
@ -200,7 +200,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
} }
public void testAddBigramWords() { public void testAddBigramWords() {
testAddBigramWords(4 /* formatVersion */); testAddBigramWords(FormatSpec.VERSION4);
} }
private void testAddBigramWords(final int formatVersion) { private void testAddBigramWords(final int formatVersion) {
@ -268,7 +268,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
} }
public void testRandomlyAddBigramWords() { public void testRandomlyAddBigramWords() {
testRandomlyAddBigramWords(4 /* formatVersion */); testRandomlyAddBigramWords(FormatSpec.VERSION4);
} }
private void testRandomlyAddBigramWords(final int formatVersion) { private void testRandomlyAddBigramWords(final int formatVersion) {
@ -329,7 +329,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
} }
public void testRemoveBigramWords() { public void testRemoveBigramWords() {
testRemoveBigramWords(4 /* formatVersion */); testRemoveBigramWords(FormatSpec.VERSION4);
} }
private void testRemoveBigramWords(final int formatVersion) { private void testRemoveBigramWords(final int formatVersion) {
@ -379,7 +379,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
} }
public void testFlushDictionary() { public void testFlushDictionary() {
testFlushDictionary(4 /* formatVersion */); testFlushDictionary(FormatSpec.VERSION4);
} }
private void testFlushDictionary(final int formatVersion) { private void testFlushDictionary(final int formatVersion) {
@ -431,7 +431,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
} }
public void testFlushWithGCDictionary() { public void testFlushWithGCDictionary() {
testFlushWithGCDictionary(4 /* formatVersion */); testFlushWithGCDictionary(FormatSpec.VERSION4);
} }
private void testFlushWithGCDictionary(final int formatVersion) { private void testFlushWithGCDictionary(final int formatVersion) {
@ -479,7 +479,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
} }
public void testAddBigramWordsAndFlashWithGC() { public void testAddBigramWordsAndFlashWithGC() {
testAddBigramWordsAndFlashWithGC(4 /* formatVersion */); testAddBigramWordsAndFlashWithGC(FormatSpec.VERSION4);
} }
// TODO: Evaluate performance of GC // TODO: Evaluate performance of GC
@ -548,7 +548,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
} }
public void testRandomOperationsAndFlashWithGC() { public void testRandomOperationsAndFlashWithGC() {
testRandomOperationsAndFlashWithGC(4 /* formatVersion */); testRandomOperationsAndFlashWithGC(FormatSpec.VERSION4);
} }
private void testRandomOperationsAndFlashWithGC(final int formatVersion) { private void testRandomOperationsAndFlashWithGC(final int formatVersion) {
@ -659,7 +659,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
} }
public void testAddManyUnigramsAndFlushWithGC() { public void testAddManyUnigramsAndFlushWithGC() {
testAddManyUnigramsAndFlushWithGC(4 /* formatVersion */); testAddManyUnigramsAndFlushWithGC(FormatSpec.VERSION4);
} }
private void testAddManyUnigramsAndFlushWithGC(final int formatVersion) { private void testAddManyUnigramsAndFlushWithGC(final int formatVersion) {
@ -707,7 +707,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
} }
public void testUnigramAndBigramCount() { public void testUnigramAndBigramCount() {
testUnigramAndBigramCount(4 /* formatVersion */); testUnigramAndBigramCount(FormatSpec.VERSION4);
} }
private void testUnigramAndBigramCount(final int formatVersion) { private void testUnigramAndBigramCount(final int formatVersion) {
@ -766,7 +766,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
} }
public void testAddMultipleDictionaryEntries() { public void testAddMultipleDictionaryEntries() {
testAddMultipleDictionaryEntries(4 /* formatVersion */); testAddMultipleDictionaryEntries(FormatSpec.VERSION4);
} }
private void testAddMultipleDictionaryEntries(final int formatVersion) { private void testAddMultipleDictionaryEntries(final int formatVersion) {
@ -828,7 +828,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
} }
public void testGetUnigramProperties() { public void testGetUnigramProperties() {
testGetUnigramProperties(4 /* formatVersion */); testGetUnigramProperties(FormatSpec.VERSION4);
} }
private void testGetUnigramProperties(final int formatVersion) { private void testGetUnigramProperties(final int formatVersion) {
@ -875,7 +875,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
} }
public void testAddShortcuts() { public void testAddShortcuts() {
testAddShortcuts(4 /* formatVersion */); testAddShortcuts(FormatSpec.VERSION4);
} }
private void testAddShortcuts(final int formatVersion) { private void testAddShortcuts(final int formatVersion) {
@ -933,7 +933,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
} }
public void testAddManyShortcuts() { public void testAddManyShortcuts() {
testAddManyShortcuts(4 /* formatVersion */); testAddManyShortcuts(FormatSpec.VERSION4);
} }
private void testAddManyShortcuts(final int formatVersion) { private void testAddManyShortcuts(final int formatVersion) {