File Coverage

blib/lib/Dumbbench/Result.pm
Criterion Covered Total %
statement 32 33 96.9
branch 5 6 83.3
condition 4 9 44.4
subroutine 7 7 100.0
pod 1 1 100.0
total 49 56 87.5


line stmt bran cond sub pod time code
1             package Dumbbench::Result;
2 3     3   17 use strict;
  3         6  
  3         75  
3 3     3   13 use warnings;
  3         6  
  3         80  
4 3     3   12 use Carp ();
  3         12  
  3         36  
5              
6 3     3   1285 use Number::WithError;
  3         17688  
  3         172  
7 3     3   30 use parent 'Number::WithError';
  3         4  
  3         20  
8              
9             use Class::XSAccessor {
10 3         25 getters => {
11             nsamples => '_dbr_nsamples',
12             },
13 3     3   179 };
  3         6  
14              
15              
16             sub new {
17 22     22 1 232 my $proto = shift;
18 22   66     57 my $class = ref($proto)||$proto;
19              
20 22         30 my $self;
21 22 100       32 if (not grep {$_ eq 'timing'} @_) {
  68         186  
22 12 100       26 push @_, 0 if @_ == 1;
23 12         27 $self = $proto->SUPER::new(@_);
24 12         266 $self->{_dbr_nsamples} = $proto->nsamples;
25 12         29 return $self;
26             }
27              
28 10         37 my %opt = @_;
29 10 50 33     52 if (not defined $opt{timing} or not defined $opt{uncertainty}
      33        
30             or not defined $opt{nsamples}) {
31 0         0 Carp::croak("Need 'timing', 'uncertainty', and 'nsamples' parameters");
32             }
33 10         48 $self = $class->SUPER::new($opt{timing}, $opt{uncertainty});
34 10         308 $self->{_dbr_nsamples} = $opt{nsamples};
35              
36 10         28 return $self;
37             }
38              
39              
40              
41              
42              
43             1;