Component.pm

filter: Statementstmt 81.5% 31 / 38 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 75.0% 9 / 12 Podpod 100% 8 / 8 totaltotal 72.8% 51 / 70 CC 4 SCAR 5.9
CC
4
Cov
74%
generate
3.3
new
2.1
load
2.0
CRAP 1.8
« Component/Controller/Status.pm ↑ Summary Component/Controller/History.pm »
1 package Games::Sudoku::Component;
2 {
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 2 ▶ use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6
7 2 our $VERSION = '0.02';
8
9 2 ▶ use Games::Sudoku::Component::Controller;
Subroutine BEGIN: called CC=1 SCAR=0.0
10
11 3 ▶ sub new {
Subroutine new: called CC=2 SCAR=7.4
Pod documented
12 3 my $class = shift;
13 3 ▶ my $this = bless {}, (ref $class || $class);
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
030
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
14
15 3 $this->{ctrl} = Games::Sudoku::Component::Controller->new(@_);
16
17 3 $this;
18 }
19
20 1 ▶ sub generate {
Subroutine generate: called CC=3 SCAR=12.0
Pod documented
21 1 my $this = shift;
22
23 0 ▶ my %options = ref $_[0] ? %{ $_[0] } : @_;
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 1 1
24
25 1 my $size = $this->{ctrl}->table->size;
26 1 ▶ my $blanks = $options{blanks} || ($size ** 2) * 0.75;
Condition33%1/3
$options{'blanks'} || $size ** 2 * 0.75
l!l&&r!l&&!r
100
MC/DC0%0/2
$options{'blanks'} || $size ** 2 * 0.75
$options{'blanks'} $size ** 2 * 0.75
Truth table33%1/3
A || B
A= $options{'blanks'}B= $size ** 2 * 0.75
ABresult
1X1
011
000
27
28 1 $this->{ctrl}->solve;
29 1 $this->{ctrl}->make_blank($blanks);
30 }
31
32 0 ▶ sub load {
Subroutine load: not called CC=1 SCAR=6.9
Pod documented
33 0 my $this = shift;
34
35 0 $this->{ctrl}->load(@_);
36 }
37
38 2 ▶ sub solve {
Subroutine solve: called CC=1 SCAR=0.0
Pod documented
39 2 my $this = shift;
40
41 2 $this->{ctrl}->solve;
42 }
43
44 1 ▶ sub is_solved {
Subroutine is_solved: called CC=1 SCAR=0.0
Pod documented
45 1 my $this = shift;
46
47 1 $this->{ctrl}->status->is_solved;
48 }
49
50 0 ▶ sub clear {
Subroutine clear: not called CC=1 SCAR=6.9
Pod documented
51 0 my $this = shift;
52
53 0 $this->{ctrl}->clear;
54 }
55
56 1 ▶ sub as_string {
Subroutine as_string: called CC=1 SCAR=0.0
Pod documented
57 1 my $this = shift;
58
59 1 $this->{ctrl}->table->as_string(@_);
60 }
61
62 0 ▶ sub as_HTML {
Subroutine as_HTML: not called CC=1 SCAR=6.9
Pod documented
63 0 my $this = shift;
64
65 0 $this->{ctrl}->table->as_HTML(@_);
66 }
67 }
68
69 2 1;
70 __END__
« Component/Controller/Status.pm ↑ Summary Component/Controller/History.pm »