update.
[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       ruby    : ext
38     #man.check_conflict_of_ids_text     #  151.633 : 150.287
39     #man.store_ids_as_text              #  172.024 : 177.618    86470
40     #man.store_ids_de_er                #   47.99  :  38.926    81899
41     #man.check_integrity_of_ids_tree    #   58.185 :  48.015    79417
42     man.make_by_ids_db_org              #   29.572 :  24.511    75562
43     #man.store_ids_aggregated           #   66.609 :  51.832    79417
44     #man.store_ids_subparts             # 1638.966 : 959.413    79417
45     #man.store_ids_contained            #  773.808 : 696.374
46     #man.make_by_ids_db                 #   28.071 :  31.0
47   end
48 end