lib/Lingy/Lang/Number.pm

filter: Statementstmt 27.1% 16 / 59 Branchbran 0.0% 0 / 36 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 5 / 15 Podpod 0.0% 0 / 9 totaltotal 17.6% 21 / 119 CC 19 SCAR 23.1
CC
19
Cov
17%
greater_than
12.0
greater_equal
12.0
less_than
12.0
CRAP 10.0
« lib/Lingy/Lang/Namespace.pm ↑ Summary lib/Lingy/Lang/Regex.pm »
1 1 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Lingy::Lang::Number;
3  
4 1 ▶use Lingy::Common;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use base SCALARTYPE;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 use overload
8 0 ▶ '""' => sub { ${$_[0]} },
Subroutine __ANON__: not called CC=1 SCAR=6.9
9 1 '+' => \&add,
10 '-' => \&subtract,
11 '*' => \&multiply,
12 '/' => \&divide,
13 '==' => \&equal_to,
14 '>' => \&greater_than,
15 '>=' => \&greater_equal,
16 '<' => \&less_than,
17 '<=' => \&less_equal,
18 '%' => \&modulo,
19 cmp => \&comp_pair,
20 1 ▶ ;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 sub greater_than {
23 0 ▶ my ($x, $y) = @_;
Subroutine greater_than: not called CC=3 SCAR=24.8
Pod undocumented
24 0 ▶ $x = ref($x) ? $$x : $x;
Branch: 1 branch
BranchTrueFalseTotal
ref $x ? : 0 0 0
25 0 ▶ $y = ref($y) ? $$y : $y;
Branch: 1 branch
BranchTrueFalseTotal
ref $y ? : 0 0 0
26 0 BOOLEAN->new($x > $y);
27 }
28  
29 sub greater_equal {
30 0 ▶ my ($x, $y) = @_;
Subroutine greater_equal: not called CC=3 SCAR=24.8
Pod undocumented
31 0 ▶ $x = ref($x) ? $$x : $x;
Branch: 1 branch
BranchTrueFalseTotal
ref $x ? : 0 0 0
32 0 ▶ $y = ref($y) ? $$y : $y;
Branch: 1 branch
BranchTrueFalseTotal
ref $y ? : 0 0 0
33 0 BOOLEAN->new($x >= $y);
34 }
35  
36 sub less_than {
37 0 ▶ my ($x, $y) = @_;
Subroutine less_than: not called CC=3 SCAR=24.8
Pod undocumented
38 0 ▶ $x = ref($x) ? $$x : $x;
Branch: 1 branch
BranchTrueFalseTotal
ref $x ? : 0 0 0
39 0 ▶ $y = ref($y) ? $$y : $y;
Branch: 1 branch
BranchTrueFalseTotal
ref $y ? : 0 0 0
40 0 BOOLEAN->new($x < $y);
41 }
42  
43 sub less_equal {
44 0 ▶ my ($x, $y) = @_;
Subroutine less_equal: not called CC=3 SCAR=24.8
Pod undocumented
45 0 ▶ $x = ref($x) ? $$x : $x;
Branch: 1 branch
BranchTrueFalseTotal
ref $x ? : 0 0 0
46 0 ▶ $y = ref($y) ? $$y : $y;
Branch: 1 branch
BranchTrueFalseTotal
ref $y ? : 0 0 0
47 0 BOOLEAN->new($x <= $y);
48 }
49  
50 sub add {
51 0 ▶ my ($x, $y) = @_;
Subroutine add: not called CC=3 SCAR=24.8
Pod undocumented
52 0 my $class = ref($x);
53 0 ▶ $x = ref($x) ? $$x : $x;
Branch: 1 branch
BranchTrueFalseTotal
ref $x ? : 0 0 0
54 0 ▶ $y = ref($y) ? $$y : $y;
Branch: 1 branch
BranchTrueFalseTotal
ref $y ? : 0 0 0
55 0 $class->new($x + $y);
56 }
57  
58 sub subtract {
59 0 ▶ my ($x, $y) = @_;
Subroutine subtract: not called CC=3 SCAR=24.8
Pod undocumented
60 0 my $class = ref($x);
61 0 ▶ $x = ref($x) ? $$x : $x;
Branch: 1 branch
BranchTrueFalseTotal
ref $x ? : 0 0 0
62 0 ▶ $y = ref($y) ? $$y : $y;
Branch: 1 branch
BranchTrueFalseTotal
ref $y ? : 0 0 0
63 0 $class->new($x - $y);
64 }
65  
66 sub multiply {
67 0 ▶ my ($x, $y) = @_;
Subroutine multiply: not called CC=3 SCAR=24.8
Pod undocumented
68 0 my $class = ref($x);
69 0 ▶ $x = ref($x) ? $$x : $x;
Branch: 1 branch
BranchTrueFalseTotal
ref $x ? : 0 0 0
70 0 ▶ $y = ref($y) ? $$y : $y;
Branch: 1 branch
BranchTrueFalseTotal
ref $y ? : 0 0 0
71 0 $class->new($x * $y);
72 }
73  
74 sub divide {
75 0 ▶ my ($x, $y) = @_;
Subroutine divide: not called CC=3 SCAR=24.8
Pod undocumented
76 0 my $class = ref($x);
77 0 ▶ $x = ref($x) ? $$x : $x;
Branch: 1 branch
BranchTrueFalseTotal
ref $x ? : 0 0 0
78 0 ▶ $y = ref($y) ? $$y : $y;
Branch: 1 branch
BranchTrueFalseTotal
ref $y ? : 0 0 0
79 0 $class->new($x / $y);
80 }
81  
82 sub modulo {
83 0 ▶ my ($x, $y) = @_;
Subroutine modulo: not called CC=3 SCAR=24.8
Pod undocumented
84 0 my $class = ref($x);
85 0 ▶ $x = ref($x) ? $$x : $x;
Branch: 1 branch
BranchTrueFalseTotal
ref $x ? : 0 0 0
86 0 ▶ $y = ref($y) ? $$y : $y;
Branch: 1 branch
BranchTrueFalseTotal
ref $y ? : 0 0 0
87 0 $class->new($x % $y);
88 }
89  
90 1 1;
« lib/Lingy/Lang/Namespace.pm ↑ Summary lib/Lingy/Lang/Regex.pm »