class TC_Character < Test::Unit::TestCase
def setup() @char = Character.get("字") end #UTF8で与えること
def test_char(char)
-# assert_equal(23383, char.char_id, "translate to char_id")
# assert_equal(6, char.get_char_attribute('total_strokes'), "get total strokes by XEmacs UTF-2000 like method")
assert_equal(6, char['total_strokes'], "get total strokes by Hash like method") if char.is_a? Character
assert_equal(6, char.total_strokes, "get total strokes by method")
assert_equal(23383, char.ucs, "translate to ucs")
- assert_equal(22358, char.chinese_gb2312, "get character code in chinese GB2312")
+ assert_equal(22358, char.gb2312, "get character code in chinese GB2312")
assert_equal(1777, char.shinjigen_2, "get shinjigen 2")
assert_equal(3, char.ideographic_strokes, "get")
assert_equal(39, char.ideographic_radical, "get")
assert_equal(Character.get("&J90-3B7A;"), @char, "jisx0208")
# assert_equal("&J90-3B7A;", @char.to_er, "jisx0208")
assert_equal(Character.get("&MCS-00005B57;"), @char, "mcs")
- assert_equal(Character.get("&M-06942;"), @char, "ideograph-daikanwa, Morohashi")
+# assert_equal(Character.get("&M-06942;"), @char, "ideograph-daikanwa, Morohashi")
end
def test_latin
char = Character.get("A")
- assert_equal(char.ascii, 65, "ascii")
+ assert_equal(65, char.ascii, "ascii")
assert_equal(char.bidi_category, "L", "bidi")
assert_equal(char.name, "LATIN CAPITAL LETTER A", "name")
- assert_equal(char.ucs, 65, "ucs")
+ assert_equal(65, char.ucs, "ucs")
assert_equal(char.latin_jisx0201, 65, "jisx0201")
assert_equal(char.latin_viscii, 65, "viscii") #って何?
#->fullwidth: (((name . "FULLWIDTH LATIN CAPITAL LETTER A") (ucs . 65313)))
end
def test_ids
char = Character.get("⿰")
- assert_equal(char.name, "IDEOGRAPHIC DESCRIPTION CHARACTER LEFT TO RIGHT", "ids name")
+ assert_equal("IDEOGRAPHIC DESCRIPTION CHARACTER LEFT TO RIGHT", char.name, "ids name")
#assert_equal(char.to_er, "&U+2FF0;", "ids er")
assert_equal(char.to_er, "⿰", "ids er")
assert_equal(char.bidi_category, "ON", "ids bidi")
assert_equal(0x5B57, "字".ucs)
assert_equal(0x5B57, @char.ucs)
- assert_equal(0xfa55, "突".char['=>ucs-jis'])
- assert_equal(0xfa55, "突".map_ucs_jis)
+ assert_equal(0xfa55, "突".char['=>ucs@jis'])
+ assert_equal(0xfa55, "突".map_ucs_at_jis)
char1 = Character.get("23383")
char2 = Character.get(23383)
char2 = Character.get(2)
assert_not_equal(char1, char2)
- assert_equal("(((name . \"FULLWIDTH DIGIT ONE\") (ucs . 65297)))", "1".char['->fullwidth'])
- assert_equal("(((name . \"FULLWIDTH DIGIT ONE\") (ucs . 65297)))", "1".char.to_fullwidth)
- assert_equal("(((name . \"DIGIT ONE\") (ucs . 49)))", "1".char['<-fullwidth'])
- assert_equal("(((name . \"DIGIT ONE\") (ucs . 49)))", "1".char.from_fullwidth)
+ assert_equal("(((name . \"FULLWIDTH DIGIT ONE\") (=ucs . 65297)))", "1".char['->fullwidth'])
+ assert_equal("(((name . \"FULLWIDTH DIGIT ONE\") (=ucs . 65297)))", "1".char.to_fullwidth)
+ assert_equal("(((name . \"DIGIT ONE\") (=ucs . 49)))", "1".char['<-fullwidth'])
+ assert_equal("(((name . \"DIGIT ONE\") (=ucs . 49)))", "1".char.from_fullwidth)
end
def teardown() @char = nil end
end
assert_equal("文字字", "文&J90-3B7A;&J90-3B7A;".de_er, "two ERs")
assert_equal("文字文字", "文&J90-3B7A;文&J90-3B7A;".de_er, "two ERs")
assert_equal("文字", "文&MCS-00005B57;".de_er, "mcs")
- assert_equal("文字", "文&M-06942;".de_er, "morohashi")
+# assert_equal("文字", "文&M-06942;".de_er, "morohashi")
assert_equal("字", "字".de_er)
str = "文&J90-3B7A;"
ins = "字".inspect_all
# assert_match(/^<字,J90-3B7A,/, ins)
- assert_match(/chinese-big5:42610/, ins)
- assert_match(/chinese-cns11643-1:18291/, ins)
- assert_match(/chinese-gb2312:22358/, ins)
- assert_match(/chinese-isoir165:22358/, ins)
- assert_match(/ideograph-daikanwa:6942/, ins)
+ assert_match(/^<字,#x5b57,/, ins)
+ assert_match(/=big5:42610/, ins)
+ assert_match(/=cns11643-1:18291/, ins)
+ assert_match(/=gb2312:22358/, ins)
+ assert_match(/=daikanwa:6942/, ins)
assert_match(/ideographic-radical:39/, ins)
assert_match(/ideographic-strokes:3/, ins)
- assert_match(/korean-ksc5601:27950/, ins)
+ assert_match(/=ks-x1001:27950/, ins)
assert_match(/shinjigen-2:1777/, ins)
assert_match(/total-strokes:6/, ins)
- assert_match(/ucs:23383/, ins)
+ assert_match(/=ucs:23383/, ins)
+ assert_match(/=gt:8734/, ins)
+ assert_match(/=gt-k:1624/, ins)
+ assert_match(/=gt-pj-1:15226/, ins)
+ assert_match(/=jis-x0208:15226/, ins)
end
end