Test/Data/Sah/Human.pm

filter: Statementstmt 100% 35 / 35 Branchbran 75.0% 3 / 4 Conditioncond 42.8% 3 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 8 / 8 Podpod 100% 1 / 1 totaltotal 84.7% 50 / 59 CC 6 SCAR 10.1
CC
6
Cov
89%
__ANON__
5.1
test_human
2.0
BEGIN
1.0
CRAP 2.7
« Data/Sah/Compiler/human/TH/Sortable.pm ↑ Summary Data/Sah/Compiler/human/TH/hash.pm »
1 package Test::Data::Sah::Human;
2  
3 3 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use Test::More 0.98;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 ▶use Data::Sah;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 3 ▶use Exporter qw(import);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 3 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
13 3 our $DATE = '2024-02-16'; # DATE
14 3 our $DIST = 'Data-Sah'; # DIST
15 3 our $VERSION = '0.917'; # VERSION
16  
17 3 our @EXPORT_OK = qw(test_human);
18  
19 16 ▶sub test_human {
Subroutine test_human: called CC=2 SCAR=7.1
Pod documented
20 16 my %args = @_;
21 16 ▶ subtest $args{name} // $args{result}, sub {
Subroutine __ANON__: called CC=5 SCAR=16.3
22 16 my $sah = Data::Sah->new;
23 16 my $hc = $sah->get_compiler("human");
24 my %hargs = (
25 schema => $args{schema},
26 lang => $args{lang},
27 16 ▶ %{ $args{compile_opts} // {} },
Condition50%1/2
$args{"compile_opts"} // {}
l!l
016
MC/DC0%0/1
$args{"compile_opts"} // {}
$args{"compile_opts"}
Truth table50%1/2
A
A= $args{"compile_opts"}
Aresult
11
00
28 );
29 16 ▶ $hargs{format} //= "inline_text";
Condition50%1/2
$hargs{"format"} //= "inline_text"
l!l
016
MC/DC0%0/1
$hargs{"format"} //= "inline_text"
$hargs{"format"}
Truth table50%1/2
A
A= $hargs{"format"}
Aresult
11
00
30 16 my $cd = $hc->compile(%hargs);
31  
32 16 ▶ if (defined $args{result}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args{"result"}) 16 0 16
33 16 ▶ if (ref($args{result}) eq 'Regexp') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $args{'result'} eq 'Regexp') { } 2 14 16
34 2 like($cd->{result}, $args{result}, 'result');
35 } else {
36 14 is($cd->{result}, $args{result}, 'result');
37 }
38 }
39 16 ▶ };
Condition33%1/3
$args{"name"} // $args{"result"}
l!l&&r!l&&!r
0160
MC/DC0%0/2
$args{"name"} // $args{"result"}
$args{"name"} $args{"result"}
Truth table33%1/3
A // B
A= $args{"name"}B= $args{"result"}
ABresult
1X1
011
000
40 }
41  
42 3 1;
43 # ABSTRACT: Routines to test Data::Sah (human compiler)
44  
45 __END__
« Data/Sah/Compiler/human/TH/Sortable.pm ↑ Summary Data/Sah/Compiler/human/TH/hash.pm »