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

BEGIN { $| = 1; print "1..53\n"; }
END {print "not ok 1\n" unless $loaded;}

use ShiftJIS::String qw(:kana :H2Z :Z2H toupper tolower);

$^W = 1;
$loaded = 1;
print "ok 1\n";

#####

{
  my $kataH = "\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
	    . "\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
	    . "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce"
	    . "\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd"
	    . "\xb6\xde\xb7\xde\xb8\xde\xb9\xde\xba\xde"
	    . "\xbb\xde\xbc\xde\xbd\xde\xbe\xde\xbf\xde"
	    . "\xc0\xde\xc1\xde\xc2\xde\xc3\xde\xc4\xde"
	    . "\xca\xde\xcb\xde\xcc\xde\xcd\xde\xce\xde"
	    . "\xca\xdf\xcb\xdf\xcc\xdf\xcd\xdf\xce\xdf\xb3\xde";

  my $kataZ = "\x83\x92\x83\x40\x83\x42\x83\x44\x83\x46"
	    . "\x83\x48\x83\x83\x83\x85\x83\x87\x83\x62"
	    . "\x83\x41\x83\x43\x83\x45\x83\x47\x83\x49"
	    . "\x83\x4a\x83\x4c\x83\x4e\x83\x50\x83\x52"
	    . "\x83\x54\x83\x56\x83\x58\x83\x5a\x83\x5c"
	    . "\x83\x5e\x83\x60\x83\x63\x83\x65\x83\x67"
	    . "\x83\x69\x83\x6a\x83\x6b\x83\x6c\x83\x6d"
	    . "\x83\x6e\x83\x71\x83\x74\x83\x77\x83\x7a"
	    . "\x83\x7d\x83\x7e\x83\x80\x83\x81\x83\x82"
	    . "\x83\x84\x83\x86\x83\x88\x83\x89\x83\x8a"
	    . "\x83\x8b\x83\x8c\x83\x8d\x83\x8f\x83\x93"
	    . "\x83\x4b\x83\x4d\x83\x4f\x83\x51\x83\x53"
	    . "\x83\x55\x83\x57\x83\x59\x83\x5b\x83\x5d"
	    . "\x83\x5f\x83\x61\x83\x64\x83\x66\x83\x68"
	    . "\x83\x6f\x83\x72\x83\x75\x83\x78\x83\x7b"
	    . "\x83\x70\x83\x73\x83\x76\x83\x79\x83\x7c\x83\x94";

  my $hiraZ = "\x82\xf0\x82\x9f\x82\xa1\x82\xa3\x82\xa5"
	    . "\x82\xa7\x82\xe1\x82\xe3\x82\xe5\x82\xc1"
	    . "\x82\xa0\x82\xa2\x82\xa4\x82\xa6\x82\xa8"
	    . "\x82\xa9\x82\xab\x82\xad\x82\xaf\x82\xb1"
	    . "\x82\xb3\x82\xb5\x82\xb7\x82\xb9\x82\xbb"
	    . "\x82\xbd\x82\xbf\x82\xc2\x82\xc4\x82\xc6"
	    . "\x82\xc8\x82\xc9\x82\xca\x82\xcb\x82\xcc"
	    . "\x82\xcd\x82\xd0\x82\xd3\x82\xd6\x82\xd9"
	    . "\x82\xdc\x82\xdd\x82\xde\x82\xdf\x82\xe0"
	    . "\x82\xe2\x82\xe4\x82\xe6\x82\xe7\x82\xe8"
	    . "\x82\xe9\x82\xea\x82\xeb\x82\xed\x82\xf1"
	    . "\x82\xaa\x82\xac\x82\xae\x82\xb0\x82\xb2"
	    . "\x82\xb4\x82\xb6\x82\xb8\x82\xba\x82\xbc"
	    . "\x82\xbe\x82\xc0\x82\xc3\x82\xc5\x82\xc7"
	    . "\x82\xce\x82\xd1\x82\xd4\x82\xd7\x82\xda"
	    . "\x82\xcf\x82\xd2\x82\xd5\x82\xd8\x82\xdb\x82\xa4\x81\x4a";

  my $all = $hiraZ.$kataZ.$kataH;

  foreach $ary (
    [ \&kataH2Z,  $hiraZ.$kataZ.$kataZ,  81 ],
    [ \&kanaH2Z,  $hiraZ.$kataZ.$kataZ,  81 ],
    [ \&hiraH2Z,  $hiraZ.$kataZ.$hiraZ,  81 ],
    [ \&kataZ2H,  $hiraZ.$kataH.$kataH,  81 ],
    [ \&kanaZ2H,  $kataH.$kataH.$kataH, 162 ],
    [ \&hiraZ2H,  $kataH.$kataZ.$kataH,  81 ],
    [ \&hiXka,    $kataZ.$hiraZ.$kataH, 162 ],
    [ \&hi2ka,    $kataZ.$kataZ.$kataH,  81 ],
    [ \&ka2hi,    $hiraZ.$hiraZ.$kataH,  81 ],
    [ \&spaceH2Z, $hiraZ.$kataZ.$kataH,   0 ],
    [ \&spaceZ2H, $hiraZ.$kataZ.$kataH,   0 ],
    [ \&toupper,  $hiraZ.$kataZ.$kataH,   0 ],
    [ \&tolower,  $hiraZ.$kataZ.$kataH,   0 ],
  ) {
    $str = $all;
    print &{ $ary->[0] }($str) eq $ary->[1]
	? "ok" : "not ok", " ", ++$loaded, "\n";
    print $str eq $all
	? "ok" : "not ok", " ", ++$loaded, "\n";
    print &{ $ary->[0] }(\$str) eq $ary->[2]
	? "ok" : "not ok", " ", ++$loaded, "\n";
    print $str eq $ary->[1]
	? "ok" : "not ok", " ", ++$loaded, "\n";
  }
}