n.c.
[chise/ruby.git] / test / test-idsdb.rb
index e960397..eda3493 100755 (executable)
@@ -3,24 +3,55 @@
 
 require "common"
 require "chise/idsdb"
+require "chise/management"
+
+#class TestIDS_DB < Test::Unit::TestCase
+class TestIDS_DB
+  def check_ccs_db(cd)
+    cd.each_line {|code, ids|
+      assert_instance_of(String, code)
+      assert_instance_of(String, ids)
+    }
+    cd.each_character {|char, ids|
+      assert_instance_of(CHISE::Character, char)
+      assert_instance_of(String, ids)
+    }
+  end
 
-class TestIDS_DB < Test::Unit::TestCase
   def test_ids_db
     @idb = CHISE::IDS_DB.instance
     assert_instance_of(CHISE::IDS_DB, @idb)
     @idb.each_ccs {|ccs|
       cd = @idb.get_ccs(ccs)
       assert_instance_of(CHISE::IDS_CCS_DB, cd)
+      #check_ccs_db(cd)
     }
+    cd = @idb.get_ccs("JIS-X0208-1990")
+    check_ccs_db(cd)
+  end
+end
 
-    @cd = @idb.get_ccs("JIS-X0208-1990")
-    @cd.each_line {|code, ids|
-      assert_instance_of(String, code)
-      assert_instance_of(String, ids)
-    }
-    @cd.each_entry {|char, ids|
-      assert_instance_of(CHISE::Character, char)
-      assert_instance_of(String, ids)
-    }
+class TestIDS_DB_Management < Test::Unit::TestCase
+  def test_management
+    man = CHISE::IDS_DB_Management.new
+    # make sure there is no conflict
+    #man.check_conflict_of_ids_text # 167.499 seconds.
+    #man.store_ids_as_text # 172.024 seconds.
+    #man.store_ids_de_er # 47.99 seconds.
+    #man.check_integrity_of_ids_tree # 58.185 seconds.
+    #man.make_by_ids_db # 29.572 seconds.
+
+=begin
+    db = IDS_DB.instance
+#    db.make_ids_db #1時間12分
+#    IDS_TEXT_DB.instance.make_ids_error #4分
+#    db.make_ids_reverse #2分
+    db.dump_ids_duplicated #1分
+    db.make_ids_aggregated #5分
+    db.dump_ids_aggregated #1分
+    db.make_ids_parts #30分
+    db.make_ids_contained #2分
+    #db.make_ids_decomposed #2分→おわらなかった…。
+=end
   end
 end