]> gitweb.fperrin.net Git - DictionaryPC.git/blobdiff - src/com/hughes/android/dictionary/engine/DictionaryBuilderTest.java
Added WholeSection entries and parser.
[DictionaryPC.git] / src / com / hughes / android / dictionary / engine / DictionaryBuilderTest.java
index ffd1d7eb696da93358df329353a3e1ac04150ed2..59de98fa13b071db22e386385ab6b616691cb145 100644 (file)
@@ -21,6 +21,7 @@ import java.io.PrintStream;
 import java.io.RandomAccessFile;
 
 import com.hughes.android.dictionary.parser.wiktionary.EnTranslationToTranslationParser;
+import com.hughes.android.dictionary.parser.wiktionary.WholeSectionToHtmlParser;
 import com.hughes.util.FileUtil;
 
 import junit.framework.TestCase;
@@ -64,6 +65,40 @@ public class DictionaryBuilderTest extends TestCase {
     checkGolden(name, result); 
   }
 
+  public void testWiktionary_WholeSection_DE() throws Exception {
+    wiktionaryTestWithWholeSectionToHtml("wiktionary.WholeSection.DE.quickdic", "DE");
+  }
+
+  public void testWiktionary_WholeSection_EN() throws Exception {
+    wiktionaryTestWithWholeSectionToHtml("wiktionary.WholeSection.EN.quickdic", "EN");
+  }
+
+  public void testWiktionary_WholeSection_IT() throws Exception {
+    wiktionaryTestWithWholeSectionToHtml("wiktionary.WholeSection.IT.quickdic", "IT");
+  }
+
+  public void wiktionaryTestWithWholeSectionToHtml(final String name, final String langCode) throws Exception {
+    final File result = new File(TEST_OUTPUTS + name);
+    System.out.println("Writing to: " + result);
+    DictionaryBuilder.main(new String[] {
+        "--dictOut=" + result.getAbsolutePath(),
+        "--lang1=" + langCode,
+        "--lang2=" + "EN",
+        "--lang1Stoplist=" + STOPLISTS + "empty.txt",
+        "--lang2Stoplist=" + STOPLISTS + "empty.txt",
+        "--dictInfo=SomeWikiDataWholeSection",
+
+        "--input4=" + WIKISPLIT + langCode + ".data",
+        "--input4Name=" + name,
+        "--input4Format=" + WholeSectionToHtmlParser.NAME,
+        "--input4TitleIndex=" + "1",
+        "--input4PageLimit=100",
+
+        "--print=" + result.getPath() + ".text",
+    });
+    checkGolden(name, result); 
+  }
+
   
   public void testWiktionary_IT_EN() throws Exception {
     wiktionaryTestWithLangToEn("wiktionary.it_en.quickdic", "IT", "it.txt",