]> gitweb.fperrin.net Git - DictionaryPC.git/blobdiff - src/com/hughes/android/dictionary/engine/DictionaryBuilderTest.java
Expand italian test to get verb conjuations.
[DictionaryPC.git] / src / com / hughes / android / dictionary / engine / DictionaryBuilderTest.java
index 59de98fa13b071db22e386385ab6b616691cb145..791d55014b9e889ea4b5dab518ed235890b333be 100644 (file)
@@ -29,12 +29,38 @@ import junit.framework.TestCase;
 public class DictionaryBuilderTest extends TestCase {
   
   public static final String TEST_INPUTS = "testdata/inputs/";
-  public static final String WIKISPLIT = "data/inputs/wikiSplit/en/";
+  public static final String WIKISPLIT_EN = "data/inputs/wikiSplit/en/";
   public static final String STOPLISTS = "data/inputs/stoplists/";
   public static final String GOLDENS = "testdata/goldens/";
 
   public static final String TEST_OUTPUTS = "testdata/outputs/";
 
+  public void doTestCustomDict(final String name, final String lang1,
+      final String lang2, final String inputFile) throws Exception {
+    final File result = new File(TEST_OUTPUTS + name);
+    System.out.println("Writing to: " + result);
+    DictionaryBuilder.main(new String[] {
+        "--dictOut=" + result.getAbsolutePath(),
+        "--lang1=" + lang1,
+        "--lang2=" + lang2,
+        "--lang1Stoplist=" + STOPLISTS + "empty.txt",
+        "--lang2Stoplist=" + STOPLISTS + "empty.txt",
+        "--dictInfo=bleh.",
+        
+        "--input1=testdata/inputs/" + inputFile,
+        "--input1Name=my_input_" + name,
+        "--input1Charset=ISO-8859-1",
+        "--input1Format=tab_separated",
+
+        "--print=" + result.getPath() + ".text",
+    });
+    
+    checkGolden(name, result); 
+  }
+  
+  public void test_FR_NL() throws Exception {
+    doTestCustomDict("QuickDic-FR-NL.quickdic", "FR", "NL", "QuickDic-FR-NL.txt");
+  }
   
   public void testWiktionary_en_de2fr() throws Exception {
     wiktionaryTestWithEnTrans2Trans("wiktionary.de_fr.quickdic", "DE", "FR");
@@ -52,7 +78,7 @@ public class DictionaryBuilderTest extends TestCase {
         "--lang2Stoplist=" + STOPLISTS + "empty.txt",
         "--dictInfo=SomeWikiDataTrans2Trans",
 
-        "--input4=" + WIKISPLIT + "EN.data",
+        "--input4=" + WIKISPLIT_EN + "EN.data",
         "--input4Name=" + name,
         "--input4Format=" + EnTranslationToTranslationParser.NAME,
         "--input4LangPattern1=" + lang1,
@@ -66,18 +92,19 @@ public class DictionaryBuilderTest extends TestCase {
   }
 
   public void testWiktionary_WholeSection_DE() throws Exception {
-    wiktionaryTestWithWholeSectionToHtml("wiktionary.WholeSection.DE.quickdic", "DE");
+    wiktionaryTestWithWholeSectionToHtml("wiktionary.WholeSection.DE.quickdic", "DE", 100);
   }
 
   public void testWiktionary_WholeSection_EN() throws Exception {
-    wiktionaryTestWithWholeSectionToHtml("wiktionary.WholeSection.EN.quickdic", "EN");
+    wiktionaryTestWithWholeSectionToHtml("wiktionary.WholeSection.EN.quickdic", "EN", 100);
   }
 
   public void testWiktionary_WholeSection_IT() throws Exception {
-    wiktionaryTestWithWholeSectionToHtml("wiktionary.WholeSection.IT.quickdic", "IT");
+    // Have to run to 800 to get a few verb conjugations (including essere!)
+    wiktionaryTestWithWholeSectionToHtml("wiktionary.WholeSection.IT.quickdic", "IT", 800);
   }
 
-  public void wiktionaryTestWithWholeSectionToHtml(final String name, final String langCode) throws Exception {
+  public void wiktionaryTestWithWholeSectionToHtml(final String name, final String langCode, final int pageLimit) throws Exception {
     final File result = new File(TEST_OUTPUTS + name);
     System.out.println("Writing to: " + result);
     DictionaryBuilder.main(new String[] {
@@ -88,11 +115,13 @@ public class DictionaryBuilderTest extends TestCase {
         "--lang2Stoplist=" + STOPLISTS + "empty.txt",
         "--dictInfo=SomeWikiDataWholeSection",
 
-        "--input4=" + WIKISPLIT + langCode + ".data",
+        "--input4=" + WIKISPLIT_EN + langCode + ".data",
         "--input4Name=" + name,
         "--input4Format=" + WholeSectionToHtmlParser.NAME,
+        "--input4WiktionaryLang=EN",
+        "--input4SkipLang=" + langCode,
         "--input4TitleIndex=" + "1",
-        "--input4PageLimit=100",
+        "--input4PageLimit=" + pageLimit,
 
         "--print=" + result.getPath() + ".text",
     });
@@ -168,7 +197,7 @@ public class DictionaryBuilderTest extends TestCase {
         "--lang2Stoplist=" + STOPLISTS + "en.txt",
         "--dictInfo=SomeWikiData",
 
-        "--input4=" + WIKISPLIT + data,
+        "--input4=" + WIKISPLIT_EN + data,
         "--input4Name=" + dictName,
         "--input4Format=enwiktionary",
         "--input4WiktionaryType=" + type,