Tested/Test/Radio.pm

filter: Statementstmt 100% 31 / 31 Branchbran 90.0% 9 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 93.8% 46 / 49 CC 8 SCAR 13.3
CC
8
Cov
98%
check_stash
6.0
_grep_my_vars
3.0
BEGIN
1.0
CRAP 3.8
« Tested/Test/List.pm ↑ Summary Tested/Value/Radio.pm »
1 18 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 18 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package HTML::Tested::Test::Radio;
5 18 ▶use base 'HTML::Tested::Test::Value';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 19 ▶sub _grep_my_vars {
Subroutine _grep_my_vars: called CC=3 SCAR=11.0
8 19 my ($class, $name, $stash) = @_;
9 19 my @res;
10 19 ▶ while (my ($n, $v) = each %$stash) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$stash) 55 19 74
11 55 ▶ next unless $n =~ /^$name\_/;
Branch: 1 branch
BranchTrueFalseTotal
unless $n =~ /^$name\_/ 0 55 55
12 55 push @res, $n;
13 }
14 19 return @res;
15 }
16  
17 7 ▶sub check_stash {
Subroutine check_stash: called CC=6 SCAR=17.9
Pod undocumented
18 7 my ($class, $e_root, $name, $e_stash, $r_stash) = @_;
19 7 my @err;
20 7 for my $n ($class->_grep_my_vars($name, $e_stash)) {
21 20 my $e_val = $e_stash->{$n};
22 20 my $r_val = HTML::Tested::Test::Ensure_Value_To_Check(
23 $r_stash, $n, $e_val, \@err);
24 20 ▶ next unless defined($r_val);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $r_val 1 19 20
25 19 ▶ next if ($r_val eq $e_val);
Branch: 1 branch
BranchTrueFalseTotal
if $r_val eq $e_val 18 1 19
26 1 push @err, HTML::Tested::Test::Stash_Mismatch(
27 $n, $r_val, $e_val);
28 }
29  
30 7 for my $n ($class->_grep_my_vars($name, $r_stash)) {
31 20 ▶ next if exists $e_stash->{$n};
Branch: 1 branch
BranchTrueFalseTotal
if exists $e_stash->{$n} 19 1 20
32 push @err, HTML::Tested::Test::Stash_Mismatch(
33 1 $n, $r_stash->{$n}, undef);
34 }
35 7 return @err;
36 }
37  
38 5 ▶sub check_text {
Subroutine check_text: called CC=1 SCAR=0.0
Pod undocumented
39 5 my ($class, $e_root, $name, $e_stash, $text) = @_;
40 return map {
41 5 $class->_check_text_i($e_root, $name, $e_stash->{$_}, $text)
42 } $class->_grep_my_vars($name, $e_stash);
43 }
44  
45 18 1;
« Tested/Test/List.pm ↑ Summary Tested/Value/Radio.pm »