Crop/Prop/Type/MEMORY.pm untested

filter: Statementstmt 0.0% 0 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 21 CC 1 SCAR 6.9
CC
1
Cov
0%
is_gt
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Crop::Prop::Type::MEMORY;
2 use base qw/ Crop::Prop::Type /;
3  
4 =begin nd
5 Class: Crop::Prop::Type::MEMORY
6 Property type MEMORY.
7
8 Default RHS units are bytes.
9 =cut
10  
11 use v5.14;
12 use warnings;
13  
14 =begin nd
15 Constants:
16 K - the 'kilo' for the 'Memory' type
17 =cut
18 use constant {
19 K => 1024,
20 };
21  
22 =begin nd
23 Method: is_gt ($val, $rhs)
24 Is greater $val over $rhs?
25
26 Parameters:
27 $val - LHS of <Crop:Prop::Value>
28 $rhs - RHS in bytes
29
30 Returns:
31 true - if $val is greater than $rhs
32 =cut
33 sub is_gt {
34 my ($class, $val, $rhs) = @_;
35
36 my $value = $val->val_int * K * K; # Mb
37
38 $value > $rhs;
39 }
40  
41 1;