line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Chai::Core::Assertions::Above; |
2
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
52
|
|
3
|
2
|
|
|
2
|
|
89
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
46
|
|
4
|
2
|
|
|
2
|
|
10
|
use utf8; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
10
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
48
|
use Exporter qw/import/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
103
|
|
7
|
|
|
|
|
|
|
our @EXPORT_OK = qw/assert_above/; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
11
|
use Test::Chai::Util::Flag qw/flag/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
127
|
|
10
|
2
|
|
|
2
|
|
11
|
use Test::Chai::Util::GenericLength qw/generic_length/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
378
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub assert_above { |
13
|
9
|
|
|
9
|
0
|
13
|
my ($self, $n, $msg) = @_; |
14
|
|
|
|
|
|
|
|
15
|
9
|
50
|
|
|
|
20
|
flag($self, 'message', $msg) if defined $msg; |
16
|
9
|
|
|
|
|
20
|
my $obj = flag($self, 'object'); |
17
|
|
|
|
|
|
|
|
18
|
9
|
100
|
|
|
|
20
|
if (flag($self, 'do_length')) { |
19
|
3
|
|
|
|
|
8
|
my $len = generic_length($obj); |
20
|
3
|
|
|
|
|
11
|
return $self->assert( |
21
|
|
|
|
|
|
|
$len > $n, |
22
|
|
|
|
|
|
|
'expected #{this} to have a length above #{exp} but got #{act}', |
23
|
|
|
|
|
|
|
'expected #{this} to not have a length above #{exp}', |
24
|
|
|
|
|
|
|
$n, |
25
|
|
|
|
|
|
|
$len |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
else { |
30
|
6
|
|
|
|
|
26
|
return $self->assert( |
31
|
|
|
|
|
|
|
$obj > $n, |
32
|
|
|
|
|
|
|
'expected #{this} to be above ' . $n, |
33
|
|
|
|
|
|
|
'expected #{this} to be at most ' . $n |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |