/
emoticon_test.rb
64 lines (60 loc) · 2.55 KB
/
emoticon_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
require File.dirname(__FILE__)+'/helper'
class DocomoEmoticonTest < Test::Unit::TestCase
def test_external_unicodecr_docomo
assert_equal "", Jpmobile::Emoticon::external_to_unicodecr_docomo(sjis("\xf8\x9f"))
end
def test_unicodecr_external_docomo
assert_equal sjis("\xf8\x9f"), Jpmobile::Emoticon::unicodecr_to_external("")
end
def test_unicodecr_external_docomo_for_string
assert_equal sjis("\xf8\x9f\xf8\xa0"), Jpmobile::Emoticon::unicodecr_to_external("", Jpmobile::Emoticon::CONVERSION_TABLE_TO_DOCOMO, true)
end
def test_unicodecr_utf8_docomo
assert_equal utf8("\356\230\276"), Jpmobile::Emoticon::unicodecr_to_utf8("")
end
def test_utf8_unicodecr_docomo
assert_equal "", Jpmobile::Emoticon::utf8_to_unicodecr(utf8("\356\230\276"))
end
end
class AuEmoticonTest < Test::Unit::TestCase
def test_au_external_unicodecr
assert_equal "", Jpmobile::Emoticon::external_to_unicodecr_au(sjis("\xf6\x59"))
end
def test_au_unicodecr_external
assert_equal sjis("\xf6\x59"), Jpmobile::Emoticon::unicodecr_to_external("")
end
def test_au_unicodecr_utf8
assert_equal utf8("\356\222\201"), Jpmobile::Emoticon::unicodecr_to_utf8("")
end
def test_au_utf8_unicodecr
assert_equal "", Jpmobile::Emoticon::utf8_to_unicodecr(utf8("\356\222\201"))
end
end
class SoftbankEmoticonTest < Test::Unit::TestCase
def test_jphone_webcode_cr
assert_equal "", Jpmobile::Emoticon::external_to_unicodecr_jphone("\x1b$G!!\x0f")
end
def test_softbank_cr
assert_equal "", Jpmobile::Emoticon::external_to_unicodecr_softbank([0xe001].pack('U'))
end
def test_vodafone_cr
assert_equal "", Jpmobile::Emoticon::external_to_unicodecr_softbank([0xe001].pack('U'))
end
def test_softbank_cr_webcode
assert_equal "\x1b$G!\x0f", Jpmobile::Emoticon::unicodecr_to_external("")
end
def test_softbank_cr_utf8
assert_equal utf8("\xef\x80\x81"), Jpmobile::Emoticon::unicodecr_to_utf8("")
end
def test_softbank_utf8_cr
assert_equal "", Jpmobile::Emoticon::utf8_to_unicodecr(utf8("\xef\x80\x81"))
end
def test_unicodecr_external_softbank_for_string
assert_equal "\x1b$Gj\x0f\x1b$Gi\x0f", Jpmobile::Emoticon::unicodecr_to_external("", Jpmobile::Emoticon::CONVERSION_TABLE_TO_SOFTBANK, true)
end
end
class KoukaiEmoticonTest < Test::Unit::TestCase
def test_koukai_sjis
assert_equal sjis("\x8c\xf6\x8a\x4a"), Jpmobile::Emoticon::external_to_unicodecr_docomo(sjis("\x8c\xf6\x8a\x4a"))
end
end