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