1#!/usr/bin/perl 2# 3# kakasi test program for kakasi v2.2.5 (Perl module v0.1) 4# Ken-ichi Hirose <kenzo-@tama.or.jp> 5# 6 7$kakasi = "kakasi"; 8 9$process_all = 0; 10$process_all = 1 if ($ARGV[0] eq "-d"); 11 12sub use_test { 13BEGIN { $| = 1; print "\nPackage test\n"; } 14END {print " use => Fail\n" unless $loaded;} 15 use Text::Kakasi; 16 $loaded = 1; 17 print " use => Complite\n"; 18 19 ######################### End of black magic. 20 21 if ( Text::Kakasi::getopt_argv('kakasi','-w') == 0 ) { 22 if ( Text::Kakasi::do_kakasi("1") != NULL ) { 23 if ( Text::Kakasi::close_kanwadict() == 0 ) { 24 print " getopt_argv => Complite\n"; 25 print " do_kakasi => Complite\n"; 26 print " close_kanwadict => Complite\n"; 27 } else { 28 print " getopt_argv => Complite\n"; 29 print " do_kakasi => Complite\n"; 30 print " close_kanwadict => ng\n"; 31 } 32 } else { 33 print " getopt_argv => Complite\n"; 34 print " do_kakasi => Fail\n"; 35 print " close_kanwadict => Fail\n"; 36 Text::Kakasi::close_kanwadict(); 37 } 38 } else { 39 print " getopt_argv => Fail\n"; 40 print " do_kakasi => Fail\n"; 41 print " close_kanwadict => Fail\n"; 42 Text::Kakasi::close_kanwadict(); 43 } 44} 45&use_test(); 46 47sub command_test { 48 my ($argv,$in,$exp,$process) = @_; 49 my ($result); 50 my (@argv) = split(' ',$argv); 51 52 open(OUT,"> kakasi.in"); 53 print OUT $in; 54 close(OUT); 55 56 system("$kakasi @argv <kakasi.in >kakasi.out"); # easy 57 58 $result = ''; 59 open(IN,"< kakasi.out"); 60 while(<IN>) { 61 $result .= $_; 62 } 63 close(IN); 64 65 print (($result eq $exp)?"Complite":"Fail"); 66 print "(",length($result),"byte)"; 67 print STDERR "\n%$kakasi @argv <kakasi.in >kakasi.out\n" 68 if ($process || $process_all); 69 print STDERR "INPUT=<<__command_test__\n",$in,"__command_test__\n" 70 if ($process || $process_all); 71 print STDERR "\nEXPECT=<<__command_test__\n",$exp,"__command_test__\n" 72 if ($process || $process_all); 73 print STDERR "\nRESULT=<<__command_test__\n",$result,"__command_test__\n\n" 74 if ($process || $process_all); 75 76 unlink("./kakasi.in"); 77 unlink("./kakasi.out"); 78 79 return $result; 80} 81 82sub module_test { 83 use Text::Kakasi; 84 85 my ($argv,$in,$exp,$process) = @_; 86 my ($result); 87 my (@argv) = split(' ',$argv); 88 89 Text::Kakasi::getopt_argv("kakasi",@argv); 90 $result = Text::Kakasi::do_kakasi("$in"); 91 Text::Kakasi::close_kanwadict(); 92 93#print "exp:\n$exp\nresult:\n$result\n"; 94 95 print (($result eq $exp)?"Complite":"Fail"); 96 print "(",length($result),"byte)"; 97 print STDERR "\ngetopt_argv(\"kakasi\",@argv)\;\n" 98 if ($process || $process_all); 99 print STDERR "INPUT=<<__module_test__\n",$in,"_module_test__\n" 100 if ($process || $process_all); 101 print STDERR "\nEXPECT=<<__module_test__\n",$exp,"_module_test__\n" 102 if ($process || $process_all); 103 print STDERR "\nRESULT=<<__module_test__\n",$result,"_module_test__\n\n" 104 if ($process || $process_all); 105 106 return $result; 107} 108 109sub cross_check { 110 my ($argv,$in,$exp,$process) = @_; 111 my ($result1,$result2); 112 my (@argv) = split $argv; 113 114 open(OUT,"> kakasi.in"); 115 print OUT $in; 116 close(OUT); 117 system("$kakasi @argv <kakasi.in >kakasi.out"); # easy 118 $result1 = ''; 119 open(IN,"< kakasi.out"); 120 while(<IN>) { 121 $result1 .= $_; 122 } 123 close(IN); 124 Text::Kakasi::getopt_argv("kakasi",@argv); 125 $result2 = Text::Kakasi::do_kakasi("$in"); 126 Text::Kakasi::close_kanwadict(); 127 128 print (($result1 eq $result2)?"Complite":"Fail"); 129 print "(",length($result1),"byte,",length($result2),"byte)"; 130 print STDERR "RESULT=<<__command_test__\n",$result1,"\n__command_test__\n" 131 if ($process || $process_all); 132 print STDERR "\nRESULT=<<__module_test__\n",$result2,"\n__module_test__\n\n" 133 if ($process || $process_all); 134 135 unlink("./kakasi.in"); 136 unlink("./kakasi.out"); 137 138 return $result1; 139} 140 141sub test { 142 143 print "module => "; 144 &module_test(@_); 145 #&command_test(@_); 146 print "\n"; 147 148} 149 150### Basic Conversion 151$sample{'euc'} = unpack('u',<<'eofeof'); 152MI+.DSJ2_I-.DSZ'6:V%K87-I9F]R5VEN,S*AUZ3RI<"EIJ7SI>VAO*7)I+>D 153MQL2ZI*VDHJ3JI*RDR*2FI+2DMJ2DI-ZDN:&C"J2SI.RDSVMA:V%S:78R+C(N 154M-2ND[Z2KI,&]\:2MI/)C>6=W:6XL;6EN9W<S,J3'I;.E\Z71I:2EZZ3'I*VD 155MZPJDZ*2FI,NDMZ2_<&%T8VBD\J6SI?.ET:6DI>NTQ+:MI,[,M:2DROVDRZ3B 156MN\BDPZ3&Q+JDL:3KI.BDIE=I;F1O=W.DS@J\PKG4M\&\L*3+I+>DQJ3>I,BD 157MX:2_RJJDQZ2YH:,*NL>_M\C'I,^PRK*\I,Y796)086=E"CQ54DPZ:'1T<#HO 158M+W=W=RYT86UA+F]R+FIP+R4W16ME;GIO+2].86UA>G4O/@JDQ[CXLZNDMZ3& 159MI*2DWJ2YH:.ARKZPH:*DLZ3.I=JAO*6XI,_)K,W7I,NQ_J2XI,:YN;^WI+6D 160*[*3>I+FAHZ'+"@`` 161eofeof 162$sample{'sjis'} = unpack('u',<<'eofeof'); 163M@K&"S(*]@M&"S8%U:V%K87-I9F]R5VEN,S*!=H+P@U^#18.3@XV!6X-H@K6" 164MQ)*X@JN"H(+H@JJ"QH*D@K*"M(*B@MR"MX%""H*Q@NJ"S6MA:V%S:78R+C(N 165M-2N"[8*I@K^/D8*K@O!C>6=W:6XL;6EN9W<S,H+%@U*#DX-P@T.#BX+%@JN" 166MZ0J"YH*D@LF"M8*]<&%T8VB"\(-2@Y.#<(-#@XN*PHNK@LR6LX*BE?N"R8+@ 167MCF>"P8+$DKB"KX+I@N:"I%=I;F1O=W."S`J.P(USC&".KH+)@K6"Q(+<@L:" 168MWX*]E:B"Q8*W@4(*C<605I3%@LV(R(FZ@LQ796)086=E"CQ54DPZ:'1T<#HO 169M+W=W=RYT86UA+F]R+FIP+R4W16ME;GIO+2].86UA>G4O/@J"Q8SVBDJ"M8+$ 170M@J*"W(*W@4*!:8^N@4&"L8+,@WF!6X-7@LV52Y=V@LF)GH*V@L2-6)!6@K." 171*ZH+<@K>!0H%J"@`` 172eofeof 173$sample{'jis'} = unpack('u',<<'eofeof'); 174M&R1")#,D3B0_)%,D3R%6&RA":V%K87-I9F]R5VEN,S(;)$(A5R1R)4`E)B5S 175M)6TA/"5))#<D1D0Z)"TD(B1J)"PD2"0F)#0D-B0D)%XD.2$C&RA""ALD0B0S 176M)&PD3QLH0FMA:V%S:78R+C(N-2L;)$(D;R0K)$$]<20M)'(;*$)C>6=W:6XL 177M;6EN9W<S,ALD0B1')3,E<R51)20E:R1')"TD:QLH0@H;)$(D:"0F)$LD-R0_ 178M&RA"<&%T8V@;)$(D<B4S)7,E424D)6LT1#8M)$Y,-20D2GTD2R1B.T@D0R1& 179M1#HD,21K)&@D)ALH0E=I;F1O=W,;)$(D3ALH0@H;)$(\0CE4-T$\,"1+)#<D 180M1B1>)$@D820_2BHD1R0Y(2,;*$(*&R1".D<_-TA')$\P2C(\)$X;*$)796)0 181M86=E"CQ54DPZ:'1T<#HO+W=W=RYT86UA+F]R+FIP+R4W16ME;GIO+2].86UA 182M>G4O/@H;)$(D1SAX,RLD-R1&)"0D7B0Y(2,A2CXP(2(D,R1.)5HA/"4X)$]) 183?+$U7)$LQ?B0X)$8Y.3\W)#4D;"1>)#DA(R%+&RA""@`` 184eofeof 185 186print "\nBasic Conversion test\n"; 187print "EUC to SJIS... ";&test("-ieuc -osjis",$sample{'euc'},$sample{'sjis'}); 188print "SJIS to SJIS... ";&test("-isjis -osjis" ,$sample{'sjis'},$sample{'sjis'}); 189print "JIS to SJIS... ";&test("-inewjis -osjis" ,$sample{'jis'},$sample{'sjis'}); 190print "EUC to JIS ... ";&test("-ieuc -onewjis",$sample{'euc'},$sample{'jis'}); 191print "SJIS to JIS ... ";&test("-isjis -onewjis",$sample{'sjis'},$sample{'jis'}); 192print "JIS to JIS ... ";&test("-inewjis -onewjis",$sample{'jis'},$sample{'jis'}); 193print "EUC to EUC ... ";&test("-ieuc -oeuc",$sample{'euc'},$sample{'euc'}); 194print "SJIS to EUC ... ";&test("-isjis -oeuc" ,$sample{'sjis'},$sample{'euc'}); 195print "JIS to EUC ... ";&test("-inewjis -oeuc" ,$sample{'jis'},$sample{'euc'}); 196 197$wakachi{'euc'} = unpack('u',<<'eofeof'); 198MI+.DSJ2_I-.DSR"AUB!K86MA<VEF;W)7:6XS,B"AUR"D\B"EP*6FI?.E[:&\ 199MI<D@I+>DQB#$NJ2M(*2BI.JDK*3(I*:DM*2VI*2DWJ2Y(*&C"J2SI.RDSR!K 200M86MA<VEV,BXR+C4K(*3OI*NDP2"]\:2M(*3R(&-Y9W=I;BQM:6YG=S,R(*3' 201M(*6SI?.ET:6DI>L@I,>DK:3K"J3HI*:DRZ2WI+\@<&%T8V@@I/(@I;.E\Z71 202MI:2EZR"TQ+:M(*3.(,RUI*0@ROT@I,NDXB"[R*3#I,8@Q+JDL2"DZZ3HI*8@ 203M5VEN9&]W<R"DS@J\PKG4M\&\L""DRZ2WI,:DWJ3(I.&DOR#*JB"DQZ2Y(*&C 204M"KK'O[?(QR"DSR"PRK*\I,X@5V5B4&%G90H\55),.FAT='`Z+R]W=W<N=&%M 205M82YO<BYJ<"\E-T5K96YZ;RTO3F%M87IU+SX*I,<@N/BSJR"DMZ3&I*2DWJ2Y 206M(*&CH<H@OK`@H:(@I+.DSB"EVJ&\I;@@I,\@R:S-UR"DRR"Q_J2X(*3&(+FY 2071O[<@I+6D[*3>I+D@H:.ARPH` 208eofeof 209$wakachi{'sjis'} = unpack('u',<<'eofeof'); 210M@K&"S(*]@M&"S2"!=2!K86MA<VEF;W)7:6XS,B"!=B""\""#7X-%@Y.#C8%; 211M@V@@@K6"Q""2N(*K((*@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D,1LH0B`;)$(D:R1H)"8;*$(@5VEN9&]W<R`;)$(D3ALH0@H; 231M)$(\0CE4-T$\,!LH0B`;)$(D2R0W)$8D7B1()&$D/QLH0B`;)$)**ALH0B`; 232M)$(D1R0Y&RA"(!LD0B$C&RA""ALD0CI'/S=(1QLH0B`;)$(D3QLH0B`;)$(P 233M2C(\)$X;*$(@5V5B4&%G90H\55),.FAT='`Z+R]W=W<N=&%M82YO<BYJ<"\E 234M-T5K96YZ;RTO3F%M87IU+SX*&R1")$<;*$(@&R1".'@S*QLH0B`;)$(D-R1& 235M)"0D7B0Y&RA"(!LD0B$C(4H;*$(@&R1"/C`;*$(@&R1"(2(;*$(@&R1")#,D 236M3ALH0B`;)$(E6B$\)3@;*$(@&R1")$\;*$(@&R1"22Q-5QLH0B`;)$(D2QLH 237M0B`;)$(Q?B0X&RA"(!LD0B1&&RA"(!LD0CDY/S<;*$(@&R1")#4D;"1>)#D; 238.*$(@&R1"(2,A2QLH0@H` 239eofeof 240 241print "\nWakachigaki Conversion test\n"; 242print "EUC to SJIS... ";&test("-w -ieuc -osjis",$sample{'euc'},$wakachi{'sjis'}); 243print "SJIS to SJIS... ";&test("-w -isjis -osjis" ,$sample{'sjis'},$wakachi{'sjis'}); 244print "JIS to SJIS... ";&test("-w -inewjis -osjis" ,$sample{'jis'},$wakachi{'sjis'}); 245print "EUC to JIS ... ";&test("-w -ieuc -onewjis",$sample{'euc'},$wakachi{'jis'}); 246print "SJIS to JIS ... ";&test("-w -isjis -onewjis",$sample{'sjis'},$wakachi{'jis'}); 247print "JIS to JIS ... ";&test("-w -inewjis -onewjis",$sample{'jis'},$wakachi{'jis'}); 248print "EUC to EUC ... ";&test("-w -ieuc -oeuc",$sample{'euc'},$wakachi{'euc'}); 249print "SJIS to EUC ... ";&test("-w -isjis -oeuc" ,$sample{'sjis'},$wakachi{'euc'}); 250print "JIS to EUC ... ";&test("-w -inewjis -oeuc" ,$sample{'jis'},$wakachi{'euc'}); 251 252$yomikata{'eu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*&RA"(!LD 306M0CXP&RA"6WL;)$(D/R0K)#<;*$)\&R1")#<D9R0F&RA"?!LD0B1*)"H;*$)\ 307M&R1")%(D-1LH0GP;)$(D4B0U)#<;*$)\&R1")#\D*QLH0GP;)$(D2B1;&RA" 308M?5T@&R1"(2(;*$(@&R1")#,D3ALH0B`;)$(E6B$\)3@;*$(@&R1")$\;*$(@ 309M&R1"22Q-5QLH0EL;)$(D4B1$)&@D)ALH0ET@&R1")$L;*$(@&R1",7XD.!LH 310M0EM[&R1")"HD)B0X&RA"?!LD0B0J)"HD.!LH0GU=(!LD0B1&&RA"(!LD0CDY 311M/S<;*$);&R1")#,D)B0W)',;*$)=(!LD0B0U)&PD7B0Y&RA"(!LD0B$C(4L; 312#*$(* 313eofeof 314 315print "\nYomikata Conversion test\n"; 316print "EUC to SJIS... ";&test("-JH -p -f -s -ieuc -osjis",$sample{'euc'},$yomikata{'sjis'}); 317print "SJIS to SJIS... ";&test("-JH -p -f -s -isjis -osjis" ,$sample{'sjis'},$yomikata{'sjis'}); 318print "JIS to SJIS... ";&test("-JH -p -f -s -inewjis -osjis" ,$sample{'jis'},$yomikata{'sjis'}); 319print "EUC to JIS ... ";&test("-JH -p -f -s -ieuc -onewjis",$sample{'euc'},$yomikata{'jis'}); 320print "SJIS to JIS ... ";&test("-JH -p -f -s -isjis -onewjis",$sample{'sjis'},$yomikata{'jis'}); 321print "JIS to JIS ... ";&test("-JH -p -f -s -inewjis -onewjis",$sample{'jis'},$yomikata{'jis'}); 322print "EUC to EUC ... ";&test("-JH -p -f -s -ieuc -oeuc",$sample{'euc'},$yomikata{'euc'}); 323print "SJIS to EUC ... ";&test("-JH -p -f -s -isjis -oeuc" ,$sample{'sjis'},$yomikata{'euc'}); 324print "JIS to EUC ... ";&test("-JH -p -f -s -inewjis -oeuc" ,$sample{'jis'},$yomikata{'euc'}); 325 326$allascii = unpack('u',<<'eofeof'); 327M:V]N;W1A8FEH82AK86MA<VEF;W)7:6XS,BEW;V1A=6YR;UYD;W-H:71E:71A 328M9&%K:6%R:6=A=&]U9V]Z86EM87-U+@IK;W)E:&%K86MA<VEV,BXR+C4K=V%K 329M86-H:6MA:VEW;V-Y9W=I;BQM:6YG=S,R9&5K;VYP86ER=61E:VER=0IY;W5N 330M:7-H:71A<&%T8VAW;VMO;G!A:7)U:V%N:WEO=6YO;F%I:&]U;FEM;W1S=6MA 331M='1E:71A9&%K97)U>6]U5VEN9&]W<VYO"FII:VMO=6ME:7-H:6MI;FES:&ET 332M96UA=&]M971A;6]N;V1E<W4N"G-A:7-H:6YB86YH86EK86YO5V5B4&%G90H\ 333M55),.FAT='`Z+R]W=W<N=&%M82YO<BYJ<"\E-T5K96YZ;RTO3F%M87IU+SX* 334M9&5K;W5K86ES:&ET96EM87-U+BAT86MA<VAI+&MO;F]P95YJ:6AA:&ET<W5Y 335<;W5N:6]U:FET96MO=7-H:6YS87)E;6%S=2XI"@`` 336eofeof 337 338print "\nAll ASCII Conversion test\n"; 339print "EUC to ASCII... ";&test("-Ha -Ja -Ea -Ka -ieuc -osjis",$sample{'euc'},$allascii); 340print "SJIS to ASCII... ";&test("-Ha -Ja -Ea -Ka -isjis -osjis" ,$sample{'sjis'},$allascii); 341print "JIS to ASCII... ";&test("-Ha -Ja -Ea -Ka -inewjis -osjis" ,$sample{'jis'},$allascii); 342 343 344exit; 345 346# test for -f is not so simple. 347# end 348 349##### Master Test Data ########################################## 350# begin 644 test.euc 351# MI+.DSJ2_I-.DSZ'6:V%K87-I9F]R5VEN,S*AUZ3RI<"EIJ7SI>VAO*7)I+>D 352# MQL2ZI*VDHJ3JI*RDR*2FI+2DMJ2DI-ZDN:&C"J2SI.RDSVMA:V%S:78R+C(N 353# M-2ND[Z2KI,&]\:2MI/)C>6=W:6XL;6EN9W<S,J3'I;.E\Z71I:2EZZ3'I*VD 354# MZPJDZ*2FI,NDMZ2_<&%T8VBD\J6SI?.ET:6DI>NTQ+:MI,[,M:2DROVDRZ3B 355# MN\BDPZ3&Q+JDL:3KI.BDIE=I;F1O=W.DS@J\PKG4M\&\L*3+I+>DQJ3>I,BD 356# MX:2_RJJDQZ2YH:,*NL>_M\C'I,^PRK*\I,Y796)086=E"CQ54DPZ:'1T<#HO 357# M+W=W=RYT86UA+F]R+FIP+R4W16ME;GIO+2].86UA>G4O/@JDQ[CXLZNDMZ3& 358# MI*2DWJ2YH:.ARKZPH:*DLZ3.I=JAO*6XI,_)K,W7I,NQ_J2XI,:YN;^WI+6D 359# *[*3>I+FAHZ'+"@`` 360# ` 361# end 362############################################################# 363