File Coverage

lib/Spreadsheet/Engine/Function/SYD.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 2 2 100.0
total 19 19 100.0


line stmt bran cond sub pod time code
1             package Spreadsheet::Engine::Function::SYD;
2              
3 28     28   158 use strict;
  28         57  
  28         953  
4 28     28   187 use warnings;
  28         52  
  28         790  
5              
6 28     28   150 use base 'Spreadsheet::Engine::Fn::depreciation';
  28         54  
  28         9178  
7              
8 6     6 1 28 sub signature { 'n', 'n', '>=1', '>=0' }
9              
10             sub calculate {
11 3     3 1 124 my ($self, $cost, $salvage, $lifetime, $period) = @_;
12 3         77 return ($cost - $salvage) * ($lifetime - $period + 1) /
13             ((($lifetime + 1) * $lifetime) / 2);
14             }
15              
16             1;
17              
18             __END__