| 1 | package Math::Business::HMA; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Math::Business::WMA; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | 1; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 0 | ▶ | sub tag { (shift)->[-1] } | ||||||||||||||||||||||||||
|
Subroutine
tag: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub recommended { croak "no recommendation" } | ||||||||||||||||||||||||||
|
Subroutine
recommended: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 15 | 1 | my $class = shift; | |||||||||||||||||||||||||||
| 16 | 1 | my $this = bless [ | |||||||||||||||||||||||||||
| 17 | undef, | ||||||||||||||||||||||||||||
| 18 | undef, | ||||||||||||||||||||||||||||
| 19 | undef, | ||||||||||||||||||||||||||||
| 20 | undef | ||||||||||||||||||||||||||||
| 21 | ], $class; | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 1 | my $days = shift; | |||||||||||||||||||||||||||
| 24 | 1 | ▶ | if( defined $days ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | 1 | $this->set_days( $days ); | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 1 | return $this; | |||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 1 | ▶ | sub set_days { | ||||||||||||||||||||||||||
|
Subroutine
set_days: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 32 | 1 | my $this = shift; | |||||||||||||||||||||||||||
| 33 | 1 | my $arg = int(shift); | |||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 1 | ▶ | croak "days must be a positive number" if $arg <= 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 1 | @$this = ( | |||||||||||||||||||||||||||
| 38 | Math::Business::WMA->new(int($arg/2)), | ||||||||||||||||||||||||||||
| 39 | Math::Business::WMA->new($arg), | ||||||||||||||||||||||||||||
| 40 | Math::Business::WMA->new(int(sqrt($arg))), | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | "HMA($arg)", # tag must be last | ||||||||||||||||||||||||||||
| 43 | ); | ||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 265 | ▶ | sub insert { | ||||||||||||||||||||||||||
|
Subroutine
insert: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 47 | 265 | my $this = shift; | |||||||||||||||||||||||||||
| 48 | 265 | my ($po2, $p, $sqp) = @$this; | |||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 265 | ▶ | croak "You must set the number of days before you try to insert" unless defined $sqp; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | 265 | ▶ | while( defined(my $P = shift) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | 265 | $po2->insert($P); | |||||||||||||||||||||||||||
| 53 | 265 | $p->insert($P); | |||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 265 | ▶ | if( defined( my $_p = $p->query ) and defined( my $_po2 = $po2->query ) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined(my $_p = $p->query) and defined(my $_po2 = $po2->query)
MC/DC50%1/2
defined(my $_p = $p->query) and defined(my $_po2 = $po2->query)
defined(my $_p = $p->query)
defined(my $_po2 = $po2->query)
Truth table66%2/3
A and B
A= defined(my $_p = $p->query)B= defined(my $_po2 = $po2->query)
| |||||||||||||||||||||||||||||
| 56 | 252 | $sqp->insert( 2*$_po2 - $_p ); | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 265 | ▶ | sub query { | ||||||||||||||||||||||||||
|
Subroutine
query: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 62 | 265 | my $this = shift; | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 265 | return $this->[2]->query; | |||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | __END__ | ||||||||||||||||||||||||||||