File Coverage

blib/lib/Quantum/Superpositions/Lazy/Role/Operation.pm
Criterion Covered Total %
statement 17 17 100.0
branch 4 6 66.6
condition 1 3 33.3
subroutine 5 5 100.0
pod n/a
total 27 31 87.1


line stmt bran cond sub pod time code
1             package Quantum::Superpositions::Lazy::Role::Operation;
2              
3             our $VERSION = '1.10';
4              
5 15     15   116676 use v5.24;
  15         49  
6 15     15   69 use warnings;
  15         30  
  15         423  
7 15     15   113 use Carp qw(croak);
  15         36  
  15         748  
8              
9 15     15   74 use Moo::Role;
  15         28  
  15         117  
10              
11             requires qw(
12             run
13             supported_types
14             );
15              
16             has "sign" => (
17             is => "ro",
18             );
19              
20             sub _clear_parameters
21             {
22 81188     81188   123683 my ($self, $param_num, @parameters) = @_;
23 81188         160666 @parameters = grep defined, @parameters;
24              
25 81188 100       165865 my ($params_min, $params_max) = ref $param_num eq ref []
26             ? $param_num->@*
27             : ($param_num, undef)
28             ;
29              
30 81188 50       138373 croak "not enough parameters to " . $self->sign
31             if @parameters < $params_min;
32              
33 81188 50 33     127739 croak "too many parameters to " . $self->sign
34             if defined $params_max && @parameters > $params_max;
35              
36 81188         149242 return @parameters;
37             }
38              
39             1;