Multibyte/Big5.pm

filter: Statementstmt 38.4% 5 / 13 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 33.3% 1 / 3 Podpod n/a totaltotal 18.1% 6 / 33 CC 8 SCAR 40.6
CC
8
Cov
18%
__ANON__
72.0
__ANON__
2.0
BEGIN
1.0
CRAP 57.9
« Multibyte/UHC.pm ↑ Summary Multibyte/Big5Plus.pm »
1 package String::Multibyte::Big5;
2  
3 1 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 $VERSION = '1.12';
5  
6 +{
7 charset => 'Big-5',
8  
9 regexp => '(?:[\x00-\x7F]|[\x81-\xFE][\x40-\x7E\xA1-\xFE])',
10  
11 0 ▶ cmpchar => sub { $_[0] cmp $_[1] },
Subroutine __ANON__: not called CC=1 SCAR=6.9
12  
13 0 ▶ nextchar => sub {
Subroutine __ANON__: not called CC=8 SCAR=42.8
14 0 my $ch = shift;
15 0 my $len = length $ch;
16 0 ▶ if ($len < 1 || 2 < $len) {
Branch: 2 branches
BranchTrueFalseTotal
if ($len < 1 or 2 < $len) { } 0 0 0
elsif ($len == 1) { } 0 0 0
Condition0%0/3
$len < 1 or 2 < $len
l!l&&r!l&&!r
000
MC/DC0%0/2
$len < 1 or 2 < $len
$len < 1 2 < $len
Truth table0%0/3
A or B
A= $len < 1B= 2 < $len
ABresult
1X1
011
000
17 0 return undef;
18 }
19 elsif ($len == 1) {
20 0 ▶ return $ch eq "\x7F"
Branch: 1 branch
BranchTrueFalseTotal
$ch eq "\177" ? : 0 0 0
21 ? "\x81\x40"
22 : chr(ord($ch)+1);
23 }
24 else {
25 0 my($c, $d) = unpack('CC', $ch);
26 0 ▶ return $ch eq "\xFE\xFE"
Branch: 3 branches
BranchTrueFalseTotal
$ch eq "\376\376" ? : 0 0 0
$d == 254 ? : 0 0 0
$d == 126 ? : 0 0 0
27 ? undef
28 : $d == 0xFE
29 ? chr($c+1)."\x40"
30 : $d == 0x7E
31 ? chr($c)."\xA1"
32 : pack('CC', $c, $d+1);
33 }
34 },
35 1 };
36  
37 __END__
« Multibyte/UHC.pm ↑ Summary Multibyte/Big5Plus.pm »