Cinderblock/MoveResult.pm

filter: Statementstmt 100% 15 / 15 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod 0.0% 0 / 1 totaltotal 95.2% 20 / 21 CC 2 SCAR 4.1
CC
2
Cov
100%
failed
2.0
BEGIN
1.0
_derive_delta
1.0
CRAP 1.5
« Cinderblock/Rulemap/Graph.pm ↑ Summary Cinderblock.pm »
1 package Games::Go::Cinderblock::MoveResult;
2 6 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 6 has move_attempt => (
5 isa => 'Games::Go::Cinderblock::MoveAttempt', # Games::Go::Cinderblock::MoveAttempt?
6 is => 'ro',
7 required => 1,
8 );
9  
10 6 has rulemap => (
11 isa => 'Games::Go::Cinderblock::Rulemap',
12 is => 'ro', #shouldn't change.
13 required => 1,
14 );
15 6 has basis_state=> (
16 is => 'ro',
17 required => 1,
18 isa => 'Games::Go::Cinderblock::State',
19 );
20  
21 6 has resulting_state=> (
22 is => 'ro',
23 # required if success?
24 isa => 'Games::Go::Cinderblock::State',
25 );
26 6 has delta => (
27 lazy => 1,
28 is => 'ro',
29 builder => '_derive_delta',
30 isa => 'Games::Go::Cinderblock::Delta',
31 );
32  
33 6 has succeeded => (
34 isa => 'Bool',
35 is => 'ro',
36 # lazy => 1,
37 # builder => '_determine_success',
38 required => 1,
39 );
40 6 has reason => (
41 isa => 'Str',
42 is => 'ro',
43 required => 0,
44 );
45  
46 1 ▶sub _derive_delta{
Subroutine _derive_delta: called CC=1 SCAR=0.0
47 1 my $self = shift;
48 1 return $self->basis_state->delta_to($self->resulting_state);
49 }
50  
51 # meh
52 4 ▶sub failed{
Subroutine failed: called CC=2 SCAR=6.9
Pod undocumented
53 4 my $self = shift;
54 4 ▶ return ($self->succeeded ? 0 : 1);
Branch: 1 branch
BranchTrueFalseTotal
$self->succeeded ? : 2 2 4
55 }
56 6 1;
57  
58 __END__
« Cinderblock/Rulemap/Graph.pm ↑ Summary Cinderblock.pm »