2 # Copyright (C) 2002-2004 Kouichirou Eto, All rights reserved.
5 $LOAD_PATH.unshift("..")
10 class TestLibChise < Test::Unit::TestCase
12 db_dir = CHISE::DB_DIR
13 assert_equal("/cygdrive/c/chise/chise-db", db_dir)
15 @ds = CHISE::DataSource.new(CHISE::DataSource::Berkeley_DB, db_dir, 0, 0755)
16 assert_instance_of(CHISE::DataSource, @ds)
18 char_id = @ds.decode_char("=daikanwa", 364)
19 assert_equal(0x4ECF, char_id)
21 ccs = @ds.get_ccs("=daikanwa")
22 assert_instance_of(CHISE::CCS, ccs)
23 char_id = ccs.decode(364)
24 assert_equal(0x4ECF, char_id)
26 feature = @ds.get_feature("ideographic-structure")
27 assert_instance_of(CHISE::Feature, feature)
28 value = feature.get_value(char_id)
29 assert_instance_of(CHISE::Value, value)
30 assert_equal("(?\342\277\260 ?\344\272\273 ?\345\216\266)", value.to_s)
32 @ds.each_feature_name {|name|
33 assert_instance_of(String, name)
36 feature = @ds.get_feature("numeric-value")
37 feature.each_char {|cid, valdatum|
38 assert_kind_of(Numeric, cid)
39 assert_instance_of(CHISE::Value, valdatum)
41 ucs = @ds.get_feature("=ucs").get_value(cid)
43 assert_instance_of(CHISE::Value, ucs)
45 ucs = @ds.get_feature("=>ucs").get_value(cid)
47 assert_instance_of(CHISE::Value, ucs)
51 name = @ds.get_feature("name").get_value(cid)
53 assert_instance_of(CHISE::Value, name)