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