File Coverage

blib/lib/Test/Proto/Compare/Numeric.pm
Criterion Covered Total %
statement 12 12 100.0
branch 1 2 50.0
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 18 20 90.0


line stmt bran cond sub pod time code
1             package Test::Proto::Compare::Numeric;
2 7     7   707 use strict;
  7         12  
  7         238  
3 7     7   32 use warnings;
  7         14  
  7         201  
4 7     7   31 use Moo;
  7         15  
  7         41  
5             extends 'Test::Proto::Compare';
6              
7             sub BUILDARGS {
8 22     22 0 4707 my $class = shift;
9             return {
10             summary => '<=>',
11 18     18   98 code => sub { $_[0] <=> $_[1] },
12 22 50       636 ( exists( $_[0] ) ? ( code => $_[0] ) : () )
13             };
14             }
15              
16             =head1 NAME
17              
18             Test::Proto::Compare::Numeric - numeric comparison
19              
20             =head1 SYNOPSIS
21              
22             my $c = Test::Proto::Compare::Numeric;
23             $c->compare($left, $right); # $left <=> $right
24             $c->reverse->compare($left, $right); # $right <=> $left
25              
26             This class provides a wrapper for comparison functions so they can be identified by formatters. Except as described below, identical to L.
27              
28             =head1 METHODS
29              
30             =head3 code
31              
32             Chainable attribute containing the code, which by default is a numeric comparison.
33              
34              
35             =head3 summary
36              
37             Chainable attribute; a brief human-readable description of the operation which will be performed. Default is '<=>'.
38              
39             =cut
40              
41             1;