Mandelbrot.pm

filter: Statementstmt 90.9% 40 / 44 Branchbran 57.1% 8 / 14 Conditioncond 25.0% 1 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 8 / 8 Podpod 100% 2 / 2 totaltotal 79.7% 59 / 74 CC 11 SCAR 21.6
CC
11
Cov
79%
run
13.6
BEGIN
1.0
BEGIN
1.0
CRAP 8.7
↑ Summary Mandelbrot/withmce.pm »
1 # -*- mode: cperl -*-
2 2 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 package Benchmark::Perl::Formance::Plugin::Mandelbrot;
7 # git description: 9f757a9
8  
9 2 our $AUTHORITY = 'cpan:SCHWIGON';
10 # ABSTRACT: Benchmark::Perl::Formance plugin - more modern mandelbrot
11 2 $Benchmark::Perl::Formance::Plugin::Mandelbrot::VERSION = '0.001';
12 2 our @default_subtests = qw( withmce withthreads );
13  
14 sub run
15 1 ▶{
Subroutine run: called CC=11 SCAR=26.1
Pod documented
16 1 my ($options) = @_;
17  
18 2 ▶ no strict "refs"; ## no critic
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 my %results = ();
21 1 my $verbose = $options->{verbose};
22 1 my $subtests = $options->{subtests};
23 0 ▶ my @subtests = scalar(@{$subtests||[]}) ? @{$subtests||[]} : @default_subtests;
Branch: 1 branch
BranchTrueFalseTotal
scalar @{$subtests or [];} ? : 0 1 1
Condition25%1/4
$subtests || []
l!l
10
$subtests || []
l!l
00
MC/DC0%0/1
$subtests || []
$subtests
MC/DC0%0/1
$subtests || []
$subtests
Truth table50%1/2
A
A= $subtests
Aresult
11
00
Truth table0%0/2
A
A= $subtests
Aresult
11
00
24  
25 1 for my $subtest (@subtests)
26 {
27 2 ▶ print STDERR "# - $subtest...\n" if $options->{verbose} > 2;
Branch: 1 branch
BranchTrueFalseTotal
if $options->{"verbose"} > 2 0 2 2
28 0 ▶ eval "use ".__PACKAGE__."::$subtest"; ## no critic
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
29 2 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 1 1 2
30 1 ▶ print STDERR "# Skip PerlStone plugin '$subtest'" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $verbose 1 0 1
31 1 ▶ print STDERR ":$@" if $verbose >= 2;
Branch: 1 branch
BranchTrueFalseTotal
if $verbose >= 2 0 1 1
32 1 ▶ print STDERR "\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $verbose 1 0 1
33 }
34 else {
35 1 eval {
36 1 my $main = __PACKAGE__."::$subtest"."::main";
37 1 $results{$subtest} = $main->($options);
38 };
39 1 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 1 1
40 0 $results{$subtest} = { failed => $@ };
41 }
42 }
43 }
44 1 return \%results;
45 }
46  
47 sub main
48 1 ▶{
Subroutine main: called CC=1 SCAR=0.0
Pod documented
49 1 my ($options) = @_;
50  
51 1 my $results = run($options);
52  
53 1 return $results;
54 }
55  
56 2 1; # End of Benchmark::Perl::Formance::Plugin::PerlStone2015
57  
58 __END__
↑ Summary Mandelbrot/withmce.pm »