n.c.
[chise/ruby.git] / test / test-idsdb.rb
1 #!/usr/bin/env ruby
2 # Copyright (C) 2002-2004 Kouichirou Eto, All rights reserved.
3
4 require "common"
5 require "chise/idsdb"
6 require "chise/management"
7
8 #class TestIDS_DB < Test::Unit::TestCase
9 class TestIDS_DB
10   def check_ccs_db(cd)
11     cd.each_line {|code, ids|
12       assert_instance_of(String, code)
13       assert_instance_of(String, ids)
14     }
15     cd.each_character {|char, ids|
16       assert_instance_of(CHISE::Character, char)
17       assert_instance_of(String, ids)
18     }
19   end
20
21   def test_ids_db
22     @idb = CHISE::IDS_DB.instance
23     assert_instance_of(CHISE::IDS_DB, @idb)
24     @idb.each_ccs {|ccs|
25       cd = @idb.get_ccs(ccs)
26       assert_instance_of(CHISE::IDS_CCS_DB, cd)
27       #check_ccs_db(cd)
28     }
29     cd = @idb.get_ccs("JIS-X0208-1990")
30     check_ccs_db(cd)
31   end
32 end
33
34 class TestIDS_DB_Management < Test::Unit::TestCase
35   def test_management
36     man = CHISE::IDS_DB_Management.new
37     # make sure there is no conflict
38     #man.check_conflict_of_ids_text # 167.499 seconds.
39     #man.store_ids_as_text # 172.024 seconds.
40     #man.store_ids_de_er # 47.99 seconds.
41     #man.check_integrity_of_ids_tree # 58.185 seconds.
42     #man.make_by_ids_db # 29.572 seconds.
43
44 =begin
45     db = IDS_DB.instance
46 #    db.make_ids_db #1時間12分
47 #    IDS_TEXT_DB.instance.make_ids_error #4分
48 #    db.make_ids_reverse #2分
49     db.dump_ids_duplicated #1分
50     db.make_ids_aggregated #5分
51     db.dump_ids_aggregated #1分
52     db.make_ids_parts #30分
53     db.make_ids_contained #2分
54     #db.make_ids_decomposed #2分→おわらなかった…。
55 =end
56   end
57 end