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