-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package org.dts.spell.tests; | ||
|
||
|
||
import org.dts.spell.SpellChecker; | ||
import org.dts.spell.dictionary.OpenOfficeSpellDictionary; | ||
import org.dts.spell.dictionary.SpellDictionary; | ||
import org.junit.Test; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.nio.file.Files; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class InterlinguaTest extends TestBase { | ||
|
||
private static final String DICTIONARY_ZIP = "ia.zip"; | ||
|
||
@Override | ||
protected String getDictionary() { | ||
return DICTIONARY_ZIP; | ||
} | ||
|
||
@Test | ||
public void testInterlinguaZipLoad() throws IOException { | ||
try (InputStream is = getClass().getResourceAsStream(DICTIONARY_ZIP)) { | ||
SpellDictionary dict = new OpenOfficeSpellDictionary(is, personalDictionary, false); | ||
SpellChecker checker = new SpellChecker(dict); | ||
checker.setCaseSensitive(false); | ||
String word = "Die"; | ||
assertThat(checker.isCorrect(word)).isTrue(); | ||
} | ||
} | ||
|
||
@Test | ||
public void testInterlinguaFileLoad() throws IOException { | ||
try (InputStream affFile = Files.newInputStream(tempDir.resolve("ia/index.aff")); | ||
InputStream dicFile = Files.newInputStream(tempDir.resolve("ia/index.dic"))) { | ||
SpellDictionary dict = new OpenOfficeSpellDictionary(affFile, dicFile, personalDictionary, false); | ||
SpellChecker checker = new SpellChecker(dict); | ||
checker.setCaseSensitive(false); | ||
String word = "Die"; | ||
assertThat(checker.isCorrect(word)).isTrue(); | ||
} | ||
} | ||
|
||
@Test | ||
public void testInterlinguaFileLoadBackground() throws IOException { | ||
try (InputStream affFile = Files.newInputStream(tempDir.resolve("ia/index.aff")); | ||
InputStream dicFile = Files.newInputStream(tempDir.resolve("ia/index.dic"))) { | ||
SpellDictionary dict = new OpenOfficeSpellDictionary(affFile, dicFile, personalDictionary, true); | ||
SpellChecker checker = new SpellChecker(dict); | ||
checker.setCaseSensitive(false); | ||
String word = "Die"; | ||
assertThat(checker.isCorrect(word)).isTrue(); | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters