]> gitweb.fperrin.net Git - DictionaryPC.git/blobdiff - src/com/hughes/android/dictionary/engine/DictionaryBuilderTest.java
go
[DictionaryPC.git] / src / com / hughes / android / dictionary / engine / DictionaryBuilderTest.java
index 493701560797633dd78ebaa67db30a38de59bdfb..c5152942e03c8fe8741544bd3fbe6a9421f72103 100644 (file)
@@ -11,41 +11,75 @@ import junit.framework.TestCase;
 
 public class DictionaryBuilderTest extends TestCase {
   
-  public void testGermanCombined() throws IOException {
-    final File result = new File("testdata/de_en.dict");
+  public void testWiktionaryCombined() throws Exception {
+    final File result = new File("testdata/wiktionary.quickdic");
     System.out.println("Writing to: " + result);
     DictionaryBuilder.main(new String[] {
         "--dictOut=" + result.getAbsolutePath(),
         "--lang1=DE",
         "--lang2=EN",
-        "--dictInfo=@testdata/de_en_dictInfo.txt",
+        "--dictInfo=SomeWikiData",
 
-        "--input1=testdata/de-en-chemnitz_100",
-        "--input1Name=dictcc",
+        "--input3=testdata/enwiktionary_small.xml",
+        "--input3Name=enwiktionary",
+        "--input3Format=enwiktionary",
+        "--input3TranslationPattern1=German|Italian|Spanish|French|Japanese|Arabic|Mandarin|Korean|Latin|Swedish|Croation|Serbian|Dutch|Afrikaans",
+        "--input3TranslationPattern2=English",
+        "--input3EnIndex=2",
+
+        "--print=testdata/wiktionary.test",
+    });
+    
+    // Check it once:
+    assertFilesEqual("testdata/wiktionary.golden", "testdata/wiktionary.test"); 
+    
+    
+    // Check it again.
+    final Dictionary dict = new Dictionary(new RandomAccessFile(result.getAbsolutePath(), "r"));
+    final PrintStream out = new PrintStream(new File("testdata/wiktionary.test"));
+    dict.print(out);
+    out.close();
+    
+    assertFilesEqual("testdata/wiktionary.golden", "testdata/wiktionary.test");
+  }
+
+  
+  public void testGermanCombined() throws Exception {
+    final File result = new File("testdata/de-en.quickdic");
+    System.out.println("Writing to: " + result);
+    DictionaryBuilder.main(new String[] {
+        "--dictOut=" + result.getAbsolutePath(),
+        "--lang1=DE",
+        "--lang2=EN",
+        "--dictInfo=@testdata/de-en_dictInfo.txt",
+
+        "--input1=testdata/de-en_chemnitz_100",
+        "--input1Name=chemnitz",
         "--input1Charset=UTF8",
         "--input1Format=chemnitz",
 
-        "--input2=testdata/de-en-dictcc_100",
+        "--input2=testdata/de-en_dictcc_100",
         "--input2Name=dictcc",
         "--input2Charset=UTF8",
         "--input2Format=dictcc",
-        
-        "--print=testdata/de_en.test",
+
+        "--print=testdata/de-en.test",
     });
     
     // Check it once:
-    assertFilesEqual("testdata/de_en.golden", "testdata/de_en.test"); 
+    assertFilesEqual("testdata/de-en.golden", "testdata/de-en.test"); 
     
     
     // Check it again.
     final Dictionary dict = new Dictionary(new RandomAccessFile(result.getAbsolutePath(), "r"));
-    final PrintStream out = new PrintStream(new File("testdata/de_en.test"));
+    final PrintStream out = new PrintStream(new File("testdata/de-en.test"));
     dict.print(out);
     out.close();
     
-    assertFilesEqual("testdata/de_en.golden", "testdata/de_en.test");
+    assertFilesEqual("testdata/de-en.golden", "testdata/de-en.test");
   }
-  
+
+
 
   void assertFilesEqual(final String expected, final String actual) throws IOException {
     final String expectedString = FileUtil.readToString(new File(expected));
@@ -53,4 +87,5 @@ public class DictionaryBuilderTest extends TestCase {
     assertEquals(expectedString, actualString);
   }
 
+  
 }