3 # $Id: rt.pl,v 2.0 2004/05/16 20:55:19 dankogai Exp $
8 if ($ENV{'PERL_CORE'}){
10 unshift @INC, '../lib';
11 $ucmdir = "../ext/Encode/ucm";
13 require Config; import Config;
14 if ($Config{'extensions'} !~ /\bEncode\b/) {
15 print "1..0 # Skip: Encode was not built\n";
18 if (ord("A") == 193) {
19 print "1..0 # Skip: EBCDIC\n";
28 Test::More->import(tests => 103);
29 opendir my $dh, $ucmdir or die "$ucmdir:$!";
31 map {File::Spec->catfile($ucmdir, $_) }
32 sort grep {/\.ucm$/o} readdir($dh);
35 Test::More->import("no_plan");
42 use Encode qw/encode decode/;
47 my ($name, $nchar, $nrt, $nok) = rttest($ucm);
49 ok($nok == 0, "$ucm => $name ($nchar, $nrt, $nok)");
54 my ($name, $nchar, $nrt, $nok);
55 open my $rfh, "<$ucm" or die "$ucm:$!";
56 # <U0000> \x00 |0 # <control>
58 s/#.*//o; /^$/ and next;
60 /^<code_set_name>\s+"([^\"]+)"/io or next;
63 /^<U([0-9a-f]+)>\s+(\S+)\s+\|(\d)/io or next;
67 my $uni = chr(hex($1));
68 my $enc = eval qq{ "$2" };
69 decode($name, $enc) eq $uni or $nok++;
70 encode($name, $uni) eq $enc or $nok++;
73 return($name, $nchar, $nrt, $nok);