n.c.
[chise/ruby.git] / test / org-test-char.rb
1 #!/usr/bin/env ruby
2 # Copyright (C) 2002-2004 Kouichirou Eto, All rights reserved.
3
4 require "common"
5
6 class TestCharacter < Test::Unit::TestCase
7
8   def test_method
9     @char = CHISE::Character.get("字") #UTF8で与えること
10     assert_instance_of(Hash, @char.char_attribute_alist)
11     assert_instance_of(Hash, @char.alist)
12     assert_instance_of(Array, @char.char_attribute_list)
13     assert_instance_of(Array, @char.list)
14     assert_instance_of(String, @char.inspect)
15   end
16
17   def test_jis
18     char = CHISE::Character.get("逢")
19     assert_instance_of(String, char.get_attributes)
20     char = CHISE::Character.get("学")
21     assert_instance_of(String, char.get_attributes)
22   end
23
24   def p_er(er)
25     p er.de_er.char.inspect_all
26   end
27
28   def nu_test_has_attribute
29     assert("&J90-4833;".de_er.char.has_attribute?) #罪
30     assert(! "&MCS-00E06E9B;;".de_er.char.has_attribute?) #罪のisolated character, attributeを持ってない
31     assert("&C1-602E;".de_er.char.has_attribute?) #渡
32     assert("&J90-454F;".de_er.char.has_attribute?) #渡
33     p_er("&C1-602E;") #渡
34     p_er("&J90-454F;")
35     p_er("&J83-4D63;") #翼
36     p_er("&J90-4D63;")
37     p_er("&J83-3958;") #購
38     p_er("&J90-3958;")
39   end
40 end
41
42 #===== PRINT_ALL [字] MCS-00005B57 &J90-3B7A; =====
43 #chinese-gb2312: 0x5756
44 #chinese-isoir165: 0x5756
45 #korean-ksc5601: 0x6D2E
46 #ucs: 0x5B57
47 #chinese-cns11643-1: 0x4773
48 #chinese-big5: 0xA672
49
50 #  test_print(CHISE::Character.get("&CDP-8B42;"))
51 #  test_print(CHISE::Character.get("&I-CDP-8AF6;"))
52 #===== PRINT_ALL [舛] MCS-00ECA524 &K0-743F; =====