| 1 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | package Test::Deep::Number 1.205; | ||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use Test::Deep::Cmp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use Scalar::Util; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | sub init | ||||||||||
| 11 | 8 | ▶ | { | ||||||||
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 12 | 8 | my $self = shift; | |||||||||
| 13 | |||||||||||
| 14 | 8 | $self->{val} = shift(@_) + 0; | |||||||||
| 15 | 8 | $self->{tolerance} = shift; | |||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | sub descend | ||||||||||
| 19 | 8 | ▶ | { | ||||||||
|
Subroutine
descend: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 20 | 8 | my $self = shift; | |||||||||
| 21 | 8 | my $got = shift; | |||||||||
| 22 | 8 | $self->data->{got_string} = $got; | |||||||||
| 23 | { | ||||||||||
| 24 | 1 | ▶ | no warnings 'numeric'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 25 | 8 | $got += 0; | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 8 | $self->data->{got} = $got; | |||||||||
| 29 | 8 | ▶ | if (defined(my $tolerance = $self->{tolerance})) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | { | ||||||||||
| 31 | 2 | return abs($got - $self->{val}) <= $tolerance; | |||||||||
| 32 | } | ||||||||||
| 33 | else | ||||||||||
| 34 | { | ||||||||||
| 35 | 6 | return $got == $self->{val}; | |||||||||
| 36 | } | ||||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | sub diag_message | ||||||||||
| 40 | 4 | ▶ | { | ||||||||
|
Subroutine
diag_message: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 41 | 4 | my $self = shift; | |||||||||
| 42 | |||||||||||
| 43 | 4 | my $where = shift; | |||||||||
| 44 | |||||||||||
| 45 | 4 | return "Comparing $where as a number"; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | sub renderGot | ||||||||||
| 49 | 4 | ▶ | { | ||||||||
|
Subroutine
renderGot: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 50 | 4 | my $self = shift; | |||||||||
| 51 | 4 | my $val = shift; | |||||||||
| 52 | |||||||||||
| 53 | 4 | my $got_string = $self->data->{got_string}; | |||||||||
| 54 | 4 | ▶ | if ("$val" ne "$got_string") | ||||||||
|
Branch: 1 branch
| |||||||||||
| 55 | { | ||||||||||
| 56 | 1 | $got_string = $self->SUPER::renderGot($got_string); | |||||||||
| 57 | 1 | return "$val ($got_string)" | |||||||||
| 58 | } | ||||||||||
| 59 | else | ||||||||||
| 60 | { | ||||||||||
| 61 | 3 | return $val; | |||||||||
| 62 | } | ||||||||||
| 63 | } | ||||||||||
| 64 | sub renderExp | ||||||||||
| 65 | 4 | ▶ | { | ||||||||
|
Subroutine
renderExp: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 66 | 4 | my $self = shift; | |||||||||
| 67 | |||||||||||
| 68 | 4 | my $exp = $self->{val}; | |||||||||
| 69 | |||||||||||
| 70 | 4 | ▶ | if (defined(my $tolerance = $self->{tolerance})) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 71 | { | ||||||||||
| 72 | 1 | return "$exp +/- $tolerance"; | |||||||||
| 73 | } | ||||||||||
| 74 | else | ||||||||||
| 75 | { | ||||||||||
| 76 | 3 | return $exp; | |||||||||
| 77 | } | ||||||||||
| 78 | } | ||||||||||
| 79 | |||||||||||
| 80 | 1 | 1; | |||||||||
| 81 | |||||||||||
| 82 | __END__ | ||||||||||