root/lang/perl/Encode-JP-Mobile/trunk/t/character.t @ 5448

Revision 5448, 1.4 kB (checked in by tokuhirom, 6 years ago)

merge Encode::JP::Mobile::Character branch to trunk.

Line 
1use strict;
2use warnings;
3use utf8;
4use Encode::JP::Mobile::Character;
5use Test::More tests => 18;
6
7# docomo
8{
9    my $char = Encode::JP::Mobile::Character->from_unicode(0xE63E);
10    is $char->name, "晴れ";
11    ok Encode::is_utf8($char->name), 'flagged';
12    is $char->unicode_hex, "E63E";
13    is $char->number, 1;
14    is $char->fallback_name('I'), undef;
15}
16
17# docomo ext
18{
19    my $char = Encode::JP::Mobile::Character->from_unicode(0xE757);
20    is $char->number, "拡76", 'docomo ext';
21    ok Encode::is_utf8($char->number);
22}
23
24{
25    is(Encode::JP::Mobile::Character->from_number(carrier => 'I', number => "拡76")->unicode_hex, 'E757');
26}
27
28# KDDI
29{
30    my $char = Encode::JP::Mobile::Character->from_unicode(0xECA2);
31    is $char->fallback_name('I'), "(>3<)";
32    is $char->fallback_name('H'), "(>3<)", "airhphone is same as docomo";
33    ok Encode::is_utf8($char->fallback_name('I'));
34    is $char->name, "チュー2", "What's name for 0xECA2";
35    ok Encode::is_utf8($char->name);
36    is $char->number, 455, 'number';
37}
38
39# KDDI from number.
40{
41    is(Encode::JP::Mobile::Character->from_number(carrier => 'E', number => 455)->unicode_hex, 'ECA2');
42}
43
44# carrier
45my $map = +{
46    0xE532 => 'V',
47    0xECE7 => 'E',
48    0xE6E5 => 'I',
49};
50while (my ($unicode, $carrier) = each %$map) {
51    is(Encode::JP::Mobile::Character->from_unicode($unicode)->carrier, $carrier, "carrier $carrier");
52}
53
Note: See TracBrowser for help on using the browser.