The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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('ShiftJIS',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('“ú–{Œê‚̃Jƒ^ƒJƒi', '‚Ÿ-‚ñƒ@-ƒ–¦-ß', '', 'h');
$join = join ':', map "$_=>$hash{$_}", sort keys %hash;

print $join eq '‚Ì=>1:ƒJ=>2:ƒ^=>1:ƒi=>1'
    ? "ok" : "not ok", " 4\n";

$str = '“ú–{Œê‚̃Jƒ^ƒJƒi';
%hash = $mb->strtr(\$str, '‚Ÿ-‚ñƒ@-ƒ“', 'ƒ@-ƒ“‚Ÿ-‚ñ', 'h');
$join = join ':', map "$_=>$hash{$_}", sort keys %hash;

print $join eq '‚Ì=>1:ƒJ=>2:ƒ^=>1:ƒi=>1'
    ? "ok" : "not ok", " 5\n";
print $str eq '“ú–{Œêƒm‚©‚½‚©‚È'
    ? "ok" : "not ok", " 6\n";

$str = '“ú–{Œê‚̃Jƒ^ƒJƒi‚Ì–{';
%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 '‚̃Jƒ^ƒJƒi‚Ì'
    ? "ok" : "not ok", " 8\n";

$str = '“ú–{Œê‚̃Jƒ^ƒJƒi‚Ì–{';
%hash = $mb->strtr(\$str, '‚Ÿ-‚ñƒ@-ƒ“', '', 'dh');
$join = join ':', map "$_=>$hash{$_}", sort keys %hash;

print $join eq '‚Ì=>2:ƒJ=>2:ƒ^=>1:ƒi=>1'
    ? "ok" : "not ok", " 9\n";
print $str eq '“ú–{Œê–{'
    ? "ok" : "not ok", " 10\n";

$str = '“ú–{Œê‚̃Jƒ^ƒJƒi‚Ì–{';
%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 '“ú–{Œê‚̃Jƒ^ƒJƒi‚Ì–{'
    ? "ok" : "not ok", " 12\n";

$str = '–{“–‚Ì“ú–{Œê‚̃Jƒ^ƒJƒi‚Ì–{';
%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 '!!‚Ì!!!‚̃Jƒ^ƒJƒi‚Ì!'
    ? "ok" : "not ok", " 14\n";

1;
__END__