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