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   21 use strict;
  3         12  
  3         143  
3 3     3   15 use warnings;
  3         6  
  3         178  
4 3     3   18 use Carp ();
  3         22  
  3         66  
5              
6 3     3   1866 use Number::WithError;
  3         31279  
  3         228  
7 3     3   30 use parent 'Number::WithError';
  3         8  
  3         26  
8              
9             use Class::XSAccessor {
10 3         32 getters => {
11             nsamples => '_dbr_nsamples',
12             },
13 3     3   298 };
  3         14  
14              
15              
16             sub new {
17 22     22 1 223 my $proto = shift;
18 22   66     48 my $class = ref($proto)||$proto;
19              
20 22         26 my $self;
21 22 100       66 if (not grep {$_ eq 'timing'} @_) {
  68         151  
22 12 100       24 push @_, 0 if @_ == 1;
23 12         51 $self = $proto->SUPER::new(@_);
24 12         204 $self->{_dbr_nsamples} = $proto->nsamples;
25 12         37 return $self;
26             }
27              
28 10         32 my %opt = @_;
29 10 50 33     50 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         35 $self = $class->SUPER::new($opt{timing}, $opt{uncertainty});
34 10         266 $self->{_dbr_nsamples} = $opt{nsamples};
35              
36 10         24 return $self;
37             }
38              
39              
40              
41              
42              
43             1;