BEGIN { $| = 1; print "1..14\n"; }
END {print "not ok 1\n" unless $loaded;}
use String::Multibyte;
$^W = 1;
$loaded = 1;
print "ok 1\n";
$mb = String::Multibyte->new('EUC_JP',1);
#####
%hash = $mb->strtr(
'¤·¤º¤±¤µ¤ä¡¡¤¤¤Ï¤Ë¤·¤ß¤¤¤ë¡¡¤»¤ß¤Î¤³¤¨',
"¤¢-¤³¤ä-¤í", "", "h");
$join = join ':', map "$_=>$hash{$_}", sort keys %hash;
print $join eq '¤¤=>2:¤¨=>1:¤±=>1:¤³=>1:¤ä=>1:¤ë=>1'
? "ok" : "not ok", " 2\n";
$hash = $mb->strtr(
'¤·¤º¤±¤µ¤ä¡¡¤¤¤Ï¤Ë¤·¤ß¤¤¤ë¡¡¤»¤ß¤Î¤³¤¨',
"¤¢-¤³¤ä-¤í", "", "h");
$join = join ':', map "$_=>$$hash{$_}", sort keys %$hash;
print $join eq '¤¤=>2:¤¨=>1:¤±=>1:¤³=>1:¤ä=>1:¤ë=>1'
? "ok" : "not ok", " 3\n";
%hash = $mb->strtr('ÆüËܸì¤Î¥«¥¿¥«¥Ê', '¤¡-¤ó¥¡-¥ö¦-ß', '', 'h');
$join = join ':', map "$_=>$hash{$_}", sort keys %hash;
print $join eq '¤Î=>1:¥«=>2:¥¿=>1:¥Ê=>1'
? "ok" : "not ok", " 4\n";
$str = 'ÆüËܸì¤Î¥«¥¿¥«¥Ê';
%hash = $mb->strtr(\$str, '¤¡-¤ó¥¡-¥ó', '¥¡-¥ó¤¡-¤ó', 'h');
$join = join ':', map "$_=>$hash{$_}", sort keys %hash;
print $join eq '¤Î=>1:¥«=>2:¥¿=>1:¥Ê=>1'
? "ok" : "not ok", " 5\n";
print $str eq 'ÆüËܸì¥Î¤«¤¿¤«¤Ê'
? "ok" : "not ok", " 6\n";
$str = 'ÆüËܸì¤Î¥«¥¿¥«¥Ê¤ÎËÜ';
%hash = $mb->strtr(\$str, '¤¡-¤ó¥¡-¥ó', '', 'cdh');
$join = join ':', map "$_=>$hash{$_}", sort keys %hash;
print $join eq '¸ì=>1:Æü=>1:ËÜ=>2'
? "ok" : "not ok", " 7\n";
print $str eq '¤Î¥«¥¿¥«¥Ê¤Î'
? "ok" : "not ok", " 8\n";
$str = 'ÆüËܸì¤Î¥«¥¿¥«¥Ê¤ÎËÜ';
%hash = $mb->strtr(\$str, '¤¡-¤ó¥¡-¥ó', '', 'dh');
$join = join ':', map "$_=>$hash{$_}", sort keys %hash;
print $join eq '¤Î=>2:¥«=>2:¥¿=>1:¥Ê=>1'
? "ok" : "not ok", " 9\n";
print $str eq 'ÆüËܸìËÜ'
? "ok" : "not ok", " 10\n";
$str = 'ÆüËܸì¤Î¥«¥¿¥«¥Ê¤ÎËÜ';
%hash = $mb->strtr(\$str, '¤¡-¤ó¥¡-¥ó', '', 'ch');
$join = join ':', map "$_=>$hash{$_}", sort keys %hash;
print $join eq '¸ì=>1:Æü=>1:ËÜ=>2'
? "ok" : "not ok", " 11\n";
print $str eq 'ÆüËܸì¤Î¥«¥¿¥«¥Ê¤ÎËÜ'
? "ok" : "not ok", " 12\n";
$str = 'ËÜÅö¤ÎÆüËܸì¤Î¥«¥¿¥«¥Ê¤ÎËÜ';
%hash = $mb->strtr(\$str, '¤¡-¤ó¥¡-¥ó', '!', 'ch');
$join = join ':', map "$_=>$hash{$_}", sort keys %hash;
print $join eq '¸ì=>1:Åö=>1:Æü=>1:ËÜ=>3'
? "ok" : "not ok", " 13\n";
print $str eq '!!¤Î!!!¤Î¥«¥¿¥«¥Ê¤Î!'
? "ok" : "not ok", " 14\n";
1;
__END__